[llvm-commits] [llvm-gcc-4.2] r43913 [21/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...

Bill Wendling isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007


Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,454 @@
+/* QtToolkit.java --
+   Copyright (C)  2005, 2006  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 gnu.java.awt.peer.qt;
+
+import gnu.java.awt.EmbeddedWindow;
+import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.java.awt.peer.EmbeddedWindowPeer;
+
+import java.awt.AWTException;
+import java.awt.Button;
+import java.awt.Canvas;
+import java.awt.Checkbox;
+import java.awt.CheckboxMenuItem;
+import java.awt.Choice;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Image;
+import java.awt.Label;
+import java.awt.List;
+import java.awt.MenuBar;
+import java.awt.Menu;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.FileDialog;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.PopupMenu;
+import java.awt.PrintJob;
+import java.awt.Scrollbar;
+import java.awt.ScrollPane;
+import java.awt.Window;
+import java.awt.datatransfer.Clipboard;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.event.AWTEventListener;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.im.InputMethodHighlight;
+import java.awt.peer.ButtonPeer;
+import java.awt.peer.FontPeer;
+import java.awt.peer.PanelPeer;
+import java.awt.peer.CanvasPeer;
+import java.awt.peer.FramePeer;
+import java.awt.peer.PopupMenuPeer;
+import java.awt.peer.CheckboxMenuItemPeer;
+import java.awt.peer.LabelPeer;
+import java.awt.peer.RobotPeer;
+import java.awt.peer.CheckboxPeer;
+import java.awt.peer.ScrollPanePeer;
+import java.awt.peer.ChoicePeer;
+import java.awt.peer.ListPeer;
+import java.awt.peer.ScrollbarPeer;
+import java.awt.peer.MenuBarPeer;
+import java.awt.peer.TextAreaPeer;
+import java.awt.peer.DialogPeer;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.TextFieldPeer;
+import java.awt.peer.FileDialogPeer;
+import java.awt.peer.MenuPeer;
+import java.awt.peer.WindowPeer;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import gnu.java.awt.ClasspathToolkit;
+
+public class QtToolkit extends ClasspathToolkit
+{
+  public static EventQueue eventQueue = null; // the native event queue
+  public static QtRepaintThread repaintThread = null; 
+  public static MainQtThread guiThread = null;
+  public static QtGraphicsEnvironment graphicsEnv = null;
+
+  private static void initToolkit()
+  {
+    eventQueue = new EventQueue();
+    repaintThread = new QtRepaintThread();
+    System.loadLibrary("qtpeer");
+
+    String theme = null;
+    try 
+      {
+	String style = System.getProperty("qtoptions.style");
+	if(style != null)
+	  theme = style;
+      } 
+    catch(SecurityException e)
+      {
+      }
+    catch(IllegalArgumentException e)
+      {
+      }
+
+    boolean doublebuffer = true;
+    try 
+      {
+	String style = System.getProperty("qtoptions.nodoublebuffer");
+	if(style != null)
+	  doublebuffer = false;
+      } 
+    catch(SecurityException e)
+      {
+      }
+    catch(IllegalArgumentException e)
+      {
+      }
+
+    guiThread = new MainQtThread( theme, doublebuffer );
+    guiThread.start();
+    repaintThread.start();
+  }
+
+  /**
+   * Construct the toolkit!
+   */
+  public QtToolkit()
+  {
+    if( guiThread == null )
+      initToolkit();
+
+    while (!guiThread.isRunning()); // make sure the GUI thread has started.
+
+    if( graphicsEnv == null )
+      graphicsEnv = new QtGraphicsEnvironment( this );
+  }
+
+  native String[] nativeFontFamilies();
+  
+  native int numScreens();
+
+  native int defaultScreen();
+
+  // ************ Public methods *********************
+
+  public synchronized native void beep();
+
+  public int checkImage(Image image, int w, int h, ImageObserver observer)
+  {
+    if(image instanceof QtImage)
+      return ((QtImage)image).checkImage(observer);
+
+    return ImageObserver.ERROR; // FIXME
+  }
+
+  protected ButtonPeer createButton( Button target )
+  {
+    return new QtButtonPeer( this, target );
+  }
+
+  protected CanvasPeer createCanvas(Canvas target)
+  {
+    return new QtCanvasPeer( this, target );
+  }
+
+  protected CheckboxPeer createCheckbox(Checkbox target)
+  {
+    return new QtCheckboxPeer( this, target );
+  }
+
+  protected  ChoicePeer createChoice(Choice target)
+  {
+    return new QtChoicePeer( this, target );
+  }
+
+  protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
+  {
+    return new QtMenuItemPeer( this, target );
+  }
+
+  public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) 
+  {
+    throw new RuntimeException("Not implemented");
+  }
+
+  protected FramePeer createFrame(Frame target)
+  {
+    return new QtFramePeer( this, target );
+  }
+
+  protected FileDialogPeer createFileDialog(FileDialog target)
+  {
+    return new QtFileDialogPeer( this, target );
+  }
+
+  public Image createImage(ImageProducer producer)
+  {
+    return new QtImage( producer );
+  }
+  
+  public Image createImage(byte[] imageData,
+			   int imageOffset,
+			   int imageLength)
+  {
+    byte[] dataCopy = new byte[imageLength];
+    System.arraycopy(imageData, imageOffset, dataCopy, 0, imageLength);
+    return new QtImage( dataCopy );
+  }
+  
+  public Image createImage(String filename)
+  {
+    return new QtImage( filename );
+  }
+
+  public Image createImage(URL url)
+  {
+    return new QtImage( url );
+  }
+
+  protected TextFieldPeer createTextField(TextField target)
+  {
+    return new QtTextFieldPeer(this,target);
+  }
+  
+  protected LabelPeer createLabel(Label target)
+  {
+    return new QtLabelPeer( this, target );
+  }
+
+  protected ListPeer createList(List target)
+  {
+    return new QtListPeer( this, target );
+  }
+
+  protected ScrollbarPeer createScrollbar(Scrollbar target)
+  {
+    return new QtScrollbarPeer( this, target );
+  }
+
+  protected ScrollPanePeer createScrollPane(ScrollPane target)
+  {
+    return new QtScrollPanePeer( this, target );
+  }
+
+  protected TextAreaPeer createTextArea(TextArea target)
+  {
+    return new QtTextAreaPeer( this, target );
+  }
+
+  protected PanelPeer createPanel(Panel target)
+  {
+    return new QtPanelPeer( this, target);
+  }
+
+  protected WindowPeer createWindow(Window target)
+  {
+    return new QtWindowPeer( this, target );
+  }
+
+  protected DialogPeer createDialog(Dialog target)
+  {
+    return new QtDialogPeer( this, target );
+  }
+
+  protected MenuBarPeer createMenuBar(MenuBar target)
+  {
+    return new QtMenuBarPeer( this, target );
+  }
+
+  protected MenuPeer createMenu(Menu target)
+  {
+    return new QtMenuPeer( this, target );
+  }
+
+  protected PopupMenuPeer createPopupMenu(PopupMenu target)
+  {
+    return new QtPopupMenuPeer( this, target );
+  }
+
+  protected MenuItemPeer createMenuItem(MenuItem target)
+  {
+    return new QtMenuItemPeer( this, target );
+  }
+
+  /**
+   * @since 1.4
+   */
+  public AWTEventListener[] getAWTEventListeners()
+  {
+    return null; // FIXME
+  }
+
+  /**
+   * @since 1.4
+   */
+  public AWTEventListener[] getAWTEventListeners(long mask)
+  {
+    return null; // FIXME
+  }
+
+  public ColorModel getColorModel()
+  {
+    return new DirectColorModel(32, 
+				0x00FF0000,
+				0x0000FF00,
+				0x000000FF,
+				0xFF000000);
+  }
+
+  /**
+   * Just return the defaults.
+   */
+  public String[] getFontList()
+  {
+    String[] builtIn = new String[] { "Dialog", 
+				      "DialogInput", 
+				      "Monospaced", 
+				      "Serif", 
+				      "SansSerif" };
+    String[] nat = nativeFontFamilies();
+    String[] allFonts = new String[ nat.length + 5 ];
+    System.arraycopy(builtIn, 0, allFonts, 0, 5);
+    System.arraycopy(nat, 0, allFonts, 5, nat.length);
+    return allFonts;
+  }
+
+  public FontMetrics getFontMetrics(Font font)
+  {
+    return new QtFontMetrics(font);
+  }
+
+  protected FontPeer getFontPeer(String name,
+				 int style)
+  {
+    Map attrs = new HashMap ();
+    ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+    ClasspathFontPeer.copySizeToAttrs(12, attrs); // Default size is 12.
+    return getClasspathFontPeer (name, attrs);
+  }
+
+  public Image getImage(String filename)
+  {
+    return new QtImage(filename);
+  }
+
+  public Image getImage(URL url)
+  {
+    return createImage( url );
+  }
+
+  public PrintJob getPrintJob(Frame frame,
+			      String jobtitle,
+			      Properties props)
+  {
+    SecurityManager sm;
+    sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPrintJobAccess();
+    
+    throw new RuntimeException("Not implemented");
+  }
+
+  public Clipboard getSystemClipboard()
+  {
+    throw new RuntimeException("Not implemented");
+  }
+
+  protected EventQueue getSystemEventQueueImpl()
+  {
+    return eventQueue;
+  }
+
+  public native Dimension getScreenSize();
+
+  public native int getScreenResolution();
+
+  public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+  {
+    return null; // FIXME
+  }  
+  
+  public boolean prepareImage(Image image, int w, int h, ImageObserver observer)
+  {
+    if(image instanceof QtImage)
+      return true;
+    return false; // FIXME?
+  }
+
+  public native void sync();
+
+  // ********************** ClasspathToolkit methods
+
+  public GraphicsEnvironment getLocalGraphicsEnvironment()
+  {
+    return graphicsEnv;
+  }
+
+  public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs)
+  {  
+    return new QtFontPeer (name, attrs);
+  }
+
+  // FIXME
+  public Font createFont(int format, InputStream stream)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  // FIXME
+  public RobotPeer createRobot (GraphicsDevice screen) throws AWTException
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public EmbeddedWindowPeer createEmbeddedWindow(EmbeddedWindow w)
+  {
+    //    return new QtEmbeddedWindowPeer( this, w );
+    return null;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,434 @@
+/* QtVolatileImage.java --
+   Copyright (C)  2005, 2006  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 gnu.java.awt.peer.qt;
+
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.ImageCapabilities;
+import java.awt.GraphicsConfiguration;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.MemoryImageSource;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.VolatileImage;
+import java.util.Hashtable;
+import java.util.WeakHashMap;
+
+/**
+ * QtVolatileImage - wraps a QImage
+ *
+ */
+public class QtVolatileImage extends VolatileImage
+{
+  int width = -1, height = -1;
+
+  /**
+   * Properties.
+   */
+  Hashtable props;
+
+  /**
+   * Pointer to the QImage
+   */
+  long nativeObject;
+
+  /*
+   * The 32-bit AARRGGBB format the  uses.
+   */
+  static ColorModel nativeModel = new DirectColorModel(32, 
+						       0x00FF0000,
+						       0x0000FF00,
+						       0x000000FF,
+						       0xFF000000);
+
+  /**
+   * Clears the image to RGBA 0
+   */
+  public native void clear();
+
+  /**
+   * Returns a copy of the pixel data as a java array.
+   */
+  private native int[] getPixels();
+
+  /**
+   * Allocates a QImage
+   */
+  private native void createImage();
+
+  /**
+   * HashMap of Graphics objects painting on this Image.
+   */
+  WeakHashMap painters;
+
+  /**
+   * Flags if this image is to be destroyed.
+   */
+  boolean killFlag;
+
+  /**
+   * Frees the above.
+   */
+  private native void freeImage();
+
+  /**
+   * Blit a QImage 
+   */
+  public native void blit(QtImage i);
+  public native void blit(QtImage i, int x, int y, int w, int h);
+
+  /**
+   * Sets the image to scaled copy of src image. hints are rendering hints.
+   */
+  private native void createScaledImage(QtVolatileImage src, int hints);
+
+  /**
+   * Draws the image optionally composited.
+   */
+  private native void drawPixels (QtGraphics gc, 
+				  int bg_red, int bg_green, int bg_blue, 
+				  int x, int y, 
+				  boolean composite);
+  /**
+   * Draws the image, optionally scaled and composited.
+   */
+  private native void drawPixelsScaled (QtGraphics gc, 
+					int bg_red, int bg_green, int bg_blue, 
+					int x, int y, int width, int height, 
+					boolean composite);
+
+  /**
+   * Draws the image transformed.
+   */
+  private native void drawPixelsTransformed (QtGraphics gc, QMatrix transform);
+  
+  /**
+   * Draws the image scaled flipped and optionally composited.
+   */
+  native void drawPixelsScaledFlipped (QtGraphics gc, 
+				       int bg_red, int bg_green, 
+				       int bg_blue, 
+				       boolean flipX, boolean flipY,
+				       int srcX, int srcY,
+				       int srcWidth, int srcHeight,
+				       int dstX, int dstY,
+				       int dstWidth, int dstHeight,
+				       boolean composite);
+
+  /**
+   * Constructs an empty QtVolatileImage.
+   */
+  public QtVolatileImage (int width, int height)
+  {
+    this.width = width;
+    this.height = height;
+    props = new Hashtable();
+    createImage();
+    clear();
+  }
+
+  /**
+   * Constructs a scaled version of the src bitmap, using Qt
+   */
+  private QtVolatileImage (QtVolatileImage src, int width, int height, 
+			   int hints)
+  {
+    this.width = width;
+    this.height = height;
+    props = new Hashtable();
+
+    createScaledImage(src, hints);
+  }
+
+
+  public void finalize()
+  {
+    dispose();
+  }
+
+  public void dispose()
+  {
+    if( painters == null || painters.isEmpty() )
+      freeImage();
+    else
+      killFlag = true; // can't destroy image yet. 
+    // Do so when all painters are gone.
+  }
+
+  // java.awt.Image methods ////////////////////////////////////////////////
+
+  public int getWidth (ImageObserver observer)
+  {
+    return getWidth();
+  }
+  
+  public int getHeight (ImageObserver observer)
+  {
+    return getHeight();
+  }
+
+  public Object getProperty (String name, ImageObserver observer)
+  {
+    Object value = props.get (name);
+    return (value == null) ? UndefinedProperty : value;
+  }
+
+  /**
+   * Returns the source of this image.
+   */
+  public ImageProducer getSource ()
+  {
+    return new MemoryImageSource(width, height, nativeModel, getPixels(), 
+				 0, width);
+  }
+
+  void putPainter(QtImageGraphics g)
+  {
+    if( painters == null )
+      painters = new WeakHashMap();
+    painters.put( g, "dummy" );
+  }
+
+  void removePainter(QtImageGraphics g)
+  {
+    painters.remove( g );
+    if( killFlag && painters.isEmpty() )
+      freeImage();
+  }
+
+  /**
+   * Creates a Graphics context for this image.
+   */
+  public Graphics getGraphics ()
+  {
+    QtImageGraphics g = new QtImageGraphics( this );
+    putPainter( g );
+    return g;
+  }
+  
+  /**
+   * Returns a scaled instance of this image.
+   */
+  public Image getScaledInstance(int width,
+				 int height,
+				 int hints)
+  {
+    if (width <= 0 || height <= 0)
+      throw new IllegalArgumentException("Width and height of scaled bitmap"+
+					 "must be >= 0");
+
+    return new QtVolatileImage(this, width, height, hints);
+  }
+
+  /**
+   */
+  public void flush ()
+  {
+    // FIXME ?
+  }
+
+  /**
+   * Returns the image status, used by QtToolkit
+   */
+  public int checkImage (ImageObserver observer)
+  {
+    return ImageObserver.ALLBITS | ImageObserver.WIDTH | ImageObserver.HEIGHT;
+  }
+
+  // Drawing methods ////////////////////////////////////////////////
+
+  /**
+   * Draws an image with eventual scaling/transforming.
+   */
+  public boolean drawImage (QtGraphics g, QMatrix matrix,
+			    ImageObserver observer)
+  {
+    drawPixelsTransformed (g, matrix);
+    return true;
+  }
+
+  /**
+   * Draws an image to the QtGraphics context, at (x,y) with optional
+   * compositing with a background color.
+   */
+  public boolean drawImage (QtGraphics g, int x, int y,
+			    Color bgcolor, ImageObserver observer)
+  {
+    if(bgcolor != null)
+      drawPixels(g, bgcolor.getRed (), bgcolor.getGreen (), 
+		 bgcolor.getBlue (), x, y, true);
+    else
+      drawPixels(g, 0, 0, 0, x, y, false);
+
+    return true;
+  }
+
+  /**
+   * Draws an image to the QtGraphics context, at (x,y) scaled to 
+   * width and height, with optional compositing with a background color.
+   */
+  public boolean drawImage (QtGraphics g, int x, int y, int width, int height,
+			    Color bgcolor, ImageObserver observer)
+  {
+    if(bgcolor != null)
+      drawPixelsScaled(g, bgcolor.getRed (), bgcolor.getGreen (), 
+		       bgcolor.getBlue (), x, y, width, height, true);
+    else
+      drawPixelsScaled(g, 0, 0, 0, x, y, width, height, false);
+    
+    return true;
+  }
+
+  /**
+   * Draws an image with eventual scaling/transforming.
+   */
+  public boolean drawImage (QtGraphics g, int dx1, int dy1, int dx2, int dy2, 
+			    int sx1, int sy1, int sx2, int sy2, 
+			    Color bgcolor, ImageObserver observer)
+  {
+    boolean flipX = (dx1 > dx2)^(sx1 > sx2);
+    boolean flipY = (dy1 > dy2)^(sy1 > sy2);
+    int dstWidth = Math.abs (dx2 - dx1);
+    int dstHeight = Math.abs (dy2 - dy1);
+    int srcWidth = Math.abs (sx2 - sx1);
+    int srcHeight = Math.abs (sy2 - sy1);
+    int srcX = (sx1 < sx2) ? sx1 : sx2;
+    int srcY = (sy1 < sy2) ? sy1 : sy2;
+    int dstX = (dx1 < dx2) ? dx1 : dx2;
+    int dstY = (dy1 < dy2) ? dy1 : dy2;
+
+    // Clipping. This requires the dst to be scaled as well, 
+    if (srcWidth > width)
+      {
+	dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth));
+	srcWidth = width - srcX;
+      }
+
+    if (srcHeight > height) 
+      {
+	dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight));
+	srcHeight = height - srcY;
+      }
+
+    if (srcWidth + srcX > width)
+      {
+	dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth);
+	srcWidth = width - srcX;
+      }
+
+    if (srcHeight + srcY > height)
+      {
+	dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight);
+	srcHeight = height - srcY;
+      }
+
+    if ( srcWidth <= 0 || srcHeight <= 0 || dstWidth <= 0 || dstHeight <= 0)
+      return true;
+
+    if(bgcolor != null)
+      drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), 
+			       bgcolor.getBlue (), 
+			       flipX, flipY,
+			       srcX, srcY,
+			       srcWidth, srcHeight,
+			       dstX,  dstY,
+			       dstWidth, dstHeight,
+			       true);
+    else
+      drawPixelsScaledFlipped (g, 0, 0, 0, flipX, flipY,
+			       srcX, srcY, srcWidth, srcHeight,
+			       dstX,  dstY, dstWidth, dstHeight,
+			       false);
+    return true;
+  }
+  
+  public native void copyArea(int x, int y, int width, int height, 
+			      int dx, int dy);
+
+  //******************** VolatileImage stuff ********************
+
+  public boolean contentsLost()
+  {
+    return false;
+  }
+
+  public Graphics2D createGraphics()
+  {
+    QtImageGraphics g = new QtImageGraphics(this);
+    putPainter( g );
+    return g;
+  }
+
+  public ImageCapabilities getCapabilities()
+  {
+    return new ImageCapabilities(false)
+      {
+	public boolean isTrueVolatile()
+	{
+	  return false;
+	}
+      };
+  }
+
+  public int getHeight()
+  {
+    return height;
+  }
+
+  public BufferedImage getSnapshot()
+  {
+    BufferedImage bi = new BufferedImage(width, height, 
+					 BufferedImage.TYPE_INT_ARGB_PRE);
+    bi.setRGB( 0, 0, width, height, getPixels(), 0, width);
+    return bi;
+  }
+
+  public int getWidth()
+  {
+    return width;
+  }
+
+  public int validate(GraphicsConfiguration gc)
+  {
+    return IMAGE_OK;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/qt/QtWindowPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* QtWindowPeer.java --
+   Copyright (C)  2005  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 gnu.java.awt.peer.qt;
+
+import java.awt.Component;
+import java.awt.peer.WindowPeer;
+
+public class QtWindowPeer extends QtContainerPeer implements WindowPeer
+{
+  public QtWindowPeer( QtToolkit kit, Component owner )
+  {
+    super( kit, owner );
+  }
+
+  protected native void init();
+
+  protected void setup()
+  {
+    super.setup();
+  }
+  
+  // ************ Public methods *********************
+
+  public native void toBack();
+
+  public native void toFront();
+
+  /*
+   * Belongs to Frame and Dialog, but no sense in duplicating code.
+   */
+  public native void setTitle(String title);
+
+  public void updateAlwaysOnTop()
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public boolean requestWindowFocus()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,224 @@
+/* SwingButtonPeer.java -- A Swing based peer for AWT buttons
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Button;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.peer.ButtonPeer;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+
+/**
+ * A Swing based peer for the AWT button.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingButtonPeer
+  extends SwingComponentPeer
+  implements ButtonPeer
+{
+
+  /**
+   * A specialized Swing button to be used as AWT button.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  class SwingButton
+    extends JButton
+    implements SwingComponent
+  {
+    /**
+     * Overridden so that this method returns the correct value even without a
+     * peer.
+     *
+     * @return the screen location of the button
+     */
+    public Point getLocationOnScreen()
+    {
+      return SwingButtonPeer.this.getLocationOnScreen();
+    }
+
+    /**
+     * Overridden so that the isShowing method returns the correct value for the
+     * swing button, even if it has no peer on its own.
+     *
+     * @return <code>true</code> if the button is currently showing,
+     *         <code>false</code> otherwise
+     */
+    public boolean isShowing()
+    {
+      boolean retVal = false;
+      if (SwingButtonPeer.this.awtComponent != null)
+        retVal = SwingButtonPeer.this.awtComponent.isShowing();
+      return retVal;
+    }
+
+    /**
+     * Overridden, so that the Swing button can create an Image without its
+     * own peer.
+     *
+     * @param w the width of the image
+     * @param h the height of the image
+     *
+     * @return an image
+     */
+    public Image createImage(int w, int h)
+    {
+      return SwingButtonPeer.this.createImage(w, h);
+    }
+
+    /**
+     * Overridden, so that the Swing button can create a Graphics without its
+     * own peer.
+     *
+     * @return a graphics instance for the button
+     */
+    public Graphics getGraphics()
+    {
+      return SwingButtonPeer.this.getGraphics();
+    }
+
+    /**
+     * Returns this button.
+     *
+     * @return this button
+     */
+    public JComponent getJComponent()
+    {
+      return this;
+    }
+
+    /**
+     * Handles mouse events by forwarding it to
+     * <code>processMouseEvent()</code> after having retargetted it to this
+     * button.
+     *
+     * @param ev the mouse event
+     */
+    public void handleMouseEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseEvent(ev);
+    }
+
+    /**
+     * Handles mouse motion events by forwarding it to
+     * <code>processMouseMotionEvent()</code> after having retargetted it to
+     * this button.
+     *
+     * @param ev the mouse motion event
+     */
+    public void handleMouseMotionEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseMotionEvent(ev);
+    }
+
+    /**
+     * Handles key events by forwarding it to
+     * <code>processKeyEvent()</code> after having retargetted it to this
+     * button.
+     *
+     * @param ev the mouse event
+     */
+    public void handleKeyEvent(KeyEvent ev)
+    {
+      ev.setSource(this);
+      processKeyEvent(ev);
+    }
+  }
+
+  /**
+   * Listens for ActionEvents on the Swing button and triggers corresponding
+   * ActionEvents on the AWT button.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  class SwingButtonListener implements ActionListener
+  {
+
+    /**
+     * Receives notification when an action was performend on the button.
+     *
+     * @param event the action event
+     */
+    public void actionPerformed(ActionEvent event)
+    {
+      Button b = (Button) SwingButtonPeer.this.awtComponent;
+      ActionListener[] l = b.getActionListeners();
+      if (l.length == 0)
+        return;
+      ActionEvent ev = new ActionEvent(b, ActionEvent.ACTION_PERFORMED,
+                                       b.getActionCommand());
+      for (int i = 0; i < l.length; ++i)
+        l[i].actionPerformed(ev);
+    }
+    
+  }
+
+  /**
+   * Constructs a new SwingButtonPeer.
+   *
+   * @param theButton the AWT button for this peer
+   */
+  public SwingButtonPeer(Button theButton)
+  {
+    SwingButton button = new SwingButton();
+    button.setText(theButton.getLabel());
+    button.addActionListener(new SwingButtonListener());
+    init(theButton, button);
+  }
+
+  /**
+   * Sets the label of the button. This call is forwarded to the setText method
+   * of the managed Swing button.
+   *
+   * @param label the label to set
+   */
+  public void setLabel(String label)
+  {
+    ((SwingButton) swingComponent).setText(label);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,64 @@
+/* SwingCanvasPeer.java -- A canvas peer based on Swing
+   Copyright (C) 2006 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 gnu.java.awt.peer.swing;
+
+import java.awt.Canvas;
+import java.awt.peer.CanvasPeer;
+import java.awt.peer.LightweightPeer;
+
+/**
+ * A CanvasPeer to be used together with the Swing peers.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingCanvasPeer
+  extends SwingComponentPeer
+  implements LightweightPeer, CanvasPeer
+{
+
+  /**
+   * Creates a new <code>SwingCanvasPeer</code> for the specified Canvas.
+   *
+   * @param canvas the canvas.
+   */
+  public SwingCanvasPeer(Canvas canvas)
+  {
+    init(canvas, null);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,89 @@
+/* SwingComponent.java -- An interface that defines a Swing component for peers
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JComponent;
+
+/**
+ * Defines some additional methods that the Swing components must implement
+ * in order to work with the Swing peers. This is usually achieved by
+ * subclassing a Swing component and forwarding the method calls to some
+ * protected JComponent method.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public interface SwingComponent
+{
+
+  /**
+   * Returns the actual swing compenent.
+   *
+   * @return the actual swing compenent
+   */
+  JComponent getJComponent();
+
+  /**
+   * Handles a mouse event. This is usually forwarded to
+   * {@link java.awt.Component#processMouseMotionEvent(MouseEvent)} of the swing
+   * component.
+   *
+   * @param ev the mouse event
+   */
+  void handleMouseEvent(MouseEvent ev);
+
+  /**
+   * Handles a mouse motion event. This is usually forwarded to
+   * {@link java.awt.Component#processMouseEvent(MouseEvent)} of the swing
+   * component.
+   *
+   * @param ev the mouse motion event
+   */
+  void handleMouseMotionEvent(MouseEvent ev);
+
+  /**
+   * Handles a key event. This is usually forwarded to
+   * {@link java.awt.Component#processKeyEvent(KeyEvent)} of the swing
+   * component.
+   *
+   * @param ev the key event
+   */
+  void handleKeyEvent(KeyEvent ev);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1002 @@
+/* SwingComponentPeer.java -- An abstract base class for Swing based peers
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.AWTEvent;
+import java.awt.AWTException;
+import java.awt.BufferCapabilities;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.BufferCapabilities.FlipContents;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.PaintEvent;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.VolatileImage;
+import java.awt.peer.ComponentPeer;
+import java.awt.peer.ContainerPeer;
+
+/**
+ * The base class for Swing based component peers. This provides the basic
+ * functionality needed for Swing based component peers. Many methods are
+ * implemented to forward to the Swing component. Others however forward
+ * to the component's parent and expect the toplevel component peer to provide
+ * a real implementation of it. These are for example the key methods
+ * {@link #getGraphics()} and {@link #createImage(int, int)}, as well as
+ * {@link #getLocationOnScreen()}.
+ *
+ * This class also provides the necesary hooks into the Swing painting and
+ * event handling system. In order to achieve this, it traps paint, mouse and
+ * key events in {@link #handleEvent(AWTEvent)} and calls some special methods
+ * ({@link #peerPaint(Graphics)}, {@link #handleKeyEvent(KeyEvent)},
+ * {@link #handleMouseEvent(MouseEvent)} and
+ * {@link #handleMouseMotionEvent(MouseEvent)}) that call the corresponding
+ * Swing methods.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingComponentPeer
+  implements ComponentPeer
+{
+
+  /**
+   * The AWT component for this peer.
+   */
+  protected Component awtComponent;
+
+  /**
+   * The Swing component for this peer.
+   */
+  protected SwingComponent swingComponent;
+
+  /**
+   * Creates a SwingComponentPeer instance. Subclasses are expected to call
+   * this constructor and thereafter call
+   * {@link #init(Component,SwingComponent)}
+   * in order to setup the AWT and Swing components properly.
+   */
+  protected SwingComponentPeer()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Initializes the AWT and Swing component for this peer. It is expected that
+   * subclasses call this from within their constructor.
+   *
+   * @param awtComp the AWT component for this peer
+   * @param swingComp the Swing component for this peer
+   */
+  protected void init(Component awtComp, SwingComponent swingComp)
+  {
+    awtComponent = awtComp;
+    swingComponent = swingComp;
+  }
+
+  /**
+   * Returns the construction status of the specified image. This is called
+   * by {@link Component#checkImage(Image, int, int, ImageObserver)}.
+   *
+   * @param img the image
+   * @param width the width of the image
+   * @param height the height of the image
+   * @param ob the image observer to be notified of updates of the status
+   *
+   * @return a bitwise ORed set of ImageObserver flags
+   */
+  public int checkImage(Image img, int width, int height, ImageObserver ob)
+  {
+    return Toolkit.getDefaultToolkit().checkImage(img, width, height, ob);
+  }
+
+  /**
+   * Creates an image by starting the specified image producer. This is called
+   * by {@link Component#createImage(ImageProducer)}.
+   *
+   * @param prod the image producer to be used to create the image
+   *
+   * @return the created image
+   */
+  public Image createImage(ImageProducer prod)
+  {
+    Image image = Toolkit.getDefaultToolkit().createImage(prod);
+	return image;
+  }
+
+  /**
+   * Creates an empty image with the specified <code>width</code> and
+   * <code>height</code>.
+   *
+   * This is implemented to let the parent component create the image. This
+   * eventually goes up to the top-level component peer, which is then expected
+   * to deliver the image.
+   *
+   * @param width the width of the image to be created
+   * @param height the height of the image to be created
+   *
+   * @return the created image
+   */
+  public Image createImage(int width, int height)
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    return parentPeer.createImage(width, height);
+  }
+
+  /**
+   * Disables the component. This is called by {@link Component#disable()}.
+   */
+  public void disable()
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setEnabled(false);
+  }
+
+  /**
+   * Disposes the component peer. This should release all resources held by the
+   * peer. This is called when the component is no longer in use.
+   */
+  public void dispose()
+  {
+    awtComponent = null;
+    swingComponent = null;
+  }
+
+  /**
+   * Enables the component. This is called by {@link Component#enable()}.
+   */
+  public void enable()
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setEnabled(true);
+  }
+
+  /**
+   * Returns the color model of the component. This is currently not used.
+   *
+   * @return the color model of the component
+   */
+  public ColorModel getColorModel()
+  {
+    // FIXME: When this peer method will be used, we need to provide an
+    // implementation of this, probably forwarding to the toplevel peer, like
+    // in the other methods.
+    return null;
+  }
+
+  /**
+   * Returns the font metrics for the specified font. This is called by
+   * {@link Component#getFontMetrics(Font)}.
+   *
+   * This is implemented to query the font metrics from the parent component.
+   * This will eventually call the top-level component peer, which is then
+   * expected to deliver a font metrics object.
+   *
+   * @param f the font for which to query the font metrics
+   *
+   * @return the font metrics for the specified font
+   */
+  public FontMetrics getFontMetrics(Font f)
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    return parentPeer.getFontMetrics(f);
+  }
+
+  /**
+   * Returns a {@link Graphics} object suitable for drawing on this component.
+   * This is called by {@link Component#getGraphics()}.
+   *
+   * This is implemented to query the graphics from the parent component and
+   * adjust the clip and translation to match this component.
+   * This will eventually call the top-level component peer, which is then
+   * expected to deliver a graphics object.
+   *
+   * @return a graphics object suitable for drawing on this component
+   */
+  public Graphics getGraphics()
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    Graphics g = parentPeer.getGraphics();
+    g.translate(awtComponent.getX(), awtComponent.getY());
+    g.setClip(0, 0, awtComponent.getWidth(), awtComponent.getHeight());
+    return g;
+  }
+
+  /**
+   * Returns the location of this component in screen coordinates. This is
+   * called by {@link Component#getLocationOnScreen()}.
+   *
+   * This is implemented to query the parent component peer for its screen
+   * location and adds the offset of this component to it. This will eventually
+   * call the top-level component's peer, which is then expected to provide
+   * it's screen location.
+   *
+   * @return the location of this component in screen coordinates
+   */
+  public Point getLocationOnScreen()
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    Point location = parentPeer.getLocationOnScreen();
+    location.x += awtComponent.getX();
+    location.y += awtComponent.getY();
+    return location;
+  }
+
+  /**
+   * Returns the minimum size for the component. This is called by
+   * {@link Component#getMinimumSize()}.
+   *
+   * This is implemented to return the Swing component's minimum size.
+   *
+   * @return the minimum size for the component
+   */
+  public Dimension getMinimumSize()
+  {
+    Dimension retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getMinimumSize();
+    else
+      retVal = new Dimension(0, 0);
+    return retVal;
+  }
+
+  /**
+   * Returns the preferred size for the component. This is called by
+   * {@link Component#getPreferredSize()}.
+   *
+   * This is implemented to return the Swing component's preferred size.
+   *
+   * @return the preferred size for the component
+   */
+  public Dimension getPreferredSize()
+  {
+    Dimension retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getPreferredSize();
+    else
+      retVal = new Dimension(0, 0);
+    return retVal;
+  }
+
+  /**
+   * Returns the toolkit that created this peer.
+   *
+   * @return the toolkit that created this peer
+   */
+  public Toolkit getToolkit()
+  {
+    return Toolkit.getDefaultToolkit();
+  }
+
+  /**
+   * Handles the given event. This is called from
+   * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to 
+   * react to events for the component.
+   *
+   * @param e the event
+   */
+  public void handleEvent(AWTEvent e)
+  {
+    switch (e.getID())
+    {
+      case PaintEvent.UPDATE:
+      case PaintEvent.PAINT:
+        // This only will work when the component is showing.
+        if (awtComponent.isShowing())
+          {
+            Graphics g = getGraphics();
+            Rectangle clip = ((PaintEvent)e).getUpdateRect();
+            g.clipRect(clip.x, clip.y, clip.width, clip.height);
+            //if (this instanceof LightweightPeer)
+            //  {
+            if (e.getID() == PaintEvent.UPDATE)
+              awtComponent.update(g);
+            else
+              awtComponent.paint(g);
+            //  }
+            // We paint the 'heavyweights' at last, so that they appear on top of
+            // everything else.
+            peerPaint(g);
+            g.dispose();
+          }
+        break;
+      case MouseEvent.MOUSE_PRESSED:
+      case MouseEvent.MOUSE_RELEASED:
+      case MouseEvent.MOUSE_CLICKED:
+      case MouseEvent.MOUSE_ENTERED:
+      case MouseEvent.MOUSE_EXITED:
+        handleMouseEvent((MouseEvent) e);
+        break;
+      case MouseEvent.MOUSE_MOVED:
+      case MouseEvent.MOUSE_DRAGGED:
+        handleMouseMotionEvent((MouseEvent) e);
+        break;
+      case KeyEvent.KEY_PRESSED:
+      case KeyEvent.KEY_RELEASED:
+      case KeyEvent.KEY_TYPED:
+        handleKeyEvent((KeyEvent) e);
+        break;
+      default:
+        // Other event types are not handled here.
+        break;
+    }
+  }
+
+  /**
+   * Makes the component invisible. This is called from
+   * {@link Component#hide()}.
+   *
+   * This is implemented to call setVisible(false) on the Swing component.
+   */
+  public void hide()
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setVisible(false);
+
+    Component parent = awtComponent.getParent();
+    if (parent != null)
+      parent.repaint(awtComponent.getX(), awtComponent.getY(),
+                     awtComponent.getWidth(), awtComponent.getHeight());
+  }
+
+  /**
+   * Returns <code>true</code> if the component can receive keyboard input
+   * focus. This is called from {@link Component#isFocusTraversable()}.
+   * 
+   * This is implemented to return isFocusable() from the Swing component.
+   *
+   * @specnote Part of the earlier 1.1 API, replaced by isFocusable().
+   */
+  public boolean isFocusTraversable()
+  {
+    return swingComponent != null ?
+             swingComponent.getJComponent().isFocusable() : false;
+  }
+
+  /**
+   * Returns <code>true</code> if the component can receive keyboard input
+   * focus. This is called from {@link Component#isFocusable()}.
+   *
+   * This is implemented to return isFocusable() from the Swing component.
+   */
+  public boolean isFocusable()
+  {
+    return swingComponent != null ?
+             swingComponent.getJComponent().isFocusable() : false;
+  }
+
+  /**
+   * Returns the minimum size for the component. This is called by
+   * {@link Component#minimumSize()}.
+   *
+   * This is implemented to return the Swing component's minimum size.
+   *
+   * @return the minimum size for the component
+   */
+  public Dimension minimumSize()
+  {
+    Dimension retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getMinimumSize();
+    else
+      retVal = new Dimension(0, 0);
+    return retVal;
+  }
+
+  /**
+   * Returns the preferred size for the component. This is called by
+   * {@link Component#getPreferredSize()}.
+   *
+   * This is implemented to return the Swing component's preferred size.
+   *
+   * @return the preferred size for the component
+   */
+  public Dimension preferredSize()
+  {
+    Dimension retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getPreferredSize();
+    else
+      retVal = new Dimension(0, 0);
+    return retVal;
+  }
+
+  public void paint(Graphics graphics)
+  {
+    // FIXME: I don't know what this method is supposed to do.
+  }
+
+  /**
+   * Prepares an image for rendering on this component. This is called by
+   * {@link Component#prepareImage(Image, int, int, ImageObserver)}.
+   *
+   * @param img the image to prepare
+   * @param width the desired width of the rendered image
+   * @param height the desired height of the rendered image
+   * @param ob the image observer to be notified of updates in the preparation
+   *        process
+   *
+   * @return <code>true</code> if the image has been fully prepared,
+   *         <code>false</code> otherwise (in which case the image observer
+   *         receives updates)
+   */
+  public boolean prepareImage(Image img, int width, int height, ImageObserver ob)
+  {
+    Component parent = awtComponent.getParent();
+    if(parent != null)
+    {
+      ComponentPeer parentPeer = parent.getPeer();
+      return parentPeer.prepareImage(img, width, height, ob);
+    }
+    else
+    {
+      return Toolkit.getDefaultToolkit().prepareImage(img, width, height, ob);
+    }
+  }
+
+  public void print(Graphics graphics)
+  {
+    // FIXME: I don't know what this method is supposed to do.
+  }
+
+  /**
+   * Repaints the specified rectangle of this component. This is called from
+   * {@link Component#repaint(long, int, int, int, int)}.
+   *
+   * This is implemented to call repaint() on the Swing component.
+   *
+   * @param tm number of milliseconds to wait with repainting
+   * @param x the X coordinate of the upper left corner of the damaged rectangle
+   * @param y the Y coordinate of the upper left corner of the damaged rectangle
+   * @param width the width of the damaged rectangle
+   * @param height the height of the damaged rectangle
+   */
+  public void repaint(long tm, int x, int y, int width, int height)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().repaint(tm, x, y, width, height);
+    else
+      {
+        PaintEvent ev = new PaintEvent(awtComponent, PaintEvent.UPDATE,
+                                       new Rectangle(x, y, width, height));
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ev);
+      }
+  }
+
+  /**
+   * Requests that this component receives the focus. This is called from
+   * {@link Component#requestFocus()}.
+   * 
+   * This calls requestFocus() on the Swing component.
+   *
+   * @specnote Part of the earlier 1.1 API, apparently replaced by argument 
+   *           form of the same method.
+   */
+  public void requestFocus()
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().requestFocus();
+  }
+
+  /**
+   * Requests that this component receives the focus. This is called from
+   * {@link Component#requestFocus()}.
+   *
+   * This calls requestFocus() on the Swing component.
+   *
+   * @param source TODO
+   * @param bool1 TODO
+   * @param bool2 TODO
+   * @param x TODO
+   *
+   * @return TODO
+   */
+  public boolean requestFocus(Component source, boolean bool1, boolean bool2, long x)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().requestFocus();
+    return swingComponent != null;
+  }
+
+  /**
+   * Notifies the peer that the bounds of this component have changed. This
+   * is called by {@link Component#reshape(int, int, int, int)}.
+   *
+   * This is implemented to call setBounds() on the Swing component.
+   *
+   * @param x the X coordinate of the upper left corner of the component
+   * @param y the Y coordinate of the upper left corner of the component
+   * @param width the width of the component
+   * @param height the height of the component
+   */
+  public void reshape(int x, int y, int width, int height)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setBounds(x, y, width, height);
+  }
+
+  /**
+   * Sets the background color of the component. This is called by
+   * {@link Component#setBackground(Color)}.
+   *
+   * This is implemented to call setBackground() on the Swing component.
+   *
+   * @param color the background color to set
+   */
+  public void setBackground(Color color)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setBackground(color);
+  }
+
+  /**
+   * Notifies the peer that the bounds of this component have changed. This
+   * is called by {@link Component#setBounds(int, int, int, int)}.
+   *
+   * This is implemented to call setBounds() on the Swing component.
+   *
+   * @param x the X coordinate of the upper left corner of the component
+   * @param y the Y coordinate of the upper left corner of the component
+   * @param width the width of the component
+   * @param height the height of the component
+   */
+  public void setBounds(int x, int y, int width, int height)
+  {
+    reshape(x, y, width, height);
+  }
+
+  /**
+   * Sets the cursor of the component. This is called by
+   * {@link Component#setCursor(Cursor)}.
+   *
+   * This is implemented to call setCursor() on the Swing component.
+   *
+   * @specnote Part of the earlier 1.1 API, apparently no longer needed.
+   */
+  public void setCursor(Cursor cursor)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setCursor(cursor);
+  }
+
+  /**
+   * Sets the enabled/disabled state of this component. This is called by
+   * {@link Component#setEnabled(boolean)}.
+   *
+   * This is implemented to call setEnabled() on the Swing component.
+   *
+   * @param enabled <code>true</code> to enable the component,
+   *        <code>false</code> to disable it
+   */
+  public void setEnabled(boolean enabled)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setEnabled(enabled);
+  }
+
+  /**
+   * Sets the font of the component. This is called by
+   * {@link Component#setFont(Font)}.
+   *
+   * This is implemented to call setFont() on the Swing component.
+   *
+   * @param font the font to set
+   */
+  public void setFont(Font font)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setFont(font);
+  }
+
+  /**
+   * Sets the foreground color of the component. This is called by
+   * {@link Component#setForeground(Color)}.
+   *
+   * This is implemented to call setForeground() on the Swing component.
+   *
+   * @param color the foreground color to set
+   */
+  public void setForeground(Color color)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setForeground(color);
+  }
+
+  /**
+   * Sets the visibility state of the component. This is called by
+   * {@link Component#setVisible(boolean)}.
+   *
+   * This is implemented to call setVisible() on the Swing component.
+   *
+   * @param visible <code>true</code> to make the component visible,
+   *        <code>false</code> to make it invisible
+   */
+  public void setVisible(boolean visible)
+  {
+    if (visible)
+      show();
+    else
+      hide();
+  }
+
+  /**
+   * Makes the component visible. This is called by {@link Component#show()}.
+   *
+   * This is implemented to call setVisible(true) on the Swing component.
+   */
+  public void show()
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setVisible(true);
+  }
+
+  /** 
+   * Get the graphics configuration of the component. The color model
+   * of the component can be derived from the configuration.
+   *
+   * This is implemented to return the GraphicsConfiguration of the parent
+   * component. This will eventually call the toplevel component peer, which
+   * is expected to provide a real implementation.
+   *
+   * @return the graphics configuration of the component
+   */
+  public GraphicsConfiguration getGraphicsConfiguration()
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    return parentPeer.getGraphicsConfiguration();
+  }
+
+  /**
+   * Part of an older API, no longer needed.
+   */
+  public void setEventMask(long mask)
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Returns <code>true</code> if this component has been obscured,
+   * <code>false</code> otherwise. This will only work if
+   * {@link #canDetermineObscurity()} also returns <code>true</code>.
+   *
+   * This is not yet implemented.
+   *
+   * @return <code>true</code> if this component has been obscured,
+   *         <code>false</code> otherwise.
+   */
+  public boolean isObscured()
+  {
+    return false;
+  }
+
+  /**
+   * Returns <code>true</code> if this component peer can determine if the
+   * component has been obscured, <code>false</code> otherwise.
+   *
+   * This is not yet implemented.
+   *
+   * @return <code>true</code> if this component peer can determine if the
+   *         component has been obscured, <code>false</code> otherwise
+   */
+  public boolean canDetermineObscurity()
+  {
+    return false;
+  }
+
+  /**
+   * Coalesces the specified paint event.
+   *
+   * @param e the paint event
+   */
+  public void coalescePaintEvent(PaintEvent e)
+  {
+    // Nothing to do here yet.
+  }
+
+  /**
+   * Updates the cursor. This is not yet implemented.
+   */
+  public void updateCursorImmediately()
+  {
+    // Nothing to do here yet.
+  }
+
+  /**
+   * Returns true, if this component can handle wheel scrolling,
+   * <code>false</code> otherwise.
+   *
+   * This is not yet implemented and returns <code>false</code>. 
+   *
+   * @return true, if this component can handle wheel scrolling,
+   *         <code>false</code> otherwise
+   */
+  public boolean handlesWheelScrolling()
+  {
+    return false;
+  }
+
+  /**
+   * A convenience method that creates a volatile image.  The volatile
+   * image is created on the screen device on which this component is
+   * displayed, in the device's current graphics configuration.
+   *
+   * This is implemented to let the parent component peer create an image.
+   * This eventually ends up in the toplevel component peer, which is then
+   * responsible for creating the real image.
+   *
+   * @param width width of the image
+   * @param height height of the image
+   *
+   * @see VolatileImage
+   *
+   * @since 1.2
+   */
+  public VolatileImage createVolatileImage(int width, int height)
+  {
+    Component parent = awtComponent.getParent();
+    VolatileImage im = null;
+    if (parent != null)
+      {
+        ComponentPeer parentPeer = parent.getPeer();
+        im = parentPeer.createVolatileImage(width, height);
+      }
+    return im;
+  }
+
+  /**
+   * Create a number of image buffers that implement a buffering
+   * strategy according to the given capabilities.
+   *
+   * This is implemented to forward to the parent component peer. Eventually
+   * this ends up in the top level component peer, which is then responsible
+   * for doing the real work.
+   *
+   * @param numBuffers the number of buffers
+   * @param caps the buffering capabilities
+   *
+   * @throws AWTException if the specified buffering strategy is not
+   * implemented
+   *
+   * @since 1.2
+   */
+  public void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    parentPeer.createBuffers(numBuffers, caps);
+  }
+
+  /**
+   * Return the back buffer of this component.
+   *
+   * This is implemented to forward to the parent. Eventually this ends
+   * up in the toplevel component, which is then responsible for providing
+   * a back buffer.
+   *
+   * @return the back buffer of this component.
+   *
+   * @since 1.2
+   */
+  public Image getBackBuffer()
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    return parentPeer.getBackBuffer();
+  }
+
+  /**
+   * Perform a page flip, leaving the contents of the back buffer in
+   * the specified state.
+   *
+   * This is implemented to forward to the parent. Eventually this ends
+   * up in the toplevel component, which is then responsible for doing the real
+   * work.
+   *
+   * @param contents the state in which to leave the back buffer
+   *
+   * @since 1.2
+   */
+  public void flip(FlipContents contents)
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    parentPeer.flip(contents);
+  }
+
+  /**
+   * Destroy the resources created by createBuffers.
+   *
+   * This is implemented to forward to the parent component peer. Eventually
+   * this ends up in the top level component peer, which is then responsible
+   * for doing the real work.
+   *
+   * @since 1.2
+   */
+  public void destroyBuffers()
+  {
+    Component parent = awtComponent.getParent();
+    ComponentPeer parentPeer = parent.getPeer();
+    parentPeer.destroyBuffers();
+  }
+
+  /**
+   * Get the bounds of this component peer.
+   *
+   * This is implemented to forward to the Swing component.
+   *
+   * @return component peer bounds
+   * @since 1.5
+   */
+  public Rectangle getBounds()
+  {
+    Rectangle retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getBounds();
+    else
+      retVal = new Rectangle();
+    return retVal;
+  }
+
+  /**
+   * Reparent this component under another container.
+   * 
+   * @param parent
+   * @since 1.5
+   */
+  public void reparent(ContainerPeer parent)
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Set the bounds of this component peer.
+   *
+   * This is implemented to forward to the swing component.
+   *
+   * @param x the new x co-ordinate
+   * @param y the new y co-ordinate
+   * @param width the new width
+   * @param height the new height
+   * @param z the new stacking level
+   * @since 1.5
+   */
+  public void setBounds(int x, int y, int width, int height, int z)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().setBounds(x, y, width, height);
+    // FIXME: Somehow handle the Z order.
+  }
+
+  /**
+   * Check if this component supports being reparented.
+   * 
+   * @return true if this component can be reparented,
+   * false otherwise.
+   * @since 1.5
+   */
+  public boolean isReparentSupported()
+  {
+    return true;
+  }
+
+
+  /**
+   * Layout this component peer.
+   *
+   * @since 1.5
+   */
+  public void layout()
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().doLayout();
+  }
+
+  /**
+   * Triggers 'heavyweight' painting of the components. This usually calls
+   * paint() on the Swing component.
+   *
+   * @param g the graphics context to use for painting
+   */
+  protected void peerPaint(Graphics g)
+  {
+    if (swingComponent != null)
+      swingComponent.getJComponent().paint(g);
+  }
+
+  /**
+   * Handles mouse events on the component. This is usually forwarded to the
+   * SwingComponent's processMouseEvent() method.
+   *
+   * @param e the mouse event
+   */
+  protected void handleMouseEvent(MouseEvent e)
+  {
+    if (swingComponent != null)
+      swingComponent.handleMouseEvent(e);
+  }
+
+  /**
+   * Handles mouse motion events on the component. This is usually forwarded
+   * to the SwingComponent's processMouseMotionEvent() method.
+   *
+   * @param e the mouse motion event
+   */
+  protected void handleMouseMotionEvent(MouseEvent e)
+  {
+    if (swingComponent != null)
+      swingComponent.handleMouseMotionEvent(e);
+  }
+
+  /**
+   * Handles key events on the component. This is usually forwarded to the
+   * SwingComponent's processKeyEvent() method.
+   *
+   * @param e the key event
+   */
+  protected void handleKeyEvent(KeyEvent e)
+  {
+    if (swingComponent != null)
+      swingComponent.handleKeyEvent(e);
+  }
+
+  /**
+   * Returns the AWT component for this peer.
+   *
+   * @return the AWT component for this peer
+   */
+  public Component getComponent()
+  {
+    return awtComponent;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,249 @@
+/* SwingContainerPeer.java -- A Swing based peer for AWT containers
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Shape;
+import java.awt.event.MouseEvent;
+import java.awt.peer.ComponentPeer;
+import java.awt.peer.ContainerPeer;
+
+/**
+ * A peer for Container to be used with the Swing based AWT peers.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingContainerPeer
+  extends SwingComponentPeer
+  implements ContainerPeer
+{
+
+  /**
+   * Creates a new SwingContainerPeer.
+   *
+   * @param awtCont
+   */
+  public SwingContainerPeer(Component awtCont)
+  {
+    init(awtCont, null);
+  }
+
+  /**
+   * Returns the insets of the container.
+   *
+   * This is implemented to return the insets of the Swing container.
+   *
+   * @return the insets of the container
+   */
+  public Insets insets()
+  {
+    Insets retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getInsets();
+    else
+      retVal = new Insets(0, 0, 0, 0);
+    return retVal;
+  }
+
+  /**
+   * Returns the insets of the container.
+   *
+   * This is implemented to return the insets of the Swing container.
+   *
+   * @return the insets of the container
+   */
+  public Insets getInsets()
+  {
+    Insets retVal;
+    if (swingComponent != null)
+      retVal = swingComponent.getJComponent().getInsets();
+    else
+      retVal = new Insets(0, 0, 0, 0);
+    return retVal;
+  }
+
+  /**
+   * Called before the validation of this containers begins.
+   */
+  public void beginValidate()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Called after the validation of this containers ended.
+   */
+  public void endValidate()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Called before the layout of this containers begins.
+   */
+  public void beginLayout()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Called after the layout of this containers ended.
+   */
+  public void endLayout()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Returns <code>false</code> unconditionally. This method is not used at
+   * the moment.
+   *
+   * @return <code>false</code>
+   */
+  public boolean isPaintPending()
+  {
+    return false;
+  }
+
+  /**
+   * Returns <code>false</code> unconditionally. This method is not used at
+   * the moment.
+   *
+   * @return <code>false</code>
+   */
+  public boolean isRestackSupported()
+  {
+    return false;
+  }
+
+  /**
+   * This method is not used at the moment.
+   */
+  public void cancelPendingPaint(int x, int y, int width, int height)
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * This method is not used at the moment.
+   */
+  public void restack()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Triggers painting of a component. This calls peerPaint on all the child
+   * components of this container.
+   *
+   * @param g the graphics context to paint to
+   */
+  protected void peerPaint(Graphics g)
+  {
+    Container c = (Container) awtComponent;
+    Component[] children = c.getComponents();
+    for (int i = children.length - 1; i >= 0; --i)
+      {
+        Component child = children[i];
+        ComponentPeer peer = child.getPeer();
+        boolean translated = false;
+        boolean clipped = false;
+        Shape oldClip = g.getClip();
+        try
+        {
+          g.translate(child.getX(), child.getY());
+          translated = true;
+          g.setClip(0, 0, child.getWidth(), child.getHeight());
+          clipped = true;
+          if (peer instanceof SwingComponentPeer)
+            ((SwingComponentPeer) peer).peerPaint(g);
+        }
+        finally
+        {
+          if (translated)
+            g.translate(- child.getX(), - child.getY());
+          if (clipped)
+            g.setClip(oldClip);
+        }
+      }
+  }
+
+  /**
+   * Handles mouse events by dispatching it to the correct component.
+   *
+   * @param ev the mouse event
+   */
+  protected void handleMouseEvent(MouseEvent ev)
+  {
+    Component comp = awtComponent.getComponentAt(ev.getPoint());
+    if(comp == null)
+      comp = awtComponent;
+    if (comp != null)
+      {
+        ComponentPeer peer = comp.getPeer();
+        if (awtComponent != comp && !comp.isLightweight() && peer instanceof SwingComponentPeer)
+          {
+            ev.translatePoint(comp.getX(), comp.getY());
+            ev.setSource(comp);
+            ((SwingComponentPeer) peer).handleMouseEvent(ev);
+          }
+      }
+  }
+
+  /**
+   * Handles mouse events by dispatching it to the correct component.
+   *
+   * @param ev the mouse event
+   */
+  protected void handleMouseMotionEvent(MouseEvent ev)
+  {
+    Component comp = awtComponent.getComponentAt(ev.getPoint());
+    if (comp != null)
+      {
+        ComponentPeer peer = comp.getPeer();
+        if (awtComponent != comp && !comp.isLightweight() && peer instanceof SwingComponentPeer)
+          {
+            ev.translatePoint(comp.getX(), comp.getY());
+            ((SwingComponentPeer) peer).handleMouseMotionEvent(ev);
+          }
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingFramePeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingFramePeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingFramePeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingFramePeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,196 @@
+/* SwingFramePeer.java -- An abstract Swing based peer for AWT frames
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.peer.FramePeer;
+
+/**
+ * An abstract base class for FramePeer implementations based on Swing.
+ * This class provides the ability to display and handle AWT MenuBars that
+ * are based on Swing.
+ *
+ * As a minimum, a subclass must implement all the remaining abstract methods
+ * as well as the following methods:
+ * <ul>
+ * <li>{@link java.awt.peer.ComponentPeer#getLocationOnScreen()}</li>
+ * <li>{@link java.awt.peer.ComponentPeer#getGraphics()}</li>
+ * <li>{@link java.awt.peer.ComponentPeer#createImage(int, int)}</li>
+ * </ul>
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public abstract class SwingFramePeer
+  extends SwingWindowPeer
+  implements FramePeer
+{
+  /**
+   * The menu bar to display.
+   */
+  SwingMenuBarPeer menuBar = null;
+
+  /**
+   * Creates a new SwingFramePeer.
+   *
+   * @param frame the frame
+   */
+  public SwingFramePeer(Frame frame)
+  {
+    super(frame);
+  }
+
+  /**
+   * Sets the menu bar to display in this frame.
+   *
+   * @param mb the menu bar to set
+   */
+  public void setMenuBar(MenuBar mb)
+  {
+    menuBar = (SwingMenuBarPeer) mb.getPeer();
+    menuBar.setFramePeer(this);
+    menuBar.setWidth(awtComponent.getWidth());
+  }
+
+  /**
+   * Triggers 'heavyweight' painting of the frame. This will paint a menu bar
+   * if present as well as the child components of this frame.
+   *
+   * @param g the graphics context to use for painting
+   */
+  protected void peerPaint(Graphics g)
+  {
+    super.peerPaint(g);
+    if (menuBar != null)
+      menuBar.peerPaint(g);
+  }
+
+  /**
+   * Sets the size and location of this frame. This resizes the menubar to fit
+   * within the frame.
+   *
+   * @param x the X coordinate of the screen location
+   * @param y the Y coordinate of the screen location
+   * @param w the width of the frame
+   * @param h the height of the frame
+   */
+  public void setBounds(int x, int y, int w, int h)
+  {
+    super.setBounds(x, y, w, h);
+    if (menuBar != null)
+      menuBar.setWidth(w);
+  }
+
+  /**
+   * Calculates the insets of this frame peer. This fetches the insets
+   * from the superclass and adds the insets of the menubar if one is present.
+   *
+   * @return the insets of the frame
+   */
+  public Insets getInsets()
+  {
+    Insets insets = super.getInsets();
+    if (menuBar != null)
+      insets.top += menuBar.getHeight();
+    return insets;
+  }
+
+  /**
+   * Returns the location of the menu on the screen. This is needed internally
+   * by the {@link SwingMenuBarPeer} in order to determine its screen location.
+   *
+   * @return the location of the menu on the screen
+   */
+  public Point getMenuLocationOnScreen()
+  {
+    Insets i = super.getInsets();
+    return new Point(i.top, i.left);
+  }
+
+  /**
+   * Overridden to provide the ability to handle menus.
+   *
+   * @param ev the mouse event
+   */
+  protected void handleMouseEvent(MouseEvent ev)
+  {
+    Point p = ev.getPoint();
+    Insets i = super.getInsets();
+    if (menuBar != null)
+      {
+        int menuHeight = menuBar.getHeight();
+        if (p.y >= i.top && p.y <= i.top + menuHeight)
+          menuBar.handleMouseEvent(ev);
+        else
+          {
+            ev.translatePoint(0, -menuHeight);
+            super.handleMouseMotionEvent(ev);
+          }
+      }
+
+    super.handleMouseEvent(ev);
+  }
+
+  /**
+   * Overridden to provide the ability to handle menus.
+   *
+   * @param ev the mouse event
+   */
+  protected void handleMouseMotionEvent(MouseEvent ev)
+  {
+    Point p = ev.getPoint();
+    Insets i = super.getInsets();
+    if (menuBar != null)
+      {
+        int menuHeight = menuBar.getHeight();
+        if (p.y >= i.top && p.y <= i.top + menuHeight)
+          menuBar.handleMouseMotionEvent(ev);
+        else
+          {
+            ev.translatePoint(0, -menuHeight);
+            super.handleMouseMotionEvent(ev);
+          }
+      }
+
+    super.handleMouseMotionEvent(ev);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingLabelPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,196 @@
+/* SwingLabelPeer.java -- A Swing based peer for AWT labels
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Image;
+import java.awt.Label;
+import java.awt.Point;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.peer.LabelPeer;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+
+
+/**
+ * A Label peer based on {@link JLabel}.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingLabelPeer
+  extends SwingComponentPeer
+  implements LabelPeer
+{
+
+  /**
+   * A spezialized Swing label used to paint the label for the AWT Label. 
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private class SwingLabel
+    extends JLabel
+    implements SwingComponent
+  {
+
+    /**
+     * Returns this label.
+     *
+     * @return <code>this</code>
+     */
+    public JComponent getJComponent()
+    {
+      return this;
+    }
+
+    /**
+     * Handles mouse events by forwarding it to
+     * <code>processMouseEvent()</code>.
+     *
+     * @param ev the mouse event
+     */
+    public void handleMouseEvent(MouseEvent ev)
+    {
+      processMouseEvent(ev);
+    }
+
+    /**
+     * Handles mouse motion events by forwarding it to
+     * <code>processMouseMotionEvent()</code>.
+     *
+     * @param ev the mouse motion event
+     */
+    public void handleMouseMotionEvent(MouseEvent ev)
+    {
+      processMouseMotionEvent(ev);
+    }
+
+    /**
+     * Handles key events by forwarding it to <code>processKeyEvent()</code>.
+     *
+     * @param ev the mouse event
+     */
+    public void handleKeyEvent(KeyEvent ev)
+    {
+      processKeyEvent(ev);
+    }
+
+    /**
+     * Overridden so that this method returns the correct value even without a
+     * peer.
+     *
+     * @return the screen location of the button
+     */
+    public Point getLocationOnScreen()
+    {
+      return SwingLabelPeer.this.getLocationOnScreen();
+    }
+
+    /**
+     * Overridden so that the isShowing method returns the correct value for the
+     * swing button, even if it has no peer on its own.
+     *
+     * @return <code>true</code> if the button is currently showing,
+     *         <code>false</code> otherwise
+     */
+    public boolean isShowing()
+    {
+      boolean retVal = false;
+      if (SwingLabelPeer.this.awtComponent != null)
+        retVal = SwingLabelPeer.this.awtComponent.isShowing();
+      return retVal;
+    }
+
+    /**
+     * Overridden, so that the Swing button can create an Image without its
+     * own peer.
+     *
+     * @param w the width of the image
+     * @param h the height of the image
+     *
+     * @return an image
+     */
+    public Image createImage(int w, int h)
+    {
+      return SwingLabelPeer.this.createImage(w, h);
+    }
+    
+  }
+
+  /**
+   * Creates a new <code>SwingLabelPeer</code> for the specified AWT label.
+   *
+   * @param label the AWT label
+   */
+  public SwingLabelPeer(Label label)
+  {
+    super();
+    SwingLabel swingLabel = new SwingLabel();
+    swingLabel.setText(label.getText());
+    swingLabel.setHorizontalAlignment(label.getAlignment());
+    swingLabel.setOpaque(true);
+    init(label, swingLabel);
+  }
+
+  /**
+   * Sets the text of the label. This is implemented to set the text on the
+   * Swing label.
+   *
+   * @param text the text to be set
+   */
+  public void setText(String text)
+  {
+    ((JLabel) swingComponent.getJComponent()).setText(text);
+  }
+
+  /**
+   * Sets the horizontal alignment of the label. This is implemented to
+   * set the alignment on the Swing label.
+   *
+   * @param alignment the horizontal alignment
+   *
+   * @see Label#LEFT
+   * @see Label#RIGHT
+   * @see Label#CENTER
+   */
+  public void setAlignment(int alignment)
+  {
+    ((JLabel) swingComponent.getJComponent()).setHorizontalAlignment(alignment);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,295 @@
+/* SwingMenuBarPeer.java -- A Swing based peer for AWT menu bars
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Container;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.peer.MenuBarPeer;
+
+import javax.swing.JMenuBar;
+
+/**
+ * A Swing based peer for the AWT menu bar. This is a little bit different from
+ * the other peers, since the AWT MenuBar is not derived from the AWT
+ * component.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingMenuBarPeer
+  implements MenuBarPeer
+{
+
+  /**
+   * The AWT menu bar.
+   */
+  MenuBar awtMenuBar;
+
+  /**
+   * The Swing menu bar.
+   */
+  SwingMenuBar menuBar;
+
+  /**
+   * The peer of the frame that contains this menu bar.
+   */
+  SwingFramePeer framePeer;
+
+  /**
+   * A specialized JMenuBar that can be used as 'backend' for AWT MenuBars.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private class SwingMenuBar
+    extends JMenuBar
+  {
+    /**
+     * Overridden in order to provide a parent frame for this menu bar. The
+     * menu bar still is not inside the component hierarchy, we are faking
+     * here.
+     */
+    public Container getParent()
+    {
+      Container result = null;
+      if (framePeer != null)
+        result = (Container) framePeer.awtComponent;
+      return result;
+    }
+
+    /**
+     * Unconditionally returns <code>true</code>, since we assume that when the
+     * menubar has a peer, it must be showing.
+     *
+     * @return <code>true</code>
+     */
+    public boolean isShowing()
+    {
+      // FIXME: This might be wrong. Maybe find a better way to do that.
+      return true;
+    }
+
+    /**
+     * Handles mouse events by forwarding it to
+     * <code>processMouseEvent()</code>.
+     *
+     * @param ev the mouse event
+     */
+    public void handleMouseEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseEvent(ev);
+    }
+
+    /**
+     * Determines the menubar's screen location by asking the SwingFramePeer
+     * for it.
+     *
+     * @return the screen location of the menu bar
+     */
+    public Point getLocationOnScreen()
+    {
+      return framePeer.getMenuLocationOnScreen();
+    }
+  }
+
+  /**
+   * Creates a new <code>SwingMenuBarPeer</code> instance.
+   *
+   * @param awtMenuBar the AWT menu bar
+   */
+  public SwingMenuBarPeer(MenuBar awtMenuBar)
+  {
+    this.awtMenuBar = awtMenuBar;
+    menuBar = new SwingMenuBar();
+    menuBar.setDoubleBuffered(false);
+    // Add all the menus that are already in the MenuBar.
+    for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
+      {
+        Menu menu = awtMenuBar.getMenu(i);
+        menu.addNotify();
+        addMenu(awtMenuBar.getMenu(i));
+      }
+  }
+
+  /**
+   * Sets the <code>SwingFramePeer</code> of the frame that holds this menu.
+   *
+   * @param peer the <code>SwingFramePeer</code> to set
+   */
+  public void setFramePeer(SwingFramePeer peer)
+  {
+    framePeer = peer;
+  }
+
+  /**
+   * Adds a menu to the menu bar.
+   *
+   * @param m the menu to add
+   */
+  public void addMenu(Menu m)
+  {
+    SwingMenuPeer menuPeer = (SwingMenuPeer) m.getPeer();
+    menuBar.add(menuPeer.menu);
+  }
+
+  /**
+   * Adds a help menu to the menu bar.
+   *
+   * @param menu the menu to add
+   */
+  public void addHelpMenu(Menu menu)
+  {
+    // FIXME: We should manage the help menu differently, so that it always
+    // appears at the rightmost position.
+    SwingMenuPeer menuPeer = (SwingMenuPeer) menu.getPeer();
+    menuBar.add(menuPeer.menu);
+  }
+
+  /**
+   * Removes the menu with the specified index.
+   *
+   * @param index the index of the menu to remove
+   */
+  public void delMenu(int index)
+  {
+    menuBar.remove(index);
+  }
+
+  /**
+   * Disposes this peer. This releases any reference to the AWT and Swing
+   * components.
+   */
+  public void dispose()
+  {
+    menuBar = null;
+    awtMenuBar = null;
+  }
+
+  /**
+   * Sets a font for the menu bar.
+   *
+   * @param font the font to set
+   */
+  public void setFont(Font font)
+  {
+    menuBar.setFont(font);
+  }
+
+  /**
+   * Sets the width of the menu bar. This is called from the top level
+   * component peers to adjust the width of the menubar when their sizes
+   * change.
+   *
+   * @param w the width to set
+   */
+  public void setWidth(int w)
+  {
+    menuBar.setSize(w, menuBar.getPreferredSize().height);
+    menuBar.doLayout();
+  }
+
+  /**
+   * Paints the menu bar.
+   *
+   * @param g the graphics context to use for painting
+   */
+  public void peerPaint(Graphics g)
+  {
+    menuBar.paint(g);
+  }
+
+  /**
+   * Determines the height of the menubar.
+   *
+   * @return the height of the menu bar
+   */
+  public int getHeight()
+  {
+    return menuBar.getPreferredSize().height;
+  }
+
+  /**
+   * Handles mouse events.
+   *
+   * @param ev the mouse event
+   */
+  public void handleMouseEvent(MouseEvent ev)
+  {
+    Point point = ev.getPoint();
+    for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
+      {
+        Menu menu = awtMenuBar.getMenu(i);
+        SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
+        int x1 = peer.getX();
+        int x2 = x1 + peer.getWidth();
+        if (point.x >= x1 && point.x <= x2)
+          {
+            ev.translatePoint(peer.getX(), peer.getY());
+            peer.handleMouseEvent(ev);
+            break;
+          }
+      }
+  }
+
+  /**
+   * Handles mouse motion events.
+   *
+   * @param ev the mouse motion event
+   */
+  public void handleMouseMotionEvent(MouseEvent ev)
+  {
+    Point point = ev.getPoint();
+    for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
+      {
+        Menu menu = awtMenuBar.getMenu(i);
+        SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
+        int x1 = peer.getX();
+        int x2 = x1 + peer.getWidth();
+        if (point.x >= x1 && point.x <= x2)
+          {
+            ev.translatePoint(peer.getX(), peer.getY());
+            peer.handleMouseMotionEvent(ev);
+            break;
+          }
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuItemPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,157 @@
+/* SwingMenuItemPeer.java -- A Swing based peer for AWT menu items
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Font;
+import java.awt.MenuItem;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.peer.MenuItemPeer;
+
+import javax.swing.JMenuItem;
+
+/**
+ * A Swing based peer for the AWT MenuItem.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingMenuItemPeer
+  implements MenuItemPeer
+{
+  /**
+   * The AWT menu item.
+   */
+  MenuItem awtMenuItem;
+
+  /**
+   * The Swing menu item.
+   */
+  JMenuItem menuItem;
+
+  /**
+   * Receives ActionEvents from the Swing menu item and forwards them
+   * to the ActionListeners of the AWT MenuItem.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private class SwingMenuItemListener implements ActionListener
+  {
+
+    /**
+     * Receives notification when the action has been performed.
+     *
+     * @param event the action event
+     */
+    public void actionPerformed(ActionEvent event)
+    {
+      event.setSource(awtMenuItem);
+      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event);
+    }
+    
+  }
+
+  /**
+   * Creates a new instance of <code>SwingMenuItemPeer</code>.
+   *
+   * @param awtMenuItem the AWT menu item
+   */
+  public SwingMenuItemPeer(MenuItem awtMenuItem)
+  {
+    this.awtMenuItem = awtMenuItem;
+    menuItem = new JMenuItem(awtMenuItem.getLabel());
+    menuItem.addActionListener(new SwingMenuItemListener());
+  }
+
+  /**
+   * Disables the menu item.
+   */
+  public void disable()
+  {
+    menuItem.setEnabled(false);
+  }
+
+  /**
+   * Enables the menu item.
+   */
+  public void enable()
+  {
+    menuItem.setEnabled(true);
+  }
+
+  /**
+   * Sets the enabled state to <code>enabled</code>.
+   *
+   * @param enabled if the menu item should be enabled or not
+   */
+  public void setEnabled(boolean enabled)
+  {
+    menuItem.setEnabled(enabled);
+  }
+
+  /**
+   * Sets the label for the menu item.
+   *
+   * @param text the label to set
+   */
+  public void setLabel(String text)
+  {
+    menuItem.setText(text);
+  }
+
+  /**
+   * Disposes the menu item. This releases any reference to the Swing and AWT
+   * menu item.
+   */
+  public void dispose()
+  {
+    menuItem = null;
+    awtMenuItem = null;
+  }
+
+  /**
+   * Sets the font for this menu item.
+   *
+   * @param font the font to set
+   */
+  public void setFont(Font font)
+  {
+    menuItem.setFont(font);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,284 @@
+/* SwingMenuPeer.java -- A Swing based peer for AWT menus
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Font;
+import java.awt.Menu;
+import java.awt.MenuItem;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.peer.MenuPeer;
+
+import javax.swing.JMenu;
+
+/**
+ * A Swing based peer for the AWT menu.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingMenuPeer
+  implements MenuPeer
+{
+
+  /**
+   * The AWT menu.
+   */
+  Menu awtMenu;
+
+  /**
+   * The Swing menu.
+   */
+  SwingMenu menu;
+
+  /**
+   * A specialized JMenu that can be used as 'backend' for an AWT menu.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private class SwingMenu
+    extends JMenu
+  {
+
+    /**
+     * Unconditionally returns <code>true</code>, since we assume that when the
+     * menu has a peer, it must be showing.
+     *
+     * @return <code>true</code>
+     */
+    public boolean isShowing()
+    {
+      // FIXME: This might be wrong. Maybe find a better way to do that.
+      return true;
+    }
+
+    /**
+     * Overridden so that we can provide a location even without a real peer
+     * attached.
+     *
+     * @return the screen location of this menu
+     */
+    public Point getLocationOnScreen()
+    {
+      Point parentLoc = getParent().getLocationOnScreen();
+      parentLoc.x += getX();
+      parentLoc.y += getY();
+      return parentLoc;
+    }
+
+    /**
+     * Handles mouse events by forwarding them to
+     * <code>processMouseEvent()</code>.
+     *
+     * @param ev the mouse event
+     */
+    public void handleMouseEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseEvent(ev);
+    }
+
+    /**
+     * Handles mouse events by forwarding them to
+     * <code>processMouseMotionEvent()</code>.
+     *
+     * @param ev the mouse event
+     */
+    public void handleMouseMotionEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseMotionEvent(ev);
+    }
+  }
+
+  /**
+   * Creates a new <code>SwingMenuPeer</code> instance.
+   *
+   * @param awtMenu the AWT menu
+   */
+  public SwingMenuPeer(Menu awtMenu)
+  {
+    this.awtMenu = awtMenu;
+    menu = new SwingMenu();
+    menu.setDoubleBuffered(false);
+    menu.setText(awtMenu.getLabel());
+    for (int i = 0; i < awtMenu.getItemCount(); i++)
+      {
+        MenuItem item = awtMenu.getItem(i);
+        item.addNotify();
+        SwingMenuItemPeer peer = (SwingMenuItemPeer) item.getPeer(); 
+        menu.add(peer.menuItem);
+      }
+  }
+
+  /**
+   * Adds a menu item to this menu.
+   *
+   * @param item the menu item to add
+   */
+  public void addItem(MenuItem item)
+  {
+    SwingMenuItemPeer menuItemPeer = (SwingMenuItemPeer) item.getPeer();
+    menu.add(menuItemPeer.menuItem);
+  }
+
+  /**
+   * Adds a separator to the menu.
+   */
+  public void addSeparator()
+  {
+    menu.addSeparator();
+  }
+
+  /**
+   * Removes a menu item from the menu.
+   *
+   * @param index the index of the menu item to remove
+   */
+  public void delItem(int index)
+  {
+    menu.remove(index);
+  }
+
+  /**
+   * Disables the menu.
+   */
+  public void disable()
+  {
+    menu.setEnabled(false);
+  }
+
+  /**
+   * Enables the menu.
+   */
+  public void enable()
+  {
+    menu.setEnabled(true);
+  }
+
+  /**
+   * Sets the enabled state of the menu to <code>enabled</code>.
+   *
+   * @param enabled if the menu should be enabled or not
+   */
+  public void setEnabled(boolean enabled)
+  {
+    menu.setEnabled(enabled);
+  }
+
+  /**
+   * Sets the label of the menu.
+   *
+   * @param text the label to set
+   */
+  public void setLabel(String text)
+  {
+    menu.setText(text);
+  }
+
+  /**
+   * Releases any reference to the AWT and Swing menu instances.
+   */
+  public void dispose()
+  {
+    menu = null;
+    awtMenu = null;
+  }
+
+  /**
+   * Sets the font for the menu.
+   *
+   * @param font the font to set
+   */
+  public void setFont(Font font)
+  {
+    menu.setFont(font);
+  }
+
+  /**
+   * Handles mouse events by forwarding them to the Swing menu.
+   *
+   * @param ev the mouse event
+   */
+  public void handleMouseEvent(MouseEvent ev)
+  {
+    menu.handleMouseEvent(ev);
+  }
+
+  /**
+   * Handles mouse motion events by forwarding them to the Swing menu.
+   *
+   * @param ev the mouse event
+   */
+  public void handleMouseMotionEvent(MouseEvent ev)
+  {
+    menu.handleMouseMotionEvent(ev);
+  }
+
+  /**
+   * Returns the X coordinate of the upper left corner of the menu. This is
+   * used internally by the SwingMenuBarPeer.
+   *
+   * @return the X coordinate of the upper left corner of the menu
+   */
+  int getX()
+  {
+    return menu.getX();
+  }
+
+  /**
+   * Returns the width of the menu. This is used internally by the
+   * SwingMenuBarPeer.
+   *
+   * @return the X coordinate of the upper left corner of the menu
+   */
+  int getWidth()
+  {
+    return menu.getWidth();
+  }
+
+  /**
+   * Returns the Y coordinate of the upper left corner of the menu. This is
+   * used internally by the SwingMenuBarPeer.
+   *
+   * @return the X coordinate of the upper left corner of the menu
+   */
+  public int getY()
+  {
+    return menu.getY();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingPanelPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingPanelPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingPanelPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingPanelPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,67 @@
+/* SwingPanelPeer.java -- A PanelPeer based on Swing
+   Copyright (C) 2006 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 gnu.java.awt.peer.swing;
+
+import java.awt.Panel;
+import java.awt.peer.LightweightPeer;
+import java.awt.peer.PanelPeer;
+
+/**
+ * A panel peer based on Swing.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+// TODO: Maybe base implementation on JPanel. However, this doesn't seem
+// necessary, but might be good for more consistend Look.
+public class SwingPanelPeer
+  extends SwingContainerPeer
+  implements PanelPeer, LightweightPeer
+{
+
+  /**
+   * Creates a new instance of <code>SwingPanelPeer</code> for the specified
+   * AWT panel.
+   *
+   * @param panel the AWT panel
+   */
+  public SwingPanelPeer(Panel panel)
+  {
+    super(panel);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,367 @@
+/* SwingTextFieldPeer.java -- A Swing based peer for AWT textfields
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Dimension;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.TextField;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.im.InputMethodRequests;
+import java.awt.peer.TextFieldPeer;
+
+import javax.swing.JComponent;
+import javax.swing.JTextField;
+
+/**
+ * A TextFieldPeer based on Swing JTextField.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class SwingTextFieldPeer
+  extends SwingComponentPeer
+  implements TextFieldPeer
+{
+
+  /**
+   * A specialized Swing textfield for use in the peer.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private class SwingTextField
+    extends JTextField
+    implements SwingComponent
+  {
+
+    /**
+     * Overridden to provide normal behaviour even without a real peer
+     * attached.
+     *
+     * @return the location of the textfield on screen
+     */
+    public Point getLocationOnScreen()
+    {
+      return SwingTextFieldPeer.this.getLocationOnScreen();
+    }
+
+    /**
+     * Overridden so that the isShowing method returns the correct value for the
+     * swing button, even if it has no peer on its own.
+     *
+     * @return <code>true</code> if the button is currently showing,
+     *         <code>false</code> otherwise
+     */
+    public boolean isShowing()
+    {
+      boolean retVal = false;
+      if (SwingTextFieldPeer.this.awtComponent != null)
+        retVal = SwingTextFieldPeer.this.awtComponent.isShowing();
+      return retVal;
+    }
+
+    /**
+     * Overridden, so that the Swing button can create an Image without its
+     * own peer.
+     *
+     * @param w the width of the image
+     * @param h the height of the image
+     *
+     * @return an image
+     */
+    public Image createImage(int w, int h)
+    {
+      return SwingTextFieldPeer.this.createImage(w, h);
+    }
+
+    /**
+     * Returns this textfield.
+     *
+     * @return <code>this</code>
+     */
+    public JComponent getJComponent()
+    {
+      return this;
+    }
+
+    /**
+     * Handles mouse events by forwarding it to the swing textfield.
+     *
+     * @param ev the mouse event
+     */
+    public void handleMouseEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseEvent(ev);
+    }
+
+    /**
+     * Handles mouse motion events by forwarding it to the swing textfield.
+     *
+     * @param ev the mouse motion event
+     */
+    public void handleMouseMotionEvent(MouseEvent ev)
+    {
+      ev.setSource(this);
+      processMouseMotionEvent(ev);
+    }
+
+    /**
+     * Handles key events by forwarding it to the swing textfield.
+     *
+     * @param ev the key event
+     */
+    public void handleKeyEvent(KeyEvent ev)
+    {
+      ev.setSource(this);
+      processKeyEvent(ev);
+    }
+    
+  }
+
+  /**
+   * Creates a new <code>SwingTextFieldPeer</code> instance for the specified
+   * AWT textfield.
+   *
+   * @param textField the AWT textfield
+   */
+  public SwingTextFieldPeer(TextField textField)
+  {
+    SwingTextField swingTextField = new SwingTextField();
+    swingTextField.setText(textField.getText());
+    init(textField, swingTextField);
+  }
+
+  /**
+   * Returns the minimum size of the textfield.
+   *
+   * @param len not used here
+   *
+   * @return the minimum size of the textfield
+   */
+  public Dimension minimumSize(int len)
+  {
+    return swingComponent.getJComponent().getMinimumSize();
+  }
+
+  /**
+   * Returns the preferred size of the textfield.
+   *
+   * @param len not used here
+   *
+   * @return the preferred size of the textfield
+   */
+  public Dimension preferredSize(int len)
+  {
+    return swingComponent.getJComponent().getPreferredSize();
+  }
+
+  /**
+   * Returns the minimum size of the textfield.
+   *
+   * @param len not used here
+   *
+   * @return the minimum size of the textfield
+   */
+  public Dimension getMinimumSize(int len)
+  {
+    return swingComponent.getJComponent().getMinimumSize();
+  }
+
+  /**
+   * Returns the preferred size of the textfield.
+   *
+   * @param len not used here
+   *
+   * @return the preferred size of the textfield
+   */
+  public Dimension getPreferredSize(int len)
+  {
+    return swingComponent.getJComponent().getPreferredSize();
+  }
+
+  /**
+   * Sets the echo character.
+   *
+   * @param echoChar the echo character to be set
+   */
+  public void setEchoChar(char echoChar)
+  {
+    // TODO: Must be implemented.
+  }
+
+  /**
+   * Sets the echo character.
+   *
+   * @param echoChar the echo character to be set
+   */
+  public void setEchoCharacter(char echoChar)
+  {
+    // TODO: Must be implemented.
+  }
+
+  /**
+   * Returns the end index of the current selection.
+   *
+   * @return the end index of the current selection
+   */
+  public int getSelectionEnd()
+  {
+    // TODO: Must be implemented.
+    return 0;
+  }
+
+  /**
+   * Returns the start index of the current selection.
+   *
+   * @return the start index of the current selection
+   */
+  public int getSelectionStart()
+  {
+    // TODO: Must be implemented.
+    return 0;
+  }
+
+  /**
+   * Returns the current content of the textfield.
+   *
+   * @return the current content of the textfield
+   */
+  public String getText()
+  {
+    return ((JTextField) swingComponent.getJComponent()).getText();
+  }
+
+  /**
+   * Sets the content of the textfield.
+   *
+   * @param text the text to set
+   */
+  public void setText(String text)
+  {
+    ((JTextField) swingComponent.getJComponent()).setText(text);
+  }
+
+  /**
+   * Sets the current selection.
+   *
+   * @param startPos the start index of the selection
+   * @param endPos the start index of the selection
+   */
+  public void select(int startPos, int endPos)
+  {
+    // TODO: Must be implemented.
+  }
+
+  /**
+   * Sets the editable flag of the text field.
+   *
+   * @param editable <code>true</code> to make the textfield editable,
+   *        <code>false</code> to make it uneditable
+   */
+  public void setEditable(boolean editable)
+  {
+    ((JTextField) swingComponent.getJComponent()).setEditable(editable);
+  }
+
+  /**
+   * Returns the current caret position.
+   *
+   * @return the current caret position
+   */
+  public int getCaretPosition()
+  {
+    return ((JTextField) swingComponent.getJComponent()).getCaret().getDot();
+  }
+
+  /**
+   * Sets the current caret position.
+   *
+   * @param pos the caret position to set
+   */
+  public void setCaretPosition(int pos)
+  {
+    ((JTextField) swingComponent.getJComponent()).getCaret().setDot(pos);
+  }
+
+  /**
+   * Returns the index of the character at the specified location.
+   *
+   * @param x the X coordinate of the point to query
+   * @param y the Y coordinate of the point to query
+   *
+   * @return the index of the character at the specified location
+   */
+  public int getIndexAtPoint(int x, int y)
+  {
+    // TODO: Must be implemented.
+    return 0;
+  }
+
+  /**
+   * Returns the bounds of the character at the specified index.
+   *
+   * @param pos the index of the character
+   *
+   * @return the bounds of the character at the specified index
+   */
+  public Rectangle getCharacterBounds(int pos)
+  {
+    // TODO: Must be implemented.
+    return null;
+  }
+
+  /**
+   * Not used.
+   */
+  public long filterEvents(long filter)
+  {
+    // TODO: Must be implemented.
+    return 0;
+  }
+
+  /**
+   * Not used.
+   */
+  public InputMethodRequests getInputMethodRequests()
+  {
+    // TODO: Must be implemented.
+    return null;
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingToolkit.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingToolkit.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingToolkit.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingToolkit.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,165 @@
+/* SwingToolkit.java -- A base toolkit for Swing peers
+   Copyright (C) 2006 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 gnu.java.awt.peer.swing;
+
+import java.awt.Button;
+import java.awt.Canvas;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.TextField;
+import java.awt.peer.ButtonPeer;
+import java.awt.peer.CanvasPeer;
+import java.awt.peer.LabelPeer;
+import java.awt.peer.MenuBarPeer;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuPeer;
+import java.awt.peer.PanelPeer;
+import java.awt.peer.TextFieldPeer;
+
+import gnu.java.awt.ClasspathToolkit;
+
+/**
+ * A base implementation for {@link java.awt.Toolkit} that provides the
+ * Swing based widgets. Concrete implementations still must provide the
+ * remaining abstract methods.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public abstract class SwingToolkit extends ClasspathToolkit
+{
+
+  /**
+   * Creates a SwingButtonPeer.
+   *
+   * @param button the AWT button
+   *
+   * @return the Swing button peer
+   */
+  protected ButtonPeer createButton(Button button)
+  {
+    return new SwingButtonPeer(button);
+  }
+
+  /**
+   * Creates a SwingCanvasPeer.
+   *
+   * @param canvas the AWT canvas
+   *
+   * @return the Swing canvas peer
+   */
+  protected CanvasPeer createCanvas(Canvas canvas)
+  {
+    return new SwingCanvasPeer(canvas);
+  }
+
+  /**
+   * Creates a SwingLabelPeer.
+   *
+   * @param label the AWT label
+   *
+   * @return the Swing label peer
+   */
+  protected LabelPeer createLabel(Label label)
+  {
+    return new SwingLabelPeer(label);
+  }
+
+  /**
+   * Creates a SwingMenuPeer.
+   *
+   * @param menu the AWT menu
+   *
+   * @return the Swing menu peer
+   */
+  protected MenuPeer createMenu(Menu menu)
+  {
+    return new SwingMenuPeer(menu);
+  }
+
+  /**
+   * Creates a SwingMenuBarPeer.
+   *
+   * @param menuBar the AWT menubar
+   *
+   * @return the Swing menu bar peer
+   */
+  protected MenuBarPeer createMenuBar(MenuBar menuBar)
+  {
+    return new SwingMenuBarPeer(menuBar);
+  }
+
+  /**
+   * Creates a SwingMenuItemPeer.
+   *
+   * @param menuItem the AWT menu item
+   *
+   * @return the Swing menu item peer
+   */
+  protected MenuItemPeer createMenuItem(MenuItem menuItem)
+  {
+    return new SwingMenuItemPeer(menuItem);
+  }
+
+  /**
+   * Creates a SwingPanelPeer.
+   *
+   * @param panel the AWT panel
+   *
+   * @return the Swing panel peer
+   */
+  protected PanelPeer createPanel(Panel panel)
+  {
+    return new SwingPanelPeer(panel);
+  }
+
+  /**
+   * Creates a SwingTextFieldPeer.
+   *
+   * @param textField the AWT text field
+   *
+   * @return the Swing text field peer
+   */
+  protected TextFieldPeer createTextField(TextField textField)
+  {
+    return new SwingTextFieldPeer(textField);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/SwingWindowPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,72 @@
+/* SwingWindowPeer.java -- An abstract base for Swing based window peers
+   Copyright (C)  2006  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 gnu.java.awt.peer.swing;
+
+import java.awt.Window;
+import java.awt.peer.WindowPeer;
+
+/**
+ * An abstract base class for Swing based WindowPeer implementation. Concrete
+ * implementations of WindowPeers should subclass this class in order to get
+ * the correct behaviour.
+ *
+ * As a minimum, a subclass must implement all the remaining abstract methods
+ * as well as the following methods:
+ * <ul>
+ * <li>{@link java.awt.peer.ComponentPeer#getLocationOnScreen()}</li>
+ * <li>{@link java.awt.peer.ComponentPeer#getGraphics()}</li>
+ * <li>{@link java.awt.peer.ComponentPeer#createImage(int, int)}</li>
+ * </ul>
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public abstract class SwingWindowPeer
+  extends SwingContainerPeer
+  implements WindowPeer
+{
+
+  /**
+   * Creates a new instance of WindowPeer.
+   *
+   * @param window the AWT window
+   */
+  public SwingWindowPeer(Window window)
+  {
+    super(window);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/swing/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.awt.peer.swing package.
+   Copyright (C) 2006 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. -->
+
+<html>
+  <head>
+    <title>Swing based AWT peers</title>
+  </head>
+  <body>
+  <h1>Swing based AWT peers.</h1>
+  <p>This package defines an abstract set of AWT peers that is based on Swing
+    widgets. This can be used as an implementation base for peer implementors
+    who don't have access to native widgets or who want to build a quick
+    prototype of a peer set without implementing all of the AWT widgets.
+  </p>
+  <p>An actual implementation would have to provide the following:
+  <ul>
+  <li>A concrete implementation of {@link java.awt.Toolkit}, possibly based
+    on {@link SwingToolkit}. This implementation must provide all the missing
+    methods of the <code>SwingToolkit</code>.</li>
+  <li>Concrete implementations of {@link java.awt.peer.DialogPeer},
+    {@link java.awt.peer.FramePeer} and {@link java.awt.peer.WindowPeer},
+    ideally based on their <code>SwingXXXPeer</code> counterparts.
+    Some methods must be specially
+    overridden in those peers to provide useful functionality, like
+    <code>getLocationOnScreen()</code>. See the API documentation for more
+    details</li>
+  <li>An implementation of {@link java.awt.Image}. These must be provided by
+    the toplevel component peers.</li>
+  <li>An implementation of {@link java.awt.Graphics}. This must also be
+    provided by the toplevel peers.</li>
+  <li>An implementation of {@link java.awt.Font}. This must be
+    provided by the toolkit.</li>
+  </ul>
+  </p>
+  </body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/GLGraphics.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,123 @@
+/* GLGraphics.java -- Graphics2D impl on top of GLX
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Color;
+import java.awt.GraphicsConfiguration;
+import java.awt.image.ColorModel;
+
+import gnu.java.awt.java2d.AbstractGraphics2D;
+import gnu.x11.extension.glx.GL;
+
+/**
+ * An implementation of Graphics2D on top of the GLX extension of X.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class GLGraphics extends AbstractGraphics2D
+{
+
+  /**
+   * The rendering context.
+   */
+  private GL gl;
+
+  /**
+   * Creates a new GLGraphics that paints on the specified GL context.
+   *
+   * @param g the GL context to paint to
+   */
+  GLGraphics(GL g)
+  {
+    gl = g;
+  }
+
+  public void setBackground(Color b)
+  {
+    super.setBackground(b);
+    gl.clear_color(b.getRed() / 255.F, b.getGreen() / 255.F,
+                   b.getBlue() / 255.F, b.getAlpha() / 255.F);
+  }
+
+  public void clearRect(int x, int y, int w, int h)
+  {
+    // TODO: Maybe use fillRect().
+    gl.clear(GL.COLOR_BUFFER_BIT);
+  }
+
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    gl.begin(GL.LINES);
+    gl.vertex2i(x1, y1);
+    gl.vertex2i(x2, y2);
+    gl.end();
+    // TODO: Maybe do:
+    // gl.flush();
+  }
+
+  public void drawRect(int x, int y, int w, int h)
+  {
+    gl.polygon_mode(GL.FRONT_AND_BACK, GL.LINE);
+    gl.begin(GL.POLYGON);
+    gl.recti(x, y, x + w, y + h);
+    gl.end();
+    // TODO: Maybe do:
+    // gl.flush();
+  }
+
+  public void fillRect(int x, int y, int w, int h)
+  {
+    gl.polygon_mode(GL.FRONT_AND_BACK, GL.FILL);
+    gl.recti(x, y, x + w, y + h);
+    // TODO: Maybe do:
+    // gl.flush();
+  }
+
+  protected ColorModel getColorModel()
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public GraphicsConfiguration getDeviceConfiguration()
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,113 @@
+/* ImageConverter.java -- Convert arbitrary Image impl to XImage
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageConsumer;
+import java.util.Hashtable;
+
+/**
+ * Convert a non-XImage to an XImage.
+ * 
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class ImageConverter implements ImageConsumer
+{
+
+  private XImage image;
+  private Graphics imageGraphics;
+
+  public void setDimensions(int width, int height)
+  {
+    image = new XImage(width, height);
+  }
+
+  public void setProperties(Hashtable props)
+  {
+    // Ignore for now.
+  }
+
+  public void setColorModel(ColorModel model)
+  {
+    // Ignore for now.
+  }
+
+  public void setHints(int flags)
+  {
+    // Ignore for now.
+  }
+
+  public void setPixels(int x, int y, int w, int h, ColorModel model,
+                        byte[] pixels, int offset, int scansize)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public void setPixels(int x, int y, int w, int h, ColorModel model,
+                        int[] pixels, int offset, int scansize)
+  {
+    System.err.println("transferType: " + model.getTransferType());
+    System.err.println("colorModel: " + model);
+    if (imageGraphics == null)
+      imageGraphics = image.getGraphics();
+    int xend = x + w;
+    int yend = y + h;
+    for (int yy = y; yy < yend; yy++)
+      {
+        for (int xx = x; xx < xend; xx++)
+          {
+            int pixel = pixels[yy * scansize + xx + offset];
+            imageGraphics.setColor(new Color(model.getRGB(pixel)));
+            imageGraphics.fillRect(xx, yy, 1, 1);
+          }
+      }
+  }
+
+  public void imageComplete(int status)
+  {
+    // Nothing to do here.
+  }
+
+  XImage getXImage()
+  {
+    return image;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/KeyboardMapping.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,415 @@
+/* KeyboardMapping.java -- Maps X keysyms to Java keyCode and keyChar
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import gnu.x11.Input;
+import gnu.x11.keysym.Latin1;
+import gnu.x11.keysym.Misc;
+
+import java.awt.event.KeyEvent;
+
+/**
+ * Defines the keyboard mapping from X keysyms to Java
+ * keycodes and keychars.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+final class KeyboardMapping
+{
+
+  /**
+   * Maps X keycodes to AWT keycodes.
+   * 
+   * @param xInput the X input event
+   * @param xKeyCode the X keycode to map
+   * @param xMods the X modifiers
+   *
+   * @return the AWT keycode and keychar
+   */
+  static int mapToKeyCode(gnu.x11.Input xInput, int xKeyCode, int xMods)
+  {
+    int mapped = KeyEvent.VK_UNDEFINED;
+    int keysym = xInput.keycode_to_keysym(xKeyCode, xMods, true);
+
+    // Special keys.
+    if (keysym >= 255 << 8)
+      {
+        // FIXME: Add missing mappings.
+        switch (keysym)
+        {
+          case Misc.BACKSPACE:
+            mapped = KeyEvent.VK_BACK_SPACE;
+            break;
+          case Misc.TAB:
+            mapped = KeyEvent.VK_TAB;
+            break;
+          case Misc.CLEAR:
+            mapped = KeyEvent.VK_CLEAR;
+            break;
+          case Misc.RETURN:
+            mapped = KeyEvent.VK_ENTER;
+            break;
+          case Misc.PAUSE:
+            mapped = KeyEvent.VK_PAUSE;
+            break;
+          case Misc.SCROLL_LOCK:
+            mapped = KeyEvent.VK_SCROLL_LOCK;
+            break;
+          case Misc.ESCAPE:
+            mapped = KeyEvent.VK_ESCAPE;
+            break;
+          case Misc.HOME:
+            mapped = KeyEvent.VK_HOME;
+            break;
+          case Misc.LEFT:
+            mapped = KeyEvent.VK_LEFT;
+            break;
+          case Misc.UP:
+            mapped = KeyEvent.VK_UP;
+            break;
+          case Misc.RIGHT:
+            mapped = KeyEvent.VK_RIGHT;
+            break;
+          case Misc.DOWN:
+            mapped = KeyEvent.VK_DOWN;
+            break;
+          case Misc.PAGE_UP:
+            mapped = KeyEvent.VK_PAGE_UP;
+            break;
+          case Misc.PAGE_DOWN:
+            mapped = KeyEvent.VK_PAGE_DOWN;
+            break;
+          case Misc.END:
+            mapped = KeyEvent.VK_END;
+            break;
+          case Misc.BEGIN:
+            mapped = KeyEvent.VK_BEGIN;
+            break;
+          case Misc.INSERT:
+            mapped = KeyEvent.VK_INSERT;
+            break;
+          case Misc.UNDO:
+            mapped = KeyEvent.VK_UNDO;
+            break;
+          case Misc.FIND:
+            mapped = KeyEvent.VK_FIND;
+            break;
+          case Misc.CANCEL:
+            mapped = KeyEvent.VK_CANCEL;
+            break;
+          case Misc.HELP:
+            mapped = KeyEvent.VK_HELP;
+            break;
+          case Misc.MODE_SWITCH:
+            mapped = KeyEvent.VK_MODECHANGE;
+            break;
+          case Misc.NUM_LOCK:
+            mapped = KeyEvent.VK_NUM_LOCK;
+            break;
+          case Misc.KP_LEFT:
+            mapped = KeyEvent.VK_KP_LEFT;
+            break;
+          case Misc.KP_UP:
+            mapped = KeyEvent.VK_KP_UP;
+            break;
+          case Misc.KP_RIGHT:
+            mapped = KeyEvent.VK_KP_RIGHT;
+            break;
+          case Misc.KP_DOWN:
+            mapped = KeyEvent.VK_KP_DOWN;
+            break;
+          case Misc.F1:
+            mapped = KeyEvent.VK_F1;
+            break;
+          case Misc.F2:
+            mapped = KeyEvent.VK_F2;
+            break;
+          case Misc.F3:
+            mapped = KeyEvent.VK_F3;
+            break;
+          case Misc.F4:
+            mapped = KeyEvent.VK_F4;
+            break;
+          case Misc.F5:
+            mapped = KeyEvent.VK_F5;
+            break;
+          case Misc.F6:
+            mapped = KeyEvent.VK_F6;
+            break;
+          case Misc.F7:
+            mapped = KeyEvent.VK_F7;
+            break;
+          case Misc.F8:
+            mapped = KeyEvent.VK_F8;
+            break;
+          case Misc.F9:
+            mapped = KeyEvent.VK_F9;
+            break;
+          case Misc.F10:
+            mapped = KeyEvent.VK_F10;
+            break;
+          case Misc.F11:
+            mapped = KeyEvent.VK_F11;
+            break;
+          case Misc.F12:
+            mapped = KeyEvent.VK_F12;
+            break;
+          case Misc.F13:
+            mapped = KeyEvent.VK_F13;
+            break;
+          case Misc.F14:
+            mapped = KeyEvent.VK_F14;
+            break;
+          case Misc.F15:
+            mapped = KeyEvent.VK_F15;
+            break;
+          case Misc.F16:
+            mapped = KeyEvent.VK_F16;
+            break;
+          case Misc.F17:
+            mapped = KeyEvent.VK_F17;
+            break;
+          case Misc.F18:
+            mapped = KeyEvent.VK_F18;
+            break;
+          case Misc.F19:
+            mapped = KeyEvent.VK_F19;
+            break;
+          case Misc.F20:
+            mapped = KeyEvent.VK_F20;
+            break;
+          case Misc.F21:
+            mapped = KeyEvent.VK_F21;
+            break;
+          case Misc.F22:
+            mapped = KeyEvent.VK_F22;
+            break;
+          case Misc.F23:
+            mapped = KeyEvent.VK_F23;
+            break;
+          case Misc.F24:
+            mapped = KeyEvent.VK_F24;
+            break;
+          case Misc.SHIFT_L:
+          case Misc.SHIFT_R:
+            mapped = KeyEvent.VK_SHIFT;
+            break;
+          case Misc.CONTROL_L:
+          case Misc.CONTROL_R:
+            mapped = KeyEvent.VK_CONTROL;
+            break;
+          case Misc.CAPS_LOCK:
+          case Misc.SHIFT_LOCK:
+            mapped = KeyEvent.VK_CAPS_LOCK;
+            break;
+          case Misc.META_L:
+          case Misc.META_R:
+            mapped = KeyEvent.VK_META;
+            break;
+          case Misc.ALT_L:
+          case Misc.ALT_R:
+            mapped = KeyEvent.VK_ALT;
+            break;
+          case Misc.DELETE:
+            mapped = KeyEvent.VK_DELETE;
+            break;
+          default:
+            mapped = KeyEvent.VK_UNDEFINED;
+        }
+      }
+    // Map Latin1 characters.
+    else if (keysym < 256)
+      {
+        // TODO: Add missing mappings, if any.
+        // Lowercase characters are mapped to
+        // their corresponding upper case pendants.
+        if (keysym >= Latin1.A_SMALL && keysym <= Latin1.Z_SMALL)
+          mapped = keysym - 0x20;
+        // Uppercase characters are mapped 1:1.
+        else if (keysym >= Latin1.A && keysym <= Latin1.Z)
+          mapped = keysym;
+        // Digits are mapped 1:1.
+        else if (keysym >= Latin1.NUM_0 && keysym <= Latin1.NUM_9)
+          mapped = keysym;
+        else
+          {
+            switch (keysym)
+            {
+              case Latin1.SPACE:
+                mapped = KeyEvent.VK_SPACE;
+                break;
+              case Latin1.EXCLAM:
+                mapped = KeyEvent.VK_EXCLAMATION_MARK;
+                break;
+              case Latin1.QUOTE_DBL:
+                mapped = KeyEvent.VK_QUOTEDBL;
+                break;
+              case Latin1.NUMBER_SIGN:
+                mapped = KeyEvent.VK_NUMBER_SIGN;
+                break;
+              case Latin1.DOLLAR:
+                mapped = KeyEvent.VK_DOLLAR;
+                break;
+              case Latin1.AMPERSAND:
+                mapped = KeyEvent.VK_AMPERSAND;
+                break;
+              case Latin1.APOSTROPHE:
+                mapped = KeyEvent.VK_QUOTE;
+                break;
+              case Latin1.PAREN_LEFT:
+                mapped = KeyEvent.VK_LEFT_PARENTHESIS;
+                break;
+              case Latin1.PAREN_RIGHT:
+                mapped = KeyEvent.VK_RIGHT_PARENTHESIS;
+                break;
+              case Latin1.ASTERISK:
+                mapped = KeyEvent.VK_ASTERISK;
+                break;
+              case Latin1.PLUS:
+                mapped = KeyEvent.VK_PLUS;
+                break;
+              case Latin1.COMMA:
+                mapped = KeyEvent.VK_COMMA;
+                break;
+              case Latin1.MINUS:
+                mapped = KeyEvent.VK_MINUS;
+                break;
+              case Latin1.PERIOD:
+                mapped = KeyEvent.VK_PERIOD;
+                break;
+              case Latin1.SLASH:
+                mapped = KeyEvent.VK_SLASH;
+                break;
+              case Latin1.COLON:
+                mapped = KeyEvent.VK_COLON;
+                break;
+              case Latin1.SEMICOLON:
+                mapped = KeyEvent.VK_SEMICOLON;
+                break;
+              case Latin1.LESS:
+                mapped = KeyEvent.VK_LESS;
+                break;
+              case Latin1.EQUAL:
+                mapped = KeyEvent.VK_EQUALS;
+                break;
+              case Latin1.GREATER:
+                mapped = KeyEvent.VK_GREATER;
+                break;
+              case Latin1.AT:
+                mapped = KeyEvent.VK_AT;
+                break;
+              case Latin1.BRACKET_LEFT:
+                mapped = KeyEvent.VK_OPEN_BRACKET;
+                break;
+              case Latin1.BACKSLASH:
+                mapped = KeyEvent.VK_BACK_SLASH;
+                break;
+              case Latin1.BRACKET_RIGHT:
+                mapped = KeyEvent.VK_CLOSE_BRACKET;
+                break;
+              case Latin1.ASCII_CIRCUM:
+                mapped = KeyEvent.VK_CIRCUMFLEX;
+                break;
+              case Latin1.UNDERSCORE:
+                mapped = KeyEvent.VK_UNDERSCORE;
+                break;
+              case Latin1.GRAVE:
+                mapped = KeyEvent.VK_DEAD_GRAVE;
+                break;
+              case Latin1.BRACE_LEFT:
+                mapped = KeyEvent.VK_BRACELEFT;
+                break;
+              case Latin1.BRACE_RIGHT:
+                mapped = KeyEvent.VK_BRACERIGHT;
+                break;
+              case Latin1.ASCII_TILDE:
+                mapped = KeyEvent.VK_DEAD_TILDE;
+                break;
+              case Latin1.EXCLAM_DOWN:
+                mapped = KeyEvent.VK_INVERTED_EXCLAMATION_MARK;
+                break;
+              default:
+                mapped = KeyEvent.VK_UNDEFINED;
+            }
+          }
+      }
+    return mapped;
+  }
+
+  /**
+   * Maps X keycodes+modifiers to Java keychars.
+   *
+   * @param xInput The X Input to use for mapping
+   * @param xKeyCode the X keycode
+   * @param xMods the X key modifiers
+   *
+   * @return the Java keychar
+   */
+  static char mapToKeyChar(gnu.x11.Input xInput, int xKeyCode, int xMods)
+  {
+    char mapped = KeyEvent.CHAR_UNDEFINED;
+    char keysym = (char) xInput.keycode_to_keysym(xKeyCode, xMods, false);
+    // FIXME: Map other encodings properly.
+    if (keysym < 256) // Latin1.
+      {
+        mapped = keysym;
+      }
+    return mapped;
+  }
+
+  /**
+   * Maps X modifier masks to AWT modifier masks.
+   *
+   * @param xMods the X modifiers
+   *
+   * @return the AWT modifiers
+   */
+  static int mapModifiers(int xMods)
+  {
+    int mods = 0;
+
+    if ((xMods & Input.SHIFT_MASK) != 0)
+      mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
+    if ((xMods & Input.ALT_MASK) != 0)
+      mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
+    if ((xMods & Input.CONTROL_MASK) != 0)
+      mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
+
+    return mods;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XDialogPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XDialogPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XDialogPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XDialogPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* XDialogPeer.java -- The peer for AWT dialogs
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Dialog;
+import java.awt.peer.DialogPeer;
+
+public class XDialogPeer
+  extends XWindowPeer
+  implements DialogPeer
+{
+
+  XDialogPeer(Dialog target)
+  {
+    super(target);
+  }
+
+  public void setResizable(boolean resizeable)
+  {
+  }
+
+  public void setTitle(String title)
+  {
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,287 @@
+/* XEventPump.java -- Pumps events from X to AWT
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.event.ComponentEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.PaintEvent;
+import java.util.HashMap;
+
+import gnu.x11.Display;
+import gnu.x11.event.ButtonPress;
+import gnu.x11.event.ButtonRelease;
+import gnu.x11.event.ConfigureNotify;
+import gnu.x11.event.Event;
+import gnu.x11.event.Expose;
+import gnu.x11.event.Input;
+import gnu.x11.event.KeyPress;
+import gnu.x11.event.KeyRelease;
+import gnu.x11.event.MotionNotify;
+
+/**
+ * Fetches events from X, translates them to AWT events and pumps them up
+ * into the AWT event queue.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class XEventPump
+  implements Runnable
+{
+
+  /**
+   * The X Display from which we fetch and pump up events.
+   */
+  private Display display;
+
+  /**
+   * Maps X Windows to AWT Windows to be able to correctly determine the
+   * event targets.
+   */
+  private HashMap windows;
+
+  /**
+   * Indicates if we are currently inside a drag operation. This is
+   * set to the button ID when a button is pressed and to -1 (indicating
+   * that no drag is active) when the mouse is released.
+   */
+  private int drag;
+
+  /**
+   * Creates a new XEventPump for the specified X Display.
+   *
+   * @param d the X Display
+   */
+  XEventPump(Display d)
+  {
+    display = d;
+    windows = new HashMap();
+    drag = -1;
+    Thread t = new Thread(this);
+    t.start();
+  }
+
+  /**
+   * The main event pump loop. This basically fetches events from the
+   * X Display and pumps them into the system event queue.
+   */
+  public void run()
+  {
+    while (display.connected)
+      {
+        try
+          {
+            Event xEvent = display.next_event();
+            handleEvent(xEvent);
+          }
+        catch (ThreadDeath death)
+          {
+            // If someone wants to kill us, let them.
+            return;
+          }
+        catch (Throwable x)
+          {
+            System.err.println("Exception during event dispatch:");
+            x.printStackTrace(System.err);
+          }
+      }
+  }
+
+  /**
+   * Adds an X Window to AWT Window mapping. This is required so that the
+   * event pump can correctly determine the event targets.
+   *
+   * @param xWindow the X Window
+   * @param awtWindow the AWT Window
+   */
+  void registerWindow(gnu.x11.Window xWindow, Window awtWindow)
+  {
+    if (XToolkit.DEBUG)
+      System.err.println("registering window id: " + xWindow.id);
+    windows.put(new Integer(xWindow.id), awtWindow);
+  }
+
+  void unregisterWindow(gnu.x11.Window xWindow)
+  {
+    windows.remove(new Integer(xWindow.id));
+  }
+
+  private void handleEvent(Event xEvent)
+  {
+    Integer key = new Integer(xEvent.window_id());;
+    Window awtWindow = (Window) windows.get(key);
+
+    if (XToolkit.DEBUG)
+      System.err.println("fetched event: " + xEvent);
+    switch (xEvent.code())
+    {
+    case ButtonPress.CODE:
+      ButtonPress bp = (ButtonPress) xEvent;
+      // 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(),
+                                     1, false, button);
+      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
+      break;
+    case ButtonRelease.CODE:
+      ButtonRelease br = (ButtonRelease) xEvent;
+      drag = -1;
+      MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
+                                     System.currentTimeMillis(), 0,
+                                     br.event_x(), br.event_y(),
+                                     1, false, br.detail());
+      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
+      break;
+    case MotionNotify.CODE:
+      MotionNotify mn = (MotionNotify) xEvent;
+      MouseEvent mm;
+      if (drag == -1)
+        {
+          mm = new MouseEvent(awtWindow, MouseEvent.MOUSE_MOVED,
+                              System.currentTimeMillis(), 0,
+                              mn.event_x(), mn.event_y(),
+                              1, false);
+        }
+      else
+        {
+          mm = new MouseEvent(awtWindow, MouseEvent.MOUSE_DRAGGED,
+                              System.currentTimeMillis(), 0,
+                              mn.event_x(), mn.event_y(),
+                              1, false);
+        }
+      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm);
+      break;
+    case ConfigureNotify.CODE:
+      ConfigureNotify c = (ConfigureNotify) xEvent;
+      if (XToolkit.DEBUG)
+        System.err.println("resize request for window id: " + key);
+
+      // Detect and report size changes.
+      if (c.width() != awtWindow.getWidth()
+          || c.height() != awtWindow.getHeight())
+        {
+          if (XToolkit.DEBUG)
+            System.err.println("Setting size on AWT window: " + c.width()
+                             + ", " + c.height() + ", " + awtWindow.getWidth()
+                             + ", " + awtWindow.getHeight());
+          ((XWindowPeer) awtWindow.getPeer()).callback = true;
+          awtWindow.setSize(c.width(), c.height());
+          ((XWindowPeer) awtWindow.getPeer()).callback = false;
+        }
+      break;
+    case Expose.CODE:
+      Expose exp = (Expose) xEvent;
+      if (XToolkit.DEBUG)
+        System.err.println("expose request for window id: " + key);
+      Rectangle r = new Rectangle(exp.x(), exp.y(), exp.width(),
+                                  exp.height());
+      //System.err.println("expose paint: " + r);
+      // We need to clear the background of the exposed rectangle.
+      Graphics g = awtWindow.getGraphics();
+      g.clearRect(r.x, r.y, r.width, r.height);
+      g.dispose();
+      PaintEvent pev = new PaintEvent(awtWindow, PaintEvent.PAINT, r);
+      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(pev);
+      break;
+    case KeyPress.CODE:
+    case KeyRelease.CODE:
+      handleKeyEvent(xEvent, awtWindow);
+      break;
+    default:
+      if (XToolkit.DEBUG)
+        System.err.println("Unhandled X event: " + xEvent);
+    }
+  }
+
+  /**
+   * Handles key events from X.
+   *
+   * @param xEvent the X event
+   * @param awtWindow the AWT window to which the event gets posted
+   */
+  private void handleKeyEvent(Event xEvent, Window awtWindow)
+  {
+    Input keyEvent = (Input) xEvent;
+    int xKeyCode = keyEvent.detail();
+    int xMods = keyEvent.state();
+    int keyCode = KeyboardMapping.mapToKeyCode(xEvent.display.input, xKeyCode,
+                                               xMods);
+    char keyChar = KeyboardMapping.mapToKeyChar(xEvent.display.input, xKeyCode,
+                                                xMods);
+    if (XToolkit.DEBUG)
+      System.err.println("XEventPump.handleKeyEvent: " + xKeyCode + ", "
+                         + xMods + ": " + ((int) keyChar) + ", " + keyCode);
+    int awtMods = KeyboardMapping.mapModifiers(xMods);
+    long when = System.currentTimeMillis();
+    KeyEvent ke;
+    if (keyEvent.code() == KeyPress.CODE)
+      {
+        ke = new KeyEvent(awtWindow, KeyEvent.KEY_PRESSED, when,
+                          awtMods, keyCode,
+                          KeyEvent.CHAR_UNDEFINED);
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke);
+        if (keyChar != KeyEvent.CHAR_UNDEFINED)
+          {
+            ke = new KeyEvent(awtWindow, KeyEvent.KEY_TYPED, when,
+                              awtMods, KeyEvent.VK_UNDEFINED,
+                              keyChar);
+            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke);
+          }
+          
+      }
+    else
+      {
+        ke = new KeyEvent(awtWindow, KeyEvent.KEY_RELEASED, when,
+                          awtMods, keyCode,
+                          KeyEvent.CHAR_UNDEFINED);
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke);
+      }
+
+  }
+
+
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,766 @@
+/* XFontPeer.java -- The font peer for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.AWTError;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.LineMetrics;
+import java.awt.font.TextAttribute;
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.CharacterIterator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+
+import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.x11.Display;
+import gnu.x11.Fontable;
+
+/**
+ * The bridge from AWT to X fonts.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class XFontPeer
+  extends ClasspathFontPeer
+{
+
+  /**
+   * The font mapping as specified in the file fonts.properties.
+   */
+  private static Properties fontProperties;
+  static
+  {
+    fontProperties = new Properties();
+    InputStream in = XFontPeer.class.getResourceAsStream("fonts.properties");
+    try
+      {
+        fontProperties.load(in);
+      }
+    catch (IOException e)
+      {
+        e.printStackTrace();
+      }
+  }
+
+  /**
+   * The FontMetrics implementation for XFontPeer.
+   */
+  private class XFontMetrics
+    extends FontMetrics
+  {
+    /**
+     * The ascent of the font.
+     */ 
+    int ascent;
+
+    /**
+     * The descent of the font.
+     */ 
+    int descent;
+
+    /**
+     * The maximum of the character advances.
+     */
+    private int maxAdvance;
+
+    /**
+     * The internal leading.
+     */
+    int leading;
+
+    /**
+     * Cached string metrics. This caches string metrics locally so that the
+     * server doesn't have to be asked each time.
+     */
+    private HashMap metricsCache;
+
+    /**
+     * The widths of the characters indexed by the characters themselves.
+     */
+    private int[] charWidths;
+
+    /**
+     * Creates a new XFontMetrics for the specified font.
+     *
+     * @param font the font
+     */
+    protected XFontMetrics(Font font)
+    {
+      super(font);
+      metricsCache = new HashMap();
+      Fontable.FontReply info = getXFont().info();
+      ascent = info.font_ascent();
+      descent = info.font_descent();
+      maxAdvance = info.max_bounds().character_width();
+      leading = 0; // TODO: Not provided by X. Possible not needed.
+
+      if (info.min_byte1() == 0 && info.max_byte1() == 0)
+        readCharWidthsLinear(info);
+      else
+        readCharWidthsNonLinear(info);
+    }
+
+    /**
+     * Reads the character widths when specified in a linear fashion. That is
+     * when the min-byte1 and max-byte2 fields are both zero in the X protocol.
+     *
+     * @param info the font info reply
+     */
+    private void readCharWidthsLinear(Fontable.FontReply info)
+    {
+      int startIndex = info.min_char_or_byte2();
+      int endIndex = info.max_char_or_byte2();
+      charWidths = new int[endIndex + 1];
+      // All the characters before startIndex are zero width.
+      for (int i = 0; i < startIndex; i++)
+        {
+          charWidths[i] = 0;
+        }
+      // All the other character info is fetched from the font info.
+      int index = startIndex;
+      Iterator charInfos = info.char_infos().iterator();
+      while (charInfos.hasNext())
+        {
+          Fontable.FontReply.CharInfo charInfo =
+            (Fontable.FontReply.CharInfo) charInfos.next();
+          charWidths[index] = charInfo.character_width();
+          index++;
+        }
+    }
+
+    private void readCharWidthsNonLinear(Fontable.FontReply info)
+    {
+      // TODO: Implement.
+      throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    /**
+     * Returns the ascent of the font.
+     *
+     * @return the ascent of the font
+     */
+    public int getAscent()
+    {
+      return ascent;
+    }
+
+    /**
+     * Returns the descent of the font.
+     *
+     * @return the descent of the font
+     */
+    public int getDescent()
+    {
+      return descent;
+    }
+
+    /**
+     * Returns the overall height of the font. This is the distance from
+     * baseline to baseline (usually ascent + descent + leading).
+     *
+     * @return the overall height of the font
+     */
+    public int getHeight()
+    {
+      return ascent + descent;
+    }
+
+    /**
+     * Returns the leading of the font.
+     *
+     * @return the leading of the font
+     */
+    public int getLeading()
+    {
+      return leading;
+    }
+
+    /**
+     * Returns the maximum advance for this font.
+     *
+     * @return the maximum advance for this font
+     */
+    public int getMaxAdvance()
+    {
+      return maxAdvance;
+    }
+
+    /**
+     * Determines the width of the specified character <code>c</code>.
+     *
+     * @param c the character
+     *
+     * @return the width of the character
+     */
+    public int charWidth(char c)
+    {
+      int width;
+      if (c > charWidths.length)
+        width = charWidths['?'];
+      else
+        width = charWidths[c];
+      return width;
+    }
+
+    /**
+     * Determines the overall width of the specified string.
+     *
+     * @param c the char buffer holding the string
+     * @param offset the starting offset of the string in the buffer
+     * @param length the number of characters in the string buffer 
+     *
+     * @return the overall width of the specified string
+     */
+    public int charsWidth(char[] c, int offset, int length)
+    {
+      int width = 0;
+      if (c.length > 0 && length > 0)
+        {
+          String s = new String(c, offset, length);
+          width = stringWidth(s);
+        }
+      return width;
+    }
+
+    /**
+     * Determines the overall width of the specified string.
+     *
+     * @param s the string
+     *
+     * @return the overall width of the specified string
+     */
+    public int stringWidth(String s)
+    {
+      int width = 0;
+      if (s.length() > 0)
+        {
+          if (metricsCache.containsKey(s))
+            {
+              width = ((Integer) metricsCache.get(s)).intValue();
+            }
+          else
+            {
+              Fontable.TextExtentReply extents = getXFont().text_extent(s);
+              /*
+               System.err.println("string: '" + s + "' : ");
+               System.err.println("ascent: " + extents.getAscent());
+               System.err.println("descent: " + extents.getDescent());
+               System.err.println("overall ascent: " + extents.getOverallAscent());
+               System.err.println("overall descent: " + extents.getOverallDescent());
+               System.err.println("overall width: " + extents.getOverallWidth());
+               System.err.println("overall left: " + extents.getOverallLeft());
+               System.err.println("overall right: " + extents.getOverallRight());
+               */
+              width = extents.overall_width(); // + extents.overall_left();
+              //System.err.println("String: " + s + ", width: " + width);
+              metricsCache.put(s, new Integer(width));
+            }
+        }
+      //System.err.print("stringWidth: '" + s + "': ");
+      //System.err.println(width);
+      return width;
+    }
+  }
+
+  /**
+   * The LineMetrics implementation for the XFontPeer.
+   */
+  private class XLineMetrics
+    extends LineMetrics
+  {
+
+    /**
+     * Returns the ascent of the font.
+     *
+     * @return the ascent of the font
+     */
+    public float getAscent()
+    {
+      return fontMetrics.ascent;
+    }
+
+    public int getBaselineIndex()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException();
+    }
+
+    public float[] getBaselineOffsets()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Returns the descent of the font.
+     *
+     * @return the descent of the font
+     */
+    public float getDescent()
+    {
+      return fontMetrics.descent;
+    }
+
+    /**
+     * Returns the overall height of the font. This is the distance from
+     * baseline to baseline (usually ascent + descent + leading).
+     *
+     * @return the overall height of the font
+     */
+    public float getHeight()
+    {
+      return fontMetrics.ascent + fontMetrics.descent;
+    }
+
+    /**
+     * Returns the leading of the font.
+     *
+     * @return the leading of the font
+     */
+    public float getLeading()
+    {
+      return fontMetrics.leading;
+    }
+
+    public int getNumChars()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException();
+    }
+
+    public float getStrikethroughOffset()
+    {
+      return 0.F; // TODO: Provided by X??
+    }
+
+    public float getStrikethroughThickness()
+    {
+      return 1.F; // TODO: Provided by X??
+    }
+
+    public float getUnderlineOffset()
+    {
+      return 0.F; // TODO: Provided by X??
+    }
+
+    public float getUnderlineThickness()
+    {
+      return 1.F; // TODO: Provided by X??
+    }
+      
+  }
+
+  /**
+   * The X font.
+   */
+  private gnu.x11.Font xfont;
+
+  private String name;
+
+  private int style;
+
+  private int size;
+
+  /**
+   * The font metrics for this font.
+   */
+  XFontMetrics fontMetrics; 
+
+  /**
+   * Creates a new XFontPeer for the specified font name, style and size.
+   *
+   * @param name the font name
+   * @param style the font style (bold / italic / normal)
+   * @param size the size of the font
+   */
+  public XFontPeer(String name, int style, int size)
+  {
+    super(name, style, size);
+    this.name = name;
+    this.style = style;
+    this.size = size;
+  }
+
+  /**
+   * Creates a new XFontPeer for the specified font name and style
+   * attributes.
+   *
+   * @param name the font name
+   * @param atts the font attributes
+   */
+  public XFontPeer(String name, Map atts)
+  {
+    super(name, atts);
+    String family = name;
+    if (family == null || family.equals(""))
+      family = (String) atts.get(TextAttribute.FAMILY);
+    if (family == null)
+      family = "SansSerif";
+
+    int size = 12;
+    Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
+    if (sizeFl != null)
+      size = sizeFl.intValue();
+
+    int style = 0;
+    // Detect italic attribute.
+    Float posture = (Float) atts.get(TextAttribute.POSTURE);
+    if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
+      style |= Font.ITALIC;
+
+    // Detect bold attribute.
+    Float weight = (Float) atts.get(TextAttribute.WEIGHT);
+    if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
+      style |= Font.BOLD;
+
+    this.name = name;
+    this.style = style;
+    this.size = size;
+  }
+
+  /**
+   * Initializes the font peer with the specified attributes. This method is
+   * called from both constructors.
+   *
+   * @param name the font name
+   * @param style the font style
+   * @param size the font size
+   */
+  private void init(String name, int style, int size)
+  {
+    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+    GraphicsDevice dev = env.getDefaultScreenDevice();
+    if (dev instanceof XGraphicsDevice)
+      {
+        Display display = ((XGraphicsDevice) dev).getDisplay();
+        String fontDescr = encodeFont(name, style, size);
+        if (XToolkit.DEBUG)
+          System.err.println("XLFD font description: " + fontDescr);
+        xfont = new gnu.x11.Font(display, fontDescr);
+      }
+    else
+      {
+        throw new AWTError("Local GraphicsEnvironment is not XWindowGraphicsEnvironment");
+      }
+  }
+
+  public boolean canDisplay(Font font, char c)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public int canDisplayUpTo(Font font, CharacterIterator i, int start, int limit)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public String getSubFamilyName(Font font, Locale locale)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public String getPostScriptName(Font font)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public int getNumGlyphs(Font font)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public int getMissingGlyphCode(Font font)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public byte getBaselineFor(Font font, char c)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public String getGlyphName(Font font, int glyphIndex)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public GlyphVector createGlyphVector(Font font, FontRenderContext frc,
+                                       CharacterIterator ci)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public GlyphVector createGlyphVector(Font font, FontRenderContext ctx,
+                                       int[] glyphCodes)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public GlyphVector layoutGlyphVector(Font font, FontRenderContext frc,
+                                       char[] chars, int start, int limit,
+                                       int flags)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Returns the font metrics for the specified font.
+   *
+   * @param font the font for which to fetch the font metrics
+   *
+   * @return the font metrics for the specified font
+   */
+  public FontMetrics getFontMetrics(Font font)
+  {
+    if (font.getPeer() != this)
+      throw new AWTError("The specified font has a different peer than this");
+
+    if (fontMetrics == null)
+      fontMetrics = new XFontMetrics(font);
+    return fontMetrics;
+  }
+
+  /**
+   * Frees the font in the X server.
+   */
+  protected void finalize()
+  {
+    if (xfont != null)
+      xfont.close();
+  }
+
+  public boolean hasUniformLineMetrics(Font font)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Returns the line metrics for this font and the specified string and
+   * font render context.
+   */
+  public LineMetrics getLineMetrics(Font font, CharacterIterator ci, int begin,
+                                    int limit, FontRenderContext rc)
+  {
+    return new XLineMetrics();
+  }
+
+  public Rectangle2D getMaxCharBounds(Font font, FontRenderContext rc)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public Rectangle2D getStringBounds(Font font, CharacterIterator ci,
+                                     int begin, int limit, FontRenderContext frc)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Encodes a font name + style + size specification into a X logical font
+   * description (XLFD) as described here:
+   *
+   * http://www.meretrx.com/e93/docs/xlfd.html
+   *
+   * This is implemented to look up the font description in the
+   * fonts.properties of this package.
+   *
+   * @param name the font name
+   * @param atts the text attributes
+   *
+   * @return the encoded font description
+   */
+  static String encodeFont(String name, Map atts)
+  {
+    String family = name;
+    if (family == null || family.equals(""))
+      family = (String) atts.get(TextAttribute.FAMILY);
+    if (family == null)
+      family = "SansSerif";
+
+    int size = 12;
+    Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
+    if (sizeFl != null)
+      size = sizeFl.intValue();
+
+    int style = 0;
+    // Detect italic attribute.
+    Float posture = (Float) atts.get(TextAttribute.POSTURE);
+    if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
+      style |= Font.ITALIC;
+
+    // Detect bold attribute.
+    Float weight = (Float) atts.get(TextAttribute.WEIGHT);
+    if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
+      style |= Font.BOLD;
+
+    return encodeFont(name, style, size);
+  }
+
+  /**
+   * Encodes a font name + style + size specification into a X logical font
+   * description (XLFD) as described here:
+   *
+   * http://www.meretrx.com/e93/docs/xlfd.html
+   *
+   * This is implemented to look up the font description in the
+   * fonts.properties of this package.
+   *
+   * @param name the font name
+   * @param style the font style
+   * @param size the font size
+   *
+   * @return the encoded font description
+   */
+  static String encodeFont(String name, int style, int size)
+  {
+    StringBuilder key = new StringBuilder();
+    key.append(validName(name));
+    key.append('.');
+    switch (style)
+    {
+      case Font.BOLD:
+        key.append("bold");
+        break;
+      case Font.ITALIC:
+        key.append("italic");
+        break;
+      case (Font.BOLD | Font.ITALIC):
+        key.append("bolditalic");
+        break;
+      case Font.PLAIN:
+      default:
+        key.append("plain");
+      
+    }
+
+    String protoType = fontProperties.getProperty(key.toString());
+    int s = validSize(size);
+    return protoType.replaceFirst("%d", String.valueOf(s * 10));
+  }
+
+  /**
+   * Checks the specified font name for a valid font name. If the font name
+   * is not known, then this returns 'sansserif' as fallback.
+   *
+   * @param name the font name to check
+   *
+   * @return a valid font name
+   */
+  static String validName(String name)
+  {
+    String retVal;
+    if (name.equalsIgnoreCase("sansserif")
+        || name.equalsIgnoreCase("serif")
+        || name.equalsIgnoreCase("monospaced")
+        || name.equalsIgnoreCase("dialog")
+        || name.equalsIgnoreCase("dialoginput"))
+      {
+        retVal = name.toLowerCase();
+      }
+    else
+      {
+        retVal = "sansserif";
+      }
+    return retVal;
+  }
+
+  /**
+   * Translates an arbitrary point size to a size that is typically available
+   * on an X server. These are the sizes 8, 10, 12, 14, 18 and 24.
+   *
+   * @param size the queried size
+   * @return the real available size
+   */
+  private static final int validSize(int size)
+  {
+    int val;
+    if (size <= 9)
+      val = 8;
+    else if (size <= 11)
+      val = 10;
+    else if (size <= 13)
+      val = 12;
+    else if (size <= 17)
+      val = 14;
+    else if (size <= 23)
+      val = 18;
+    else
+      val = 24;
+    return val;
+  }
+
+  /**
+   * Returns the X Font reference. This lazily loads the font when first
+   * requested.
+   *
+   * @return the X Font reference
+   */
+  gnu.x11.Font getXFont()
+  {
+    if (xfont == null)
+      {
+        init(name, style, size);
+      }
+    return xfont;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,335 @@
+/* XFontPeer2.java -- A Java based TTF font peer for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.LineMetrics;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.io.File;
+import java.io.FileInputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.Locale;
+import java.util.Map;
+
+import gnu.java.awt.font.FontDelegate;
+import gnu.java.awt.font.FontFactory;
+import gnu.java.awt.peer.ClasspathFontPeer;
+
+public class XFontPeer2
+  extends ClasspathFontPeer
+{
+
+  private class XLineMetrics
+    extends LineMetrics
+  {
+
+    private Font font;
+//    private CharacterIterator characterIterator;
+//    private int begin;
+//    private int limit;
+    private FontRenderContext fontRenderContext;
+    XLineMetrics(Font f, CharacterIterator ci, int b, int l,
+                 FontRenderContext rc)
+    {
+      font = f;
+//      characterIterator = ci;
+//      begin = b;
+//      limit = l;
+      fontRenderContext = rc;
+    }
+
+    public float getAscent()
+    {
+      return fontDelegate.getAscent(font.getSize(), fontRenderContext.getTransform(),
+                             fontRenderContext.isAntiAliased(),
+                             fontRenderContext.usesFractionalMetrics(), true);
+      }
+
+    public int getBaselineIndex()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    public float[] getBaselineOffsets()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    public float getDescent()
+    {
+      return (int) fontDelegate.getDescent(font.getSize(),
+                                           new AffineTransform(), false, false,
+                                           false);
+    }
+
+    public float getHeight()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    public float getLeading()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    public int getNumChars()
+    {
+      // FIXME: Implement this.
+      throw new UnsupportedOperationException("Not yet implemented");
+    }
+
+    public float getStrikethroughOffset()
+    {
+      return 0.F;
+    }
+
+    public float getStrikethroughThickness()
+    {
+      return 0.F;
+    }
+
+    public float getUnderlineOffset()
+    {
+      return 0.F;
+    }
+
+    public float getUnderlineThickness()
+    {
+      return 0.F;
+    }
+    
+  }
+
+  private class XFontMetrics
+    extends FontMetrics
+  {
+    XFontMetrics(Font f)
+    {
+      super(f);
+    }
+
+    public int getAscent()
+    {
+      return (int) fontDelegate.getAscent(getFont().getSize(),
+                                          new AffineTransform(), false, false,
+                                          false);
+    }
+
+    public int getDescent()
+    {
+      return (int) fontDelegate.getDescent(getFont().getSize(),
+                                           new AffineTransform(), false, false,
+                                           false);
+    }
+    
+    public int getHeight()
+    {
+      GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
+                    new FontRenderContext(new AffineTransform(), false, false),
+                    new StringCharacterIterator("m"));
+      Rectangle2D b = gv.getVisualBounds();
+      return (int) b.getHeight();
+    }
+
+    public int charWidth(char c)
+    {
+      Point2D advance = new Point2D.Double();
+      fontDelegate.getAdvance(c, getFont().getSize(), new AffineTransform(),
+                              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(new AffineTransform(), false, false),
+                    new StringCharacterIterator(s));
+      Rectangle2D b = gv.getVisualBounds();
+      return (int) b.getWidth();
+    }
+  }
+
+  private FontDelegate fontDelegate;
+
+  XFontPeer2(String name, int style, int size)
+  {
+    super(name, style, size);
+    try
+      {
+        File fontfile = new File("/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf");
+        FileInputStream in = new FileInputStream(fontfile);
+        FileChannel ch = in.getChannel();
+        ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
+                                   fontfile.length());
+        fontDelegate = FontFactory.createFonts(buffer)[0];
+      }
+    catch (Exception ex)
+      {
+        ex.printStackTrace();
+      }
+  }
+
+  XFontPeer2(String name, Map atts)
+  {
+    super(name, atts);
+    try
+      {
+        File fontfile = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
+        FileInputStream in = new FileInputStream(fontfile);
+        FileChannel ch = in.getChannel();
+        ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
+                                   fontfile.length());
+        fontDelegate = FontFactory.createFonts(buffer)[0];
+      }
+    catch (Exception ex)
+      {
+        ex.printStackTrace();
+      }
+  }
+
+  public boolean canDisplay(Font font, char c)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public int canDisplayUpTo(Font font, CharacterIterator i, int start, int limit)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public String getSubFamilyName(Font font, Locale locale)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public String getPostScriptName(Font font)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public int getNumGlyphs(Font font)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public int getMissingGlyphCode(Font font)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public byte getBaselineFor(Font font, char c)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public String getGlyphName(Font font, int glyphIndex)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public GlyphVector createGlyphVector(Font font, FontRenderContext frc, CharacterIterator ci)
+  {
+    return fontDelegate.createGlyphVector(font, frc, ci);
+  }
+
+  public GlyphVector createGlyphVector(Font font, FontRenderContext ctx, int[] glyphCodes)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public GlyphVector layoutGlyphVector(Font font, FontRenderContext frc, char[] chars, int start, int limit, int flags)
+  {
+    StringCharacterIterator i = new StringCharacterIterator(new String(chars), start, limit, 0);
+    return fontDelegate.createGlyphVector(font, frc, i);
+  }
+
+  public FontMetrics getFontMetrics(Font font)
+  {
+    return new XFontMetrics(font);
+  }
+
+  public boolean hasUniformLineMetrics(Font font)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public LineMetrics getLineMetrics(Font font, CharacterIterator ci, int begin, int limit, FontRenderContext rc)
+  {
+    return new XLineMetrics(font, ci, begin, limit, rc);
+  }
+
+  public Rectangle2D getMaxCharBounds(Font font, FontRenderContext rc)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public Rectangle2D getStringBounds(Font font, CharacterIterator ci, int begin, int limit, FontRenderContext frc)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,140 @@
+/* XFramePeer.java -- The X FramePeer implementation
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.PaintEvent;
+import java.awt.event.WindowEvent;
+import java.awt.peer.FramePeer;
+
+import gnu.java.awt.peer.swing.SwingFramePeer;
+import gnu.x11.Window;
+import gnu.x11.event.Event;
+
+public class XFramePeer
+  extends XWindowPeer
+  implements FramePeer
+{
+
+  XFramePeer(Frame f)
+  {
+    super(f);
+  }
+
+  public void setIconImage(Image image)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public void setMenuBar(MenuBar mb)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public void setResizable(boolean resizable)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public void setTitle(String title)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public int getState()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public void setState(int state)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public void setMaximizedBounds(Rectangle r)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+  
+  /**
+   * Check if this frame peer supports being restacked.
+   * 
+   * @return true if this frame peer can be restacked,
+   * false otherwise
+   * @since 1.5
+   */
+  public boolean isRestackSupported()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+  
+  /**
+   * Sets the bounds of this frame peer.
+   * 
+   * @param x the new x co-ordinate
+   * @param y the new y co-ordinate
+   * @param width the new width
+   * @param height the new height
+   * @since 1.5
+   */
+  public void setBoundsPrivate(int x, int y, int width, int height)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,792 @@
+/* XGraphics.java -- The Graphics implementation for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import gnu.x11.Colormap;
+import gnu.x11.Data;
+import gnu.x11.Display;
+import gnu.x11.Drawable;
+import gnu.x11.GC;
+import gnu.x11.Pixmap;
+import gnu.x11.Point;
+import gnu.x11.image.ZPixmap;
+
+import java.awt.AWTError;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.Toolkit;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.text.AttributedCharacterIterator;
+import java.util.HashMap;
+
+public class XGraphics
+  extends Graphics
+  implements Cloneable
+{
+
+  /**
+   * The X Drawable to draw on.
+   */
+  private Drawable xdrawable;
+
+  /**
+   * The X graphics context (GC).
+   */
+  private GC xgc;
+
+  /**
+   * The current translation.
+   */
+  private int translateX;
+  private int translateY;
+
+  /**
+   * The current clip. Possibly null.
+   */
+  private Rectangle clip;
+
+  /**
+   * The current font, possibly null.
+   */
+  private Font font;
+
+  /**
+   * The current foreground color, possibly null.
+   */
+  private Color foreground;
+
+  /**
+   * Indicates if this object has been disposed.
+   */
+  private boolean disposed = false;
+
+  // TODO: Workaround for limitation in current Escher.
+  private Pixmap.Format pixmapFormat;
+  private int imageByteOrder;
+  private int pixelByteCount;
+  
+  /**
+   * Creates a new XGraphics on the specified X Drawable.
+   *
+   * @param d the X Drawable for which we create the Graphics
+   */
+  XGraphics(Drawable d)
+  {
+    xdrawable = d;
+    xgc = new GC(d);
+    translateX = 0;
+    translateY = 0;
+    clip = new Rectangle(0, 0, d.width, d.height);
+
+    Display display = xdrawable.display;
+    pixmapFormat = display.default_pixmap_format;
+    imageByteOrder = display.image_byte_order;
+    pixelByteCount = pixmapFormat.bits_per_pixel () / 8;
+  }
+
+  /**
+   * Creates an exact copy of this graphics context.
+   *
+   * @return an exact copy of this graphics context
+   */
+  public Graphics create()
+  {
+    XGraphics copy = (XGraphics) clone();
+    return copy;
+  }
+
+  /**
+   * Translates the origin by (x, y).
+   */
+  public void translate(int x, int y)
+  {
+    translateX += x;
+    translateY += y;
+    if (clip != null)
+      {
+        clip.x -= x;
+        clip.y -= y;
+      }
+  }
+
+  /**
+   * Returns the current foreground color, possibly <code>null</code>.
+   *
+   * @return the current foreground color, possibly <code>null</code>
+   */
+  public Color getColor()
+  {
+    return foreground;
+  }
+
+  /**
+   * Sets the current foreground color. A <code>null</code> value doesn't
+   * change the current setting.
+   *
+   * @param c the foreground color to set
+   */
+  public void setColor(Color c)
+  {
+    if (c != null)
+      {
+        XToolkit tk = (XToolkit) Toolkit.getDefaultToolkit();
+        HashMap colorMap = tk.colorMap;
+        gnu.x11.Color col = (gnu.x11.Color) colorMap.get(c);
+        if (col == null)
+          {
+            Colormap map = xdrawable.display.default_colormap;
+            col = map.alloc_color (c.getRed() * 256,
+                                   c.getGreen() * 256,
+                                   c.getBlue() * 256);
+            colorMap.put(c, col);
+          }
+        xgc.set_foreground(col);
+        foreground = c;
+      }
+  }
+
+  public void setPaintMode()
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public void setXORMode(Color color)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  /**
+   * Returns the current font, possibly <code>null</code>.
+   *
+   * @return the current font, possibly <code>null</code>
+   */
+  public Font getFont()
+  {
+    return font;
+  }
+
+  /**
+   * Sets the font on the graphics context. A <code>null</code> value doesn't
+   * change the current setting.
+   *
+   * @param f the font to set
+   */
+  public void setFont(Font f)
+  {
+    if (f != null)
+      {
+        XFontPeer xFontPeer = (XFontPeer) f.getPeer();
+        xgc.set_font(xFontPeer.getXFont());
+        font = f;
+      }
+  }
+
+  /**
+   * Returns the font metrics for the specified font.
+   *
+   * @param font the font for which we want the font metrics
+   *
+   * @return the font metrics for the specified font
+   */
+  public FontMetrics getFontMetrics(Font font)
+  {
+    if (font == null)
+      {
+        if (this.font == null)
+          setFont(new Font("Dialog", Font.PLAIN, 12));
+        font = this.font;
+      }
+    XFontPeer xFontPeer = (XFontPeer) font.getPeer();
+    return xFontPeer.getFontMetrics(font);
+  }
+
+  /**
+   * Returns the bounds of the current clip.
+   *
+   * @return the bounds of the current clip
+   */
+  public Rectangle getClipBounds()
+  {
+    return clip != null ? clip.getBounds() : null;
+  }
+
+  /**
+   * Clips the current clip with the specified clip.
+   */
+  public void clipRect(int x, int y, int width, int height)
+  {
+    if (clip == null)
+      {
+        clip = new Rectangle(x, y, width, height);
+      }
+    else
+      {
+        computeIntersection(x, y, width, height, clip);
+      }
+    // Update the X clip setting.
+    setXClip(clip.x, clip.y, clip.width, clip.height);
+  }
+
+  /**
+   * Returns <code>true</code> when the specified rectangle intersects with
+   * the current clip, <code>false</code> otherwise. This is overridden to
+   * avoid unnecessary creation of Rectangles via getBounds().
+   *
+   * @param x the x coordinate of the rectangle
+   * @param y the y coordinate of the rectangle
+   * @param w the width of the rectangle
+   * @param h the height of the rectangle
+   *
+   * @return <code>true</code> when the specified rectangle intersects with
+   *         the current clip, <code>false</code> otherwise
+   */
+  public boolean hitClip(int x, int y, int w, int h)
+  {
+    boolean hit;
+    if (clip == null)
+      {
+        hit = true;
+      }
+    else
+      {
+        // It's easier to determine if the rectangle lies outside the clip,
+        // so we determine that and reverse the result (if it's not completely
+        // outside, it most likely hits the clip rectangle).
+        int x2 = x + w;
+        int y2 = y + h;
+        int clipX2 = clip.x + clip.width;
+        int clipY2 = clip.y + clip.height;
+        boolean outside = (x < clip.x && x2 < clip.x)     // Left.
+                          || (x > clipX2  && x2 > clipX2) // Right.
+                          || (y < clip.y && y2 < clip.y)  // Top.
+                          || (y > clipY2 && y2 > clipY2); // Bottom.
+        hit = ! outside;
+      }
+    return hit;
+  }
+
+  public void setClip(int x, int y, int width, int height)
+  {
+    if (clip != null)
+      clip.setBounds(x, y, width, height);
+    else
+      clip = new Rectangle(x, y, width, height);
+    setXClip(clip.x, clip.y, clip.width, clip.height);
+  }
+
+  /**
+   * Sets the clip on the X server GC. The coordinates are not yet translated,
+   * this will be performed by the X server.
+   *
+   * @param x the clip, X coordinate
+   * @param y the clip, Y coordinate
+   * @param w the clip, width
+   * @param h the clip, height
+   */
+  private void setXClip(int x, int y, int w, int h)
+  {
+    gnu.x11.Rectangle[] clipRects = new gnu.x11.Rectangle[] {
+                                  new gnu.x11.Rectangle(x, y, w, h) };
+    xgc.set_clip_rectangles(translateX, translateY, clipRects, GC.YX_BANDED);
+  }
+
+  public Shape getClip()
+  {
+    // Return a copy here, so nobody can trash our clip.
+    return clip == null ? null : clip.getBounds();
+  }
+
+  /**
+   * Sets the current clip.
+   *
+   * @param c the clip to set
+   */
+  public void setClip(Shape c)
+  {
+    if (c != null)
+      {
+        Rectangle b;
+        if (c instanceof Rectangle)
+          {
+            b = (Rectangle) c;
+          }
+        else
+          {
+            b = c.getBounds();
+          }
+        clip.setBounds(b);
+        setXClip(b.x, b.y, b.width, b.height);
+      }
+    else
+      {
+        clip.setBounds(0, 0, xdrawable.width, xdrawable.height);
+        setXClip(0, 0, xdrawable.width, xdrawable.height);
+      }
+  }
+
+  public void copyArea(int x, int y, int width, int height, int dx, int dy)
+  {
+    // Clip and translate src rectangle.
+    int srcX = Math.min(Math.max(x, clip.x), clip.x + clip.width)
+               + translateX;
+    int srcY = Math.min(Math.max(y, clip.y), clip.y + clip.height)
+               + translateY;
+    int srcWidth = Math.min(Math.max(x + width, clip.x),
+                            clip.x + clip.width) - x;
+    int srcHeight = Math.min(Math.max(y + height, clip.y),
+                            clip.y + clip.height) - y;
+    xdrawable.copy_area(xdrawable, xgc, srcX, srcY, srcWidth, srcHeight,
+                        srcX + dx, srcY + dy);
+  }
+
+  /**
+   * Draws a line from point (x1, y1) to point (x2, y2).
+   */
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    //System.err.println("drawLine: " + (x1 + translateX) + ", " + ( y1 + translateY) + ", " + (x2 + translateX) + ", " + (y2 + translateY) + " on: " + xdrawable);
+    xdrawable.line(xgc, x1 + translateX, y1 + translateY,
+                   x2 + translateX, y2 + translateY);
+  }
+
+  /**
+   * Fills the specified rectangle.
+   */
+  public void fillRect(int x, int y, int width, int height)
+  {
+    xdrawable.rectangle(xgc, x + translateX, y + translateY,
+                        width, height, true);
+  }
+
+  public void clearRect(int x, int y, int width, int height)
+  {
+    xgc.set_foreground(Color.WHITE.getRGB());
+    xdrawable.rectangle(xgc, x, y, width, height, true);
+    if (foreground != null)
+      xgc.set_foreground(foreground.getRGB());
+  }
+
+  public void drawRoundRect(int x, int y, int width, int height, int arcWidth,
+                            int arcHeight)
+  {
+    // Draw 4 lines.
+    int arcRadiusX = arcWidth / 2;
+    int arcRadiusY = arcHeight / 2;
+    drawLine(x + arcRadiusX, y, x + width - arcRadiusX, y);
+    drawLine(x, y + arcRadiusY, x, y + height - arcRadiusY);
+    drawLine(x + arcRadiusX, y + height, x + width - arcRadiusX, y + height);
+    drawLine(x + width, y + arcRadiusY, x + width, y + height - arcRadiusY);
+
+    // Draw the 4 arcs at the corners.
+    // Upper left.
+    drawArc(x, y, arcWidth, arcHeight, 90, 90);
+    // Lower left.
+    drawArc(x, y + height - arcHeight, arcWidth, arcHeight, 180, 90);
+    // Upper right.
+    drawArc(x + width - arcWidth, y, arcWidth, arcHeight, 0, 90);
+    // Lower right.
+    drawArc(x + width - arcWidth, y + height - arcHeight, arcWidth, arcHeight,
+            270, 90);
+  }
+
+  public void fillRoundRect(int x, int y, int width, int height, int arcWidth,
+                            int arcHeight)
+  {
+    // Fill the 3 rectangles that make up the inner area.
+    int arcRadiusX = arcWidth / 2;
+    int arcRadiusY = arcHeight / 2;
+    // Left.
+    fillRect(x, y + arcRadiusY, arcRadiusX, height - arcHeight);
+    // Middle.
+    fillRect(x + arcRadiusX, y, width - arcWidth, height);
+    // Right.
+    fillRect(x + width - arcRadiusX, y + arcRadiusY, arcRadiusX,
+             height - arcHeight);
+
+    // Fill the 4 arcs in the corners.
+    // Upper left.
+    fillArc(x, y, arcWidth, arcHeight, 90, 90);
+    // Lower left.
+    fillArc(x, y + height - arcHeight, arcWidth, arcHeight, 180, 90);
+    // Upper right.
+    fillArc(x + width - arcWidth, y, arcWidth, arcHeight, 0, 90);
+    // Lower right.
+    fillArc(x + width - arcWidth, y + height - arcHeight, arcWidth, arcHeight,
+            270, 90);
+  }
+
+  public void drawOval(int x, int y, int width, int height)
+  {
+    xdrawable.arc(xgc, x, y, width, height, 0, 360 * 64, false);
+  }
+
+  public void fillOval(int x, int y, int width, int height)
+  {
+    xdrawable.arc(xgc, x, y, width, height, 0, 360 * 64, true);
+  }
+
+  public void drawArc(int x, int y, int width, int height, int arcStart,
+                      int arcAngle)
+  {
+    xdrawable.arc(xgc, x, y, width, height, arcStart * 64, arcAngle * 64, false);
+  }
+
+  public void fillArc(int x, int y, int width, int height, int arcStart,
+                      int arcAngle)
+  {
+    xdrawable.arc(xgc, x, y, width, height, arcStart * 64, arcAngle * 64, true);
+  }
+
+  public void drawPolyline(int[] xPoints, int[] yPoints, int npoints)
+  {
+    int numPoints = Math.min(xPoints.length, yPoints.length);
+    Point[] points = new Point[numPoints];
+    // FIXME: Improve Escher API to accept arrays to avoid creation
+    // of many Point objects.
+    for (int i = 0; i < numPoints; i++)
+      points[i] = new Point(xPoints[i], yPoints[i]);
+    xdrawable.poly_line(xgc, points, Drawable.ORIGIN);
+  }
+
+  public void drawPolygon(int[] xPoints, int[] yPoints, int npoints)
+  {
+    int numPoints = Math.min(xPoints.length, yPoints.length);
+    Point[] points = new Point[numPoints];
+    // FIXME: Improve Escher API to accept arrays to avoid creation
+    // of many Point objects.
+    for (int i = 0; i < numPoints; i++)
+      points[i] = new Point(xPoints[i], yPoints[i]);
+    xdrawable.poly_line(xgc, points, Drawable.ORIGIN);
+  }
+
+  public void fillPolygon(int[] xPoints, int[] yPoints, int npoints)
+  {
+    int numPoints = Math.min(xPoints.length, yPoints.length);
+    Point[] points = new Point[numPoints];
+    // FIXME: Improve Escher API to accept arrays to avoid creation
+    // of many Point objects.
+    for (int i = 0; i < numPoints; i++)
+      points[i] = new Point(xPoints[i], yPoints[i]);
+    xdrawable.fill_poly(xgc, points, Drawable.COMPLEX, Drawable.ORIGIN);
+  }
+
+  /**
+   * Draws the specified string at (x, y).
+   */
+  public void drawString(String string, int x, int y)
+  {
+    if (disposed)
+      throw new AWTError("XGraphics already disposed");
+
+    xdrawable.text(xgc, x + translateX, y + translateY, string);
+  }
+
+  public void drawString(AttributedCharacterIterator ci, int x, int y)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  /**
+   * Draws the specified image on the drawable at position (x,y).
+   */
+  public boolean drawImage(Image image, int x, int y, ImageObserver observer)
+  {
+    if (image instanceof XImage)
+      {
+        XImage xim = (XImage) image;
+        Pixmap pm = xim.pixmap;
+        xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
+                            x + translateX, y + translateY);
+      }
+    else if (image instanceof BufferedImage
+        && ((BufferedImage) image).getTransparency() != Transparency.OPAQUE)
+      {
+        BufferedImage bi = (BufferedImage) image;
+        int width = bi.getWidth();
+        int height = bi.getHeight();
+        Data img = xdrawable.image(x + translateX, y + translateY,
+                                   width, height, 0xFFFFFFFF, 2);
+
+        // Compute line byte count.
+        int lineBitCount = width * pixmapFormat.bits_per_pixel ();
+        int rem = lineBitCount % pixmapFormat.scanline_pad ();
+        int linePadCount = lineBitCount / pixmapFormat.scanline_pad ()
+                             + (rem == 0 ? 0 : 1);
+        int lineByteCount = linePadCount * pixmapFormat.scanline_pad () / 8;
+
+        // Composite source and destination pixel data.
+        int[] trgb = new int[3]; // The device rgb pixels.
+        for (int yy = 0; yy < height; yy++)
+          {
+            for (int xx = 0; xx < width; xx++)
+              {
+                getRGB(xx, yy, img, trgb, lineByteCount);
+                int srgb = bi.getRGB(xx, yy);
+                float alpha = ((srgb >> 24) & 0xff) / 256F;
+                float tAlpha = 1.F - alpha;
+                int red = (srgb >> 16) & 0xFF;
+                int green = (srgb >> 8) & 0xFF;
+                int blue = (srgb) & 0xFF;
+                trgb[0] = (int) (trgb[0] * tAlpha + red * alpha);
+                trgb[1] = (int) (trgb[1] * tAlpha + green * alpha);
+                trgb[2] = (int) (trgb[2] * tAlpha + blue * alpha);
+                setRGB(xx, yy, img, trgb, lineByteCount);
+              }
+          }
+
+        // Now we have the transparent image composited onto the target
+        // Image, now we only must copy it to the Drawable.
+        ZPixmap pm = new ZPixmap(xdrawable.display);
+        pm.width = width;
+        pm.height = height;
+        pm.init();
+        System.arraycopy(img.data, 32, pm.data, 0, img.data.length - 32);
+        xdrawable.put_image(xgc, pm, x + translateX, y + translateY);
+      }
+    else
+      {
+        // Pre-render the image into an XImage.
+        ImageProducer source = image.getSource();
+        ImageConverter conv = new ImageConverter();
+        source.startProduction(conv);
+        XImage xim = conv.getXImage();
+        Pixmap pm = xim.pixmap;
+        xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
+                            x + translateX, y + translateY);
+      }
+    return true;
+  }
+
+  /**
+   * Helper method to work around limitation in the current Escher impl.
+   *
+   * @param x the x position
+   * @param y the y position
+   * @param img the image data
+   * @param rgb an 3-size array that holds the rgb values on method exit
+   */
+  private void getRGB(int x, int y, Data img, int[] rgb, int lineByteCount)
+  {
+    // TODO: Does this also work on non-RGB devices?
+    int i = y * lineByteCount + pixelByteCount * x;
+    if (imageByteOrder == gnu.x11.image.Image.LSB_FIRST)
+      {//if (i >= 5716-33) System.err.println("lbc: " + lineByteCount + ", " + pixelByteCount);
+        rgb[2] = img.data[32 + i];
+        rgb[1] = img.data[32 + i + 1];
+        rgb[0] = img.data[32 + i + 2];
+      }
+    else
+      {                    // MSB_FIRST
+        rgb[0] = img.data[32 + i];
+        rgb[1] = img.data[32 + i + 1];
+        rgb[2] = img.data[32 + i + 2];
+      }
+
+  }
+
+  /**
+   * Helper method to work around limitation in the current Escher impl.
+   *
+   * @param x the x position
+   * @param y the y position
+   * @param img the image data
+   * @param rgb an 3-size array that holds the rgb values on method exit
+   */
+  private void setRGB(int x, int y, Data img, int[] rgb, int lineByteCount)
+  {
+    // TODO: Does this also work on non-RGB devices?
+    int i = y * lineByteCount + pixelByteCount * x;
+    if (imageByteOrder == gnu.x11.image.Image.LSB_FIRST)
+      {
+        img.data[32 + i] = (byte) rgb[2];
+        img.data[32 + i + 1] = (byte) rgb[1];
+        img.data[32 + i + 2] = (byte) rgb[0];
+      }
+    else
+      {                    // MSB_FIRST
+        img.data[32 + i] = (byte) rgb[0];
+        img.data[32 + i + 1] = (byte) rgb[1];
+        img.data[32 + i + 2] = (byte) rgb[2];
+      }
+  }
+
+  public boolean drawImage(Image image, int x, int y, int width, int height,
+                           ImageObserver observer)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public boolean drawImage(Image image, int x, int y, Color bgcolor,
+                           ImageObserver observer)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public boolean drawImage(Image image, int x, int y, int width, int height,
+                           Color bgcolor, ImageObserver observer)
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
+                           int sx1, int sy1, int sx2, int sy2,
+                           ImageObserver observer)
+  {
+    return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null,
+                     observer);
+  }
+
+  public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
+                           int sx1, int sy1, int sx2, int sy2, Color bgcolor,
+                           ImageObserver observer)
+  {
+
+    // FIXME: What to do with bgcolor?
+
+    // Scale the image.
+    int sw = image.getWidth(observer);
+    int sh = image.getHeight(observer);
+    double scaleX = Math.abs(dx2 - dx1) / (double) Math.abs(sx2 - sx1);
+    double scaleY = Math.abs(dy2 - dy1) / (double) Math.abs(sy2 - sy1);
+    Image scaled = image.getScaledInstance((int) (scaleX * sw),
+                                           (int) (scaleY * sh),
+                                           Image.SCALE_FAST);
+
+    // Scaled source coordinates.
+    int sx1s = (int) (scaleX * Math.min(sx1, sx2));
+    int sx2s = (int) (scaleX * Math.max(sx1, sx2));
+
+    // Temporarily clip to the target rectangle.
+    Rectangle old = clip;
+    clipRect(dx1, dy1, dx2 - dx1, dy2 - dy1);
+
+    // Draw scaled image.
+    boolean res = drawImage(scaled, dx1 - sx1s, dy1 - sx2s, observer);
+
+    // Reset clip.
+    setClip(old);
+
+    return res;
+  }
+
+  /**
+   * Frees any resources associated with this object.
+   */
+  public void dispose()
+  {
+    if (! disposed)
+      {
+        xgc.free();
+        xdrawable.display.flush();
+        disposed = true;
+      }
+  }
+
+  // Additional helper methods.
+
+  /**
+   * Creates and returns an exact copy of this XGraphics.
+   */
+  protected Object clone()
+  {
+    try
+      {
+        XGraphics copy = (XGraphics) super.clone();
+        copy.xgc = xgc.copy();
+        if (clip != null)
+          {
+            copy.clip = new Rectangle(clip);
+            copy.setXClip(clip.x, clip.y, clip.width, clip.height);
+          }
+        return copy;
+      }
+    catch (CloneNotSupportedException ex)
+      {
+        assert false;
+      }
+    return null;
+  }
+  
+  /**
+   * Computes the intersection between two rectangles and stores the result
+   * int the second rectangle.
+   *
+   * This method has been copied from {@link javax.swing.SwingUtilities}.
+   *
+   * @param x the x coordinate of the rectangle #1
+   * @param y the y coordinate of the rectangle #1
+   * @param w the width of the rectangle #1
+   * @param h the height of the rectangle #1
+   * @param rect the rectangle #2 and output rectangle
+   */
+  private static void computeIntersection(int x, int y, int w, int h,
+                                          Rectangle rect)
+  {
+    int x2 = (int) rect.x;
+    int y2 = (int) rect.y;
+    int w2 = (int) rect.width;
+    int h2 = (int) rect.height;
+
+    int dx = (x > x2) ? x : x2;
+    int dy = (y > y2) ? y : y2;
+    int dw = (x + w < x2 + w2) ? (x + w - dx) : (x2 + w2 - dx);
+    int dh = (y + h < y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
+
+    if (dw >= 0 && dh >= 0)
+      rect.setBounds(dx, dy, dw, dh);
+    else
+      rect.setBounds(0, 0, 0, 0);
+  }
+
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,295 @@
+/* XGraphics2D.java -- A Java based Graphics2D impl for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+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.Raster;
+
+import gnu.java.awt.java2d.AbstractGraphics2D;
+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;
+
+  /**
+   * The X graphics context (GC).
+   */
+  private GC xgc;
+
+  /**
+   * Indicates if this graphics has already been disposed.
+   */
+  private boolean disposed;
+
+  XGraphics2D(Drawable d)
+  {
+    super();
+    xdrawable = d;
+    xgc = new GC(d);
+    init();
+    disposed = false;
+    //setClip(new Rectangle(0, 0, xdrawable.width, xdrawable.height));
+  }
+
+  /**
+   * Draws a pixel in the target coordinate space using the specified color.
+   * 
+   * @param x the x coordinate
+   * @param y the y coordinate
+   */
+  protected void rawSetPixel(int x, int y)
+  {
+    xdrawable.point(xgc, x, y);
+  }
+
+//  protected void rawFillPolygon(double[] xpoints, double[] ypoints, int npoints)
+//  {
+//    Point[] points = new Point[npoints];
+//    for (int n = 0; n < npoints; n++)
+//      {
+//        points[n] = new Point((int) xpoints[n], (int) ypoints[n]);
+//      }
+//    xdrawable.fill_poly(xgc, points, Drawable.COMPLEX, Drawable.ORIGIN);
+//    xdrawable.display.flush();
+//  }
+
+  protected void rawDrawLine(int x0, int y0, int x1, int y1)
+  {
+    xdrawable.line(xgc, x0, y0, x1, y1);
+  }
+
+  protected void rawFillRect(int x, int y, int w, int h)
+  {
+    xdrawable.rectangle(xgc, x, y, w, h, true);
+  }
+
+  protected void rawSetForeground(java.awt.Color c)
+  {
+    if (c != null)
+      xgc.set_foreground(c.getRGB());
+  }
+
+  protected void rawSetForeground(int r, int g, int b)
+  {
+    xgc.set_foreground( r << 16 | g << 8 | b );
+  }
+
+  /**
+   * Returns the color model of this Graphics object.
+   *
+   * @return the color model of this Graphics object
+   */
+  protected ColorModel getColorModel()
+  {
+    return Toolkit.getDefaultToolkit().getColorModel();
+  }
+
+  /**
+   * Returns the color model of the target device.
+   *
+   * @return the color model of the target device
+   */
+  protected ColorModel getDestinationColorModel()
+  {
+    return Toolkit.getDefaultToolkit().getColorModel();
+  }
+
+  /**
+   * Returns the bounds of the target.
+   *
+   * @return the bounds of the target
+   */
+  protected Rectangle getDeviceBounds()
+  {
+    return new Rectangle(0, 0, xdrawable.width, xdrawable.height);
+  }
+
+  public GraphicsConfiguration getDeviceConfiguration()
+  {
+    // FIXME: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented");
+  }
+
+  public void dispose()
+  {
+    if (!disposed)
+      {
+        xgc.free();
+        xdrawable.display.flush();
+        disposed = true;
+      }
+  }
+
+  public Graphics create()
+  {
+    // super.create() returns a copy created by clone(), so it should
+    // be a XGraphics2D.
+    XGraphics2D copy = (XGraphics2D) super.create();
+    copy.xgc = xgc.copy();
+    return copy;
+  }
+
+//  /**
+//   * Draws the specified image on the drawable at position (x,y).
+//   */
+//
+//  public boolean drawImage(Image image, int x, int y, ImageObserver observer)
+//  {
+//    AffineTransform transform = getTransform();
+//    int translateX = (int) transform.getTranslateX();
+//    int translateY = (int) transform.getTranslateY();
+//    if (image instanceof XImage)
+//      {
+//        XImage xim = (XImage) image;
+//        Pixmap pm = xim.pixmap;
+//        xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
+//                            x + translateX, y + translateY);
+//      }
+//    else if (image instanceof BufferedImage)
+//      {
+//        BufferedImage bufferedImage = (BufferedImage) image;
+//        Raster raster = bufferedImage.getData();
+//        int w = bufferedImage.getWidth();
+//        int h = bufferedImage.getHeight();
+//        // Push data to X server.
+//        ZPixmap zPixmap = new ZPixmap(xdrawable.display, w, h,
+//                                      xdrawable.display.default_pixmap_format);
+//        System.err.println("data buffer length: " + zPixmap.data.length);
+//        int[] pixel = new int[4];
+//        for (int tx = 0; tx < w; tx++)
+//          {
+//            for (int ty = 0; ty < h; ty++)
+//              {
+//                pixel = raster.getPixel(tx, ty, pixel);
+////                System.err.print("r: " + pixel[0]);
+////                System.err.print(", g: " + pixel[1]);
+////                System.err.println(", b: " + pixel[2]);
+//                zPixmap.set_red(tx, ty, pixel[0]);
+//                zPixmap.set_green(tx, ty, pixel[1]);
+//                zPixmap.set_blue(tx, ty, pixel[2]);
+//              }
+//          }
+//        xdrawable.put_image(xgc, zPixmap, x, y);
+//      }
+//    else
+//      {
+//        throw new UnsupportedOperationException("Not yet implemented.");
+//      }
+//    return true;
+//  }
+//
+  public void setClip(Shape c)
+  {
+    super.setClip(c);
+    if (c instanceof Rectangle)
+      {
+        Rectangle r = (Rectangle) c;
+        AffineTransform t = getTransform();
+        int translateX = (int) t.getTranslateX();
+        //System.err.println("translateX: " + translateX);
+        int translateY = (int) t.getTranslateY();
+        //System.err.println("translateY: " + translateY);
+        //System.err.println("clip: " + c);
+        gnu.x11.Rectangle clip = new gnu.x11.Rectangle(r.x, r.y, r.width,
+                                                       r.height);
+        xgc.set_clip_rectangles(translateX, translateY,
+                                new gnu.x11.Rectangle[]{clip}, GC.UN_SORTED);
+      }
+  }
+
+  /**
+   * Notifies the backend that the raster has changed in the specified
+   * rectangular area. The raster that is provided in this method is always
+   * the same as the one returned in {@link #getDestinationRaster}.
+   * Backends that reflect changes to this raster directly don't need to do
+   * anything here.
+   *
+   * @param raster the updated raster, identical to the raster returned
+   *        by {@link #getDestinationRaster()}
+   * @param x the upper left corner of the updated region, X coordinate
+   * @param y the upper lef corner of the updated region, Y coordinate
+   * @param w the width of the updated region
+   * @param h the height of the updated region
+   */
+  protected void updateRaster(Raster raster, int x, int y, int w, int h)
+  {
+    if (w > 0 && h > 0)
+      {
+        ZPixmap zPixmap = new ZPixmap(xdrawable.display, w, h,
+                                      xdrawable.display.default_pixmap_format);
+        int[] pixel = null;
+        int x1 = x + w;
+        int y1 = y + h;
+        for (int tx = x; tx < x1; tx++)
+          {
+            for (int ty = y; ty < y1; ty++)
+              {
+                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);
+      }
+  }
+
+
+  protected void init()
+  {
+    super.init();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* XGraphicsConfiguration.java -- GraphicsConfiguration for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.VolatileImage;
+
+public class XGraphicsConfiguration
+    extends GraphicsConfiguration
+{
+
+  XGraphicsDevice device;
+
+  XGraphicsConfiguration(XGraphicsDevice dev)
+  {
+    device = dev;
+  }
+
+  public GraphicsDevice getDevice()
+  {
+    return device;
+  }
+
+  public BufferedImage createCompatibleImage(int w, int h)
+  {
+    return new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+  }
+
+  public VolatileImage createCompatibleVolatileImage(int w, int h)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public VolatileImage createCompatibleVolatileImage(int width, int height,
+                                                     int transparency)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public BufferedImage createCompatibleImage(int w, int h, int transparency)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public ColorModel getColorModel()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public ColorModel getColorModel(int transparency)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public AffineTransform getDefaultTransform()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public AffineTransform getNormalizingTransform()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public Rectangle getBounds()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsDevice.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,166 @@
+/* XGraphicsDevice.java -- GraphicsDevice for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import gnu.classpath.SystemProperties;
+import gnu.java.net.local.LocalSocket;
+import gnu.java.net.local.LocalSocketAddress;
+import gnu.x11.Connection;
+import gnu.x11.Display;
+
+import java.awt.AWTError;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.net.SocketException;
+
+/**
+ * This class represents an X Display. The actual connection is established
+ * lazily when it is first needed.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class XGraphicsDevice
+  extends GraphicsDevice
+{
+
+  private XGraphicsConfiguration defaultConfiguration;
+
+  /**
+   * The X display associated with the XGraphicsDevice. This is established
+   * when {@link #getDisplay} is first called.
+   */
+  private Display display;
+
+  /**
+   * The display name from which the display will be initialized.
+   */
+  private Display.Name displayName;
+
+  /**
+   * The event pump for this X Display.
+   */
+  private XEventPump eventPump;
+
+  /**
+   * Creates a new XGraphicsDevice.
+   */
+  XGraphicsDevice(Display.Name dn)
+  {
+    displayName = dn;
+  }
+
+  public int getType()
+  {
+    return TYPE_RASTER_SCREEN;
+  }
+
+  public String getIDstring()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public GraphicsConfiguration[] getConfigurations()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public GraphicsConfiguration getDefaultConfiguration()
+  {
+    if (defaultConfiguration == null)
+      defaultConfiguration = new XGraphicsConfiguration(this);
+    return defaultConfiguration;
+  }
+
+  /**
+   * Returns the X Display associated with this XGraphicsDevice.
+   * This establishes the connection to the X server on the first invocation.
+   *
+   * @return the X Display associated with this XGraphicsDevice
+   */
+  Display getDisplay()
+  {
+    if (display == null)
+      {
+        if (displayName.hostname.equals(""))
+          displayName.hostname = "localhost";
+        if (XToolkit.DEBUG)
+          System.err.println("connecting to : " + displayName);
+        // Try to connect via unix domain sockets when host == localhost.
+        if ((displayName.hostname.equals("localhost")
+             || displayName.hostname.equals(""))
+          && SystemProperties.getProperty("gnu.xawt.no_local_sockets") == null)
+          {
+            // TODO: Is this 100% ok?
+            String sockPath = "/tmp/.X11-unix/X" + displayName.display_no;
+            LocalSocketAddress addr = new LocalSocketAddress(sockPath);
+            try
+              {
+                if (XToolkit.DEBUG)
+                  System.err.println("connecting to local socket: "
+                                     + sockPath);
+                LocalSocket socket = new LocalSocket(addr);
+                display = new Display(socket, "localhost",
+                                      displayName.display_no,
+                                      displayName.screen_no);
+                display.connection.send_mode = Connection.ASYNCHRONOUS;
+                if (XToolkit.DEBUG)
+                  System.err.println("connected to local socket");
+              }
+            catch (SocketException ex)
+              {
+                AWTError err = new AWTError("could not connect to X server");
+                err.initCause(ex);
+                throw err;
+              }
+          }
+        else
+          {
+            display = new Display(displayName);
+          }
+        eventPump = new XEventPump(display);
+      }
+    return display;
+  }
+
+  XEventPump getEventPump()
+  {
+    return eventPump;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,202 @@
+/* XGraphicsEnvironment.java -- Represents the X environment
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import gnu.java.awt.java2d.RasterGraphics;
+import gnu.x11.Display;
+
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Locale;
+import java.util.Properties;
+
+/**
+ * Represents the X environment for AWT.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+public class XGraphicsEnvironment
+  extends GraphicsEnvironment
+{
+
+  /**
+   * The default graphics device. This is normally the local main X
+   * Display, but can be configured to be any X connection.
+   */
+  private XGraphicsDevice defaultDevice;
+
+  /**
+   * All configured devices.
+   */
+  private XGraphicsDevice[] devices;
+
+  /**
+   * Creates a new XGraphicsEnvironment. This loads the configuration if
+   * there is one present and initializes the XGraphicsDevices in the
+   * environment. If there is no configuration, then there is one
+   * default device initialized with the local main X device.
+   */
+  public XGraphicsEnvironment()
+  {
+    // Initiliaze the devices.
+    Properties props = new Properties();
+    File config = new File(System.getProperty("user.home"),
+                           ".xawt.properties");
+
+    try
+      {
+        FileInputStream configIn = new FileInputStream(config);
+        props.load(configIn);
+        int dev = 1;
+        ArrayList deviceList = new ArrayList();
+        while (true)
+          {
+            String propName = "display." + dev;
+            String propValue = props.getProperty(propName);
+            if (propValue != null)
+              {
+                Display.Name displayName = new Display.Name(propValue);
+                XGraphicsDevice device = new XGraphicsDevice(displayName);
+                if (dev == 1)
+                  defaultDevice = device;
+                deviceList.add(device);
+                dev++;
+              }
+            else
+              {
+                if (dev == 1)
+                  {
+                    defaultDevice = initDefaultDevice();
+                    deviceList.add(defaultDevice);
+                  }
+                break;
+              }
+          }
+        devices = (XGraphicsDevice[]) deviceList.toArray
+                                      (new XGraphicsDevice[deviceList.size()]);
+      }
+    catch (FileNotFoundException ex)
+      {
+        defaultDevice = initDefaultDevice();
+        devices = new XGraphicsDevice[]{ defaultDevice };
+      }
+    catch (IOException ex)
+      {
+        defaultDevice = initDefaultDevice();
+        devices = new XGraphicsDevice[]{ defaultDevice };
+      }
+    
+  }
+
+  /**
+   * Helper method that initializes the default device in the case when there
+   * is no configuration for the default.
+   */
+  private XGraphicsDevice initDefaultDevice()
+  {
+    String display = System.getenv("DISPLAY");
+    if (display == null)
+      display = ":0.0";
+    Display.Name displayName = new Display.Name(display);
+    return new XGraphicsDevice(displayName);
+  }
+
+  /**
+   * Returns all configured screen devices.
+   *
+   * @return all configured screen devices
+   */
+  public GraphicsDevice[] getScreenDevices()
+  {
+    // We return a copy so that nobody can fiddle with our devices.
+    XGraphicsDevice[] copy = new XGraphicsDevice[devices.length];
+    System.arraycopy(devices, 0, copy, 0, devices.length);
+    return copy;
+  }
+
+  /**
+   * Returns the default screen device.
+   *
+   * @return the default screen device
+   */
+  public GraphicsDevice getDefaultScreenDevice()
+  {
+    return defaultDevice;
+  }
+
+  /**
+   * Returns a Graphics instance suitable for drawing on top of the
+   * BufferedImage.
+   *
+   * @param image the buffered image to create a graphics for
+   *
+   * @return a Graphics2D instance for drawing on the BufferedImage
+   */
+  public Graphics2D createGraphics(BufferedImage image)
+  {
+    return new RasterGraphics(image.getRaster(), image.getColorModel());
+  }
+
+  public Font[] getAllFonts()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public String[] getAvailableFontFamilyNames()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public String[] getAvailableFontFamilyNames(Locale l)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XImage.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XImage.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XImage.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XImage.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,111 @@
+/* XImage.java -- Image impl for X Pixmaps
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import gnu.x11.Pixmap;
+
+import java.awt.Graphics;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.util.Hashtable;
+
+public class XImage
+  extends Image
+{
+
+  Pixmap pixmap;
+
+  private Hashtable properties;
+
+  XImage(int w, int h)
+  {
+    GraphicsEnvironment env =
+      GraphicsEnvironment.getLocalGraphicsEnvironment();
+    XGraphicsDevice dev = (XGraphicsDevice) env.getDefaultScreenDevice();
+    pixmap = new Pixmap(dev.getDisplay(), w, h);
+  }
+
+  public int getWidth(ImageObserver observer)
+  {
+    return pixmap.width;
+  }
+
+  public int getHeight(ImageObserver observer)
+  {
+    return pixmap.height;
+  }
+
+  public ImageProducer getSource()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Creates an XGraphics for drawing on this XImage.
+   *
+   * @return an XGraphics for drawing on this XImage
+   */
+  public Graphics getGraphics()
+  {
+    XGraphics g = new XGraphics(pixmap);
+    return g;
+  }
+
+  public Object getProperty(String name, ImageObserver observer)
+  {
+    Object val = null;
+    if (properties != null)
+      val = properties.get(val);
+    return val;
+  }
+
+  public void flush()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected void finalize()
+  {
+    pixmap.free();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XLightweightPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XLightweightPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XLightweightPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XLightweightPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* XLightweightPeer.java -- A lightweight peer for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Component;
+import java.awt.peer.LightweightPeer;
+
+import gnu.java.awt.peer.swing.SwingContainerPeer;
+
+public class XLightweightPeer
+  extends SwingContainerPeer
+  implements LightweightPeer
+{
+
+  XLightweightPeer(Component c)
+  {
+    super(c);
+    init(c, null);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,608 @@
+/* XToolkit.java -- The central AWT Toolkit for the X peers
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.AWTException;
+import java.awt.Button;
+import java.awt.Canvas;
+import java.awt.Checkbox;
+import java.awt.CheckboxMenuItem;
+import java.awt.Choice;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.FileDialog;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.Label;
+import java.awt.List;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.PrintJob;
+import java.awt.ScrollPane;
+import java.awt.Scrollbar;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.Transparency;
+import java.awt.Window;
+import java.awt.datatransfer.Clipboard;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.im.InputMethodHighlight;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.peer.ButtonPeer;
+import java.awt.peer.CanvasPeer;
+import java.awt.peer.CheckboxMenuItemPeer;
+import java.awt.peer.CheckboxPeer;
+import java.awt.peer.ChoicePeer;
+import java.awt.peer.DialogPeer;
+import java.awt.peer.FileDialogPeer;
+import java.awt.peer.FontPeer;
+import java.awt.peer.FramePeer;
+import java.awt.peer.LabelPeer;
+import java.awt.peer.LightweightPeer;
+import java.awt.peer.ListPeer;
+import java.awt.peer.MenuBarPeer;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuPeer;
+import java.awt.peer.PanelPeer;
+import java.awt.peer.PopupMenuPeer;
+import java.awt.peer.RobotPeer;
+import java.awt.peer.ScrollPanePeer;
+import java.awt.peer.ScrollbarPeer;
+import java.awt.peer.TextAreaPeer;
+import java.awt.peer.TextFieldPeer;
+import java.awt.peer.WindowPeer;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.WeakHashMap;
+
+import javax.imageio.ImageIO;
+
+import gnu.classpath.SystemProperties;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.EmbeddedWindow;
+import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.java.awt.peer.EmbeddedWindowPeer;
+import gnu.java.awt.peer.swing.SwingCanvasPeer;
+import gnu.java.awt.peer.swing.SwingLabelPeer;
+import gnu.java.awt.peer.swing.SwingPanelPeer;
+
+public class XToolkit
+  extends ClasspathToolkit
+{
+
+  /**
+   * Set to true to enable debug output.
+   */
+  static boolean DEBUG = false;
+
+  /**
+   * Maps AWT colors to X colors.
+   */
+  HashMap colorMap = new HashMap();
+
+  /**
+   * The system event queue.
+   */
+  private EventQueue eventQueue;
+
+  /**
+   * The default color model of this toolkit.
+   */
+  private ColorModel colorModel;
+
+  /**
+   * Maps image URLs to Image instances.
+   */
+  private HashMap imageCache = new HashMap();
+
+  /**
+   * The cached fonts.
+   */
+  private WeakHashMap fontCache = new WeakHashMap();
+
+  public XToolkit()
+  {
+    SystemProperties.setProperty("gnu.javax.swing.noGraphics2D", "true");
+    SystemProperties.setProperty("java.awt.graphicsenv",
+                                 "gnu.java.awt.peer.x.XGraphicsEnvironment");
+  }
+
+  public GraphicsEnvironment getLocalGraphicsEnvironment()
+  {
+    return new XGraphicsEnvironment();
+  }
+
+  /**
+   * Returns the font peer for a font with the specified name and attributes.
+   *
+   * @param name the font name
+   * @param attrs the font attributes
+   *
+   * @return the font peer for a font with the specified name and attributes
+   */
+  public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs)
+  {
+    String canonical = XFontPeer.encodeFont(name, attrs);
+    ClasspathFontPeer font;
+    if (!fontCache.containsKey(canonical))
+      {
+        String graphics2d =
+          SystemProperties.getProperty("gnu.xawt.graphics2d");
+        if (graphics2d != null && graphics2d.equals("gl"))
+          font = new XFontPeer2(name, attrs);
+        else
+          font = new XFontPeer(name, attrs);
+        fontCache.put(canonical, font);
+      }
+    else
+      {
+        font = (ClasspathFontPeer) fontCache.get(canonical);
+      }
+    return font;
+  }
+
+  public Font createFont(int format, InputStream stream)
+  {
+    return null;
+  }
+
+  public RobotPeer createRobot(GraphicsDevice screen) throws AWTException
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public EmbeddedWindowPeer createEmbeddedWindow(EmbeddedWindow w)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected ButtonPeer createButton(Button target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected TextFieldPeer createTextField(TextField target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected LabelPeer createLabel(Label target)
+  {
+    return new SwingLabelPeer(target);
+  }
+
+  protected ListPeer createList(List target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected CheckboxPeer createCheckbox(Checkbox target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected ScrollbarPeer createScrollbar(Scrollbar target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected ScrollPanePeer createScrollPane(ScrollPane target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected TextAreaPeer createTextArea(TextArea target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected ChoicePeer createChoice(Choice target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected FramePeer createFrame(Frame target)
+  {
+    XFramePeer frame = new XFramePeer(target);
+    return frame;
+  }
+
+  protected CanvasPeer createCanvas(Canvas target)
+  {
+    return new SwingCanvasPeer(target);
+  }
+
+  protected PanelPeer createPanel(Panel target)
+  {
+    return new SwingPanelPeer(target);
+  }
+
+  protected WindowPeer createWindow(Window target)
+  {
+    return new XWindowPeer(target);
+  }
+
+  protected DialogPeer createDialog(Dialog target)
+  {
+    return new XDialogPeer(target);
+  }
+
+  protected MenuBarPeer createMenuBar(MenuBar target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected MenuPeer createMenu(Menu target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected PopupMenuPeer createPopupMenu(PopupMenu target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected MenuItemPeer createMenuItem(MenuItem target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected FileDialogPeer createFileDialog(FileDialog target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  protected FontPeer getFontPeer(String name, int style)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public Dimension getScreenSize()
+  {
+    // FIXME: This is only a hack to get some apps working.
+    return new Dimension(1024, 768);
+  }
+
+  public int getScreenResolution()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Returns the color model used by this toolkit.
+   *
+   * @return the color model used by this toolkit
+   */
+  public ColorModel getColorModel()
+  {
+    // TODO: I assume 24 bit depth here, we can do this better.
+    if (colorModel == null)
+      colorModel = new DirectColorModel(24, 0xFF0000, 0xFF00, 0xFF);
+    return colorModel;
+  }
+
+  public String[] getFontList()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public FontMetrics getFontMetrics(Font name)
+  {
+    ClasspathFontPeer peer = (ClasspathFontPeer) name.getPeer();
+    return peer.getFontMetrics(name);
+  }
+
+  public void sync()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Returns an image that has its pixel data loaded from a file with the
+   * specified name. If that file doesn't exist, an empty or error image
+   * is returned instead.
+   *
+   * @param name the filename of the file that contains the pixel data
+   *
+   * @return the image
+   */
+  public Image getImage(String name)
+  {
+    Image image;
+    try
+      {
+        File file = new File(name);
+        image = getImage(file.toURL());
+      }
+    catch (MalformedURLException ex)
+      {
+        // TODO: Replace by a more meaningful error image instead.
+        image = null;
+      }
+    return image;
+  }
+
+  /**
+   * Returns an image that has its pixel data loaded from the specified URL.
+   * If the image cannot be loaded for some reason, an empty or error image
+   * is returned instead.
+   *
+   * @param url the URL to the image data
+   *
+   * @return the image
+   */
+  public Image getImage(URL url)
+  {
+    Image image;
+    if (imageCache.containsKey(url))
+      {
+        image = (Image) imageCache.get(url);
+      }
+    else
+      {
+        image = createImage(url);
+        imageCache.put(url, image);
+      }
+    return image;
+  }
+
+  /**
+   * Returns an image that has its pixel data loaded from a file with the
+   * specified name. If that file doesn't exist, an empty or error image
+   * is returned instead.
+   *
+   * @param filename the filename of the file that contains the pixel data
+   *
+   * @return the image
+   */
+  public Image createImage(String filename)
+  {
+    Image im;
+    try
+      {
+        File file = new File(filename);
+        URL url = file.toURL();
+        im = createImage(url);
+      }
+    catch (MalformedURLException ex)
+      {
+        im = createErrorImage();
+      }
+    return im;
+  }
+
+  /**
+   * Returns an image that has its pixel data loaded from the specified URL.
+   * If the image cannot be loaded for some reason, an empty or error image
+   * is returned instead.
+   *
+   * @param url the URL to the image data
+   *
+   * @return the image
+   */
+  public Image createImage(URL url)
+  {
+    Image image;
+    try
+      {
+        image = createImage(url.openStream());
+      }
+    catch (IOException ex)
+      {
+        image = createErrorImage();
+      }
+    return image;
+  }
+
+  /**
+   * Creates an image that is returned when calls to createImage() yields an
+   * error.
+   * 
+   * @return an image that is returned when calls to createImage() yields an
+   *         error
+   */
+  private Image createErrorImage()
+  {
+    // TODO: Create better error image.
+    return new XImage(1, 1);
+  }
+
+  public boolean prepareImage(Image image, int width, int height, ImageObserver observer)
+  {
+    // Images are loaded synchronously, so we don't bother and return true.
+    return true;
+  }
+
+  public int checkImage(Image image, int width, int height, ImageObserver observer)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public Image createImage(ImageProducer producer)
+  {
+    ImageConverter conv = new ImageConverter();
+    producer.startProduction(conv);
+    Image image = conv.getXImage();
+    return image;
+  }
+
+  public Image createImage(byte[] data, int offset, int len)
+  {
+    Image image;
+    try
+      {
+        ByteArrayInputStream i = new ByteArrayInputStream(data, offset, len);
+        image = createImage(i);
+      }
+    catch (IOException ex)
+      {
+        image = createErrorImage();
+      }
+    return image;
+  }
+
+  private Image createImage(InputStream i)
+    throws IOException
+  {
+    Image image;
+    BufferedImage buffered = ImageIO.read(i);
+    // If the bufferedimage is opaque, then we can copy it over to an
+    // X Pixmap for faster drawing.
+    if (buffered != null && buffered.getTransparency() == Transparency.OPAQUE)
+      {
+        ImageProducer source = buffered.getSource();
+        image = createImage(source);
+      }
+    else if (buffered != null)
+      {
+        image = buffered;
+      }
+    else
+      {
+        image = createErrorImage();
+      }
+    return image;
+  }
+
+  public PrintJob getPrintJob(Frame frame, String title, Properties props)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public void beep()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public Clipboard getSystemClipboard()
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Returns the eventqueue used by the XLib peers.
+   *
+   * @return the eventqueue used by the XLib peers
+   */
+  protected EventQueue getSystemEventQueueImpl()
+  {
+    if (eventQueue == null)
+      eventQueue = new EventQueue();
+    return eventQueue;
+  }
+
+  public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+  {
+    // TODO: Implement this.
+    throw new UnsupportedOperationException("Not yet implemented.");
+  }
+
+  /**
+   * Helper method to quickly fetch the default device (X Display).
+   *
+   * @return the default XGraphicsDevice
+   */
+  static XGraphicsDevice getDefaultDevice()
+  {
+    XGraphicsEnvironment env = (XGraphicsEnvironment)
+      XGraphicsEnvironment.getLocalGraphicsEnvironment();
+    return (XGraphicsDevice) env.getDefaultScreenDevice();
+  }
+
+  protected LightweightPeer createComponent(Component c)
+  {
+    return new XLightweightPeer(c);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,255 @@
+/* XWindowPeer.java -- Window peer for X
+   Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.PaintEvent;
+import java.awt.event.WindowEvent;
+
+import gnu.x11.Window;
+import gnu.x11.event.Event;
+
+import gnu.java.awt.peer.swing.SwingWindowPeer;
+
+public class XWindowPeer
+    extends SwingWindowPeer
+{
+
+  private static int standardSelect = Event.BUTTON_PRESS_MASK
+                                      | Event.BUTTON_RELEASE_MASK
+                                      | Event.POINTER_MOTION_MASK
+                                      //| Event.RESIZE_REDIRECT_MASK
+                                      | Event.EXPOSURE_MASK
+                                      //| Event.PROPERTY_CHANGE_MASK
+                                      | Event.STRUCTURE_NOTIFY_MASK
+                                      | Event.KEY_PRESS_MASK
+                                      | Event.KEY_RELEASE_MASK
+                                      ;
+
+  /**
+   * Indicates if we are in callback mode, that is when a property (like size)
+   * is changed in reponse to a request from the X server and doesn't need
+   * to be propagated back to the X server.
+   */
+  boolean callback = false;
+
+  /**
+   * The X window.
+   */
+  private Window xwindow;
+
+  XWindowPeer(java.awt.Window window)
+  {
+    super(window);
+    XGraphicsDevice dev = XToolkit.getDefaultDevice();
+
+    // TODO: Maybe initialize lazily in show().
+    // FIXME: Howto generate a Window without decorations?
+    int x = Math.max(window.getX(), 0);
+    int y = Math.max(window.getY(), 0);
+    int w = Math.max(window.getWidth(), 1);
+    int h = Math.max(window.getHeight(), 1);
+    xwindow = new Window(dev.getDisplay().default_root, x, y, w, h);
+    xwindow.create();
+    xwindow.select_input(standardSelect);
+    dev.getEventPump().registerWindow(xwindow, window);
+  }
+
+  public void toBack()
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void toFront()
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void updateAlwaysOnTop()
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public boolean requestWindowFocus()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  public Point getLocationOnScreen()
+  {
+    return new Point(xwindow.x, xwindow.y);
+  }
+
+  /**
+   * Returns a XGraphics suitable for drawing on this frame.
+   *
+   * @return a XGraphics suitable for drawing on this frame
+   */
+  public Graphics getGraphics()
+  {
+    return new XGraphics(xwindow);
+  }
+
+  public Image createImage(int w, int h)
+  {
+    return new XImage(w, h);
+  }
+
+  /**
+   * Makes the component visible. This is called by {@link Component#show()}.
+   *
+   * This is implemented to call setVisible(true) on the Swing component.
+   */
+  public void show()
+  {
+//    // Prevent ResizeRedirect events.
+//    //xwindow.select_input(noResizeRedirectSelect);
+//    Window.Attributes atts = new Window.Attributes();
+//    atts.set_override_redirect(true);
+//    xwindow.change_attributes(atts);
+
+    // Prevent ResizeRedirect events.
+    //xwindow.select_input(Event.NO_EVENT_MASK);
+    //xwindow.select_input(noResizeRedirectSelect);
+
+    xwindow.map();
+    EventQueue eq = XToolkit.getDefaultToolkit().getSystemEventQueue();
+    java.awt.Window w = (java.awt.Window) super.awtComponent;
+    eq.postEvent(new WindowEvent(w, WindowEvent.WINDOW_OPENED));
+    eq.postEvent(new PaintEvent(w, PaintEvent.PAINT,
+                                new Rectangle(0, 0, w.getWidth(),
+                                              w.getHeight())));
+
+//    // Reset input selection.
+//    atts.set_override_redirect(false);
+//    xwindow.change_attributes(atts);
+  }
+
+  /**
+   * Makes the component invisible. This is called from
+   * {@link Component#hide()}.
+   *
+   * This is implemented to call setVisible(false) on the Swing component.
+   */
+  public void hide()
+  {
+    xwindow.unmap();
+  }
+
+  /**
+   * Notifies the peer that the bounds of this component have changed. This
+   * is called by {@link Component#reshape(int, int, int, int)}.
+   *
+   * This is implemented to call setBounds() on the Swing component.
+   *
+   * @param x the X coordinate of the upper left corner of the component
+   * @param y the Y coordinate of the upper left corner of the component
+   * @param width the width of the component
+   * @param height the height of the component
+   */
+  public void reshape(int x, int y, int width, int height)
+  {
+    // Prevent ResizeRedirect events.
+//    //xwindow.select_input(noResizeRedirectSelect);
+//    Window.Attributes atts = new Window.Attributes();
+//    atts.set_override_redirect(true);
+//    xwindow.change_attributes(atts);
+
+    // Need to substract insets because AWT size is including insets,
+    // and X size is excuding insets.
+    Insets i = insets();
+    xwindow.move_resize(x - i.left, y - i.right, width - i.left - i.right,
+                        height - i.top - i.bottom);
+
+    // Reset input selection.
+//    atts = new Window.Attributes();
+//    atts.set_override_redirect(false);
+//    xwindow.change_attributes(atts);
+  }
+
+  public Insets insets()
+  {
+    Insets i = new Insets(0, 0, 0, 0);
+//    Window.GeometryReply g = xwindow.geometry();
+//    int b = g.border_width();
+//    Insets i = new Insets(b, b, b, b);
+//    Window.WMSizeHints wmSize = xwindow.wm_normal_hints();
+//    if (wmSize != null)
+//      {
+//        i.left = wmSize.x() - g.x();
+//        i.right = wmSize.width() - g.width() - i.left ;
+//        i.top = wmSize.y() - g.y();
+//        i.bottom = wmSize.height() - g.height() - i.top;
+//      }
+//    System.err.println("insets: " + i);
+    return i;
+  }
+
+  /**
+   * Returns the font metrics for the specified font.
+   *
+   * @return the font metrics for the specified font
+   */
+  public FontMetrics getFontMetrics(Font font)
+  {
+    XFontPeer fontPeer = (XFontPeer) font.getPeer();
+    return fontPeer.getFontMetrics(font);
+  }
+
+  /**
+   * Unregisters the window in the event pump when it is closed.
+   */
+  protected void finalize()
+  {
+    XGraphicsDevice dev = XToolkit.getDefaultDevice();
+    dev.getEventPump().unregisterWindow(xwindow);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterGraphics.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,518 @@
+/* JavaPrinterGraphics.java -- AWT printer rendering class.
+   Copyright (C) 2006  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 gnu.java.awt.print;
+
+import gnu.java.awt.peer.gtk.CairoSurface;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+import java.awt.image.PixelGrabber;
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterGraphics;
+import java.awt.print.PrinterJob;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.text.AttributedCharacterIterator;
+
+/**
+ * Graphics context to draw to PostScript.
+ *
+ * @author Sven de Marothy
+ */
+public class JavaPrinterGraphics extends Graphics implements PrinterGraphics
+{
+
+  /**
+   * The used graphics context.
+   */
+  private Graphics g;
+
+  /**
+   * The associated printer job.
+   */
+  private PrinterJob printerJob;
+
+  /**
+   * Rendering resolution
+   */
+  private static final double DPI = 72.0;
+
+  /**
+   * Rendered image size.
+   */
+  private int xSize, ySize;
+
+  /**
+   * The image to render to.
+   */
+  private Image image;
+
+  public JavaPrinterGraphics( PrinterJob printerJob )
+  {
+    this.printerJob = printerJob;
+  }
+
+  /**
+   * Spool a document to PostScript.
+   * If Pageable is non-null, it will print that, otherwise it will use
+   * the supplied printable and pageFormat.
+   */
+  public SpooledDocument spoolPostScript(Printable printable, 
+					 PageFormat pageFormat,
+					 Pageable pageable)
+    throws PrinterException
+  {
+    try 
+      {
+	// spool to a temporary file
+	File temp = File.createTempFile("cpspool", ".ps");
+	temp.deleteOnExit();
+	
+	PrintWriter out = new PrintWriter
+	  (new BufferedWriter
+	    (new OutputStreamWriter
+	     (new FileOutputStream(temp), "ISO8859_1"), 1000000));
+
+	writePSHeader(out);
+	
+	if(pageable != null)
+	  {
+	    for(int index = 0; index < pageable.getNumberOfPages(); index++)
+	      spoolPage(out, pageable.getPrintable(index),
+			pageable.getPageFormat(index), index);
+	  }
+	else
+	  {
+	    int index = 0;
+	    while(spoolPage(out, printable, pageFormat, index++) ==
+		  Printable.PAGE_EXISTS);
+	  }
+	 out.println("%%Trailer");
+	 out.println("%%EOF");
+	 out.close();
+	 return new SpooledDocument( temp );
+       } 
+    catch (IOException e) 
+      {
+	PrinterException pe = new PrinterException();
+	pe.initCause(e);
+	throw pe;
+      }
+  }
+
+  /**
+   * Spools a single page, returns NO_SUCH_PAGE unsuccessful,
+   * PAGE_EXISTS if it was.
+   */
+  public int spoolPage(PrintWriter out,
+		       Printable printable, 
+		       PageFormat pageFormat, 
+		       int index) throws IOException, PrinterException
+  {
+    initImage( pageFormat );
+    if(printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE)
+      return Printable.NO_SUCH_PAGE;
+    g.dispose();
+    g = null;
+    writePage( out, pageFormat );
+    return Printable.PAGE_EXISTS;
+  }
+  
+  private void initImage(PageFormat pageFormat)
+  {
+    // Create a really big image and draw to that.
+    xSize = (int)(DPI*pageFormat.getWidth()/72.0);
+    ySize = (int)(DPI*pageFormat.getHeight()/72.0);
+    
+    // Swap X and Y sizes if it's a Landscape page.
+    if( pageFormat.getOrientation() != PageFormat.PORTRAIT )
+      {
+	int t = xSize;
+	xSize = ySize;
+	ySize = t;
+      }
+
+    // FIXME: This should at least be BufferedImage. 
+    // Fix once we have a working B.I.
+    // Graphics2D should also be supported of course.
+    image = CairoSurface.getBufferedImage(xSize, ySize);
+
+    g = image.getGraphics();
+    setColor(Color.white);
+    fillRect(0, 0, xSize, ySize);
+    setColor(Color.black);
+  }
+
+  private void writePSHeader(PrintWriter out)
+  {
+    out.println("%!PS-Adobe-3.0");      
+    out.println("%%Title: "+printerJob.getJobName());
+    out.println("%%Creator: GNU Classpath ");
+    out.println("%%DocumentData: Clean8Bit");
+
+    out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier");
+    //    out.println("%%Pages: "+);  // FIXME # pages.
+    out.println("%%EndComments");
+    
+    out.println("%%BeginProlog");
+    out.println("%%EndProlog");
+    out.println("%%BeginSetup");
+    
+    // FIXME: Paper name
+    // E.g. "A4" "Letter"
+    //    out.println("%%BeginFeature: *PageSize A4");
+    
+    out.println("%%EndFeature");
+
+    out.println("%%EndSetup");
+    
+    //    out.println("%%Page: 1 1");
+  }
+
+  private void writePage(PrintWriter out, PageFormat pageFormat)
+  {
+    out.println("%%BeginPageSetup");
+
+    Paper p = pageFormat.getPaper();
+    double pWidth = p.getWidth();
+    double pHeight = p.getHeight();
+
+    if( pageFormat.getOrientation() == PageFormat.PORTRAIT )
+      out.println( "%%Orientation: Portrait" );
+    else
+      {
+	out.println( "%%Orientation: Landscape" );
+	double t = pWidth;
+	pWidth = pHeight;
+	pHeight = t;
+      }
+      
+    out.println("gsave % first save");
+    
+    // 595x842; 612x792 respectively
+    out.println("<< /PageSize [" +pWidth + " "+pHeight+ "] >> setpagedevice");
+
+    // invert the Y axis so that we get screen-like coordinates instead.
+    AffineTransform pageTransform = new AffineTransform();
+    if( pageFormat.getOrientation() == PageFormat.REVERSE_LANDSCAPE )
+      {
+	pageTransform.translate(pWidth, pHeight);
+	pageTransform.scale(-1.0, -1.0);
+      }
+    concatCTM(out, pageTransform);
+    out.println("%%EndPageSetup");
+
+    out.println("gsave");
+
+
+    // Draw the image
+    out.println(xSize+" "+ySize+" 8 [1 0 0 -1 0 "+ySize+" ]"); 
+    out.println("{currentfile 3 string readhexstring pop} bind");
+    out.println("false 3 colorimage");
+    int[] pixels = new int[xSize * ySize];
+    PixelGrabber pg = new PixelGrabber(image, 0, 0, xSize, ySize, pixels, 0, xSize);
+
+    try {
+      pg.grabPixels();
+    } catch (InterruptedException e) {
+      out.println("% Bug getting pixels!");
+    }
+
+    int n = 0;
+    for (int j = 0; j < ySize; j++) {
+      for (int i = 0; i < xSize; i++) {
+	out.print( colorTripleHex(pixels[j * xSize + i]) );
+	if(((++n)%11) == 0) out.println();
+      }
+    }
+    
+    out.println();
+    out.println("%%EOF");
+    out.println("grestore");
+    out.println("showpage");
+  }
+  
+  /**
+   * Get a nonsperated hex RGB triple, e.g. FFFFFF = white 
+   */
+  private String colorTripleHex(int num){
+    String s = "";
+
+    try {
+      s = Integer.toHexString( ( num & 0x00FFFFFF ) );
+      if( s.length() < 6 )
+	{
+	  s = "000000"+s;
+	  return s.substring(s.length()-6);
+	}
+    } catch (Exception e){
+      s = "FFFFFF";
+    }
+
+    return s;
+  }
+
+  private void concatCTM(PrintWriter out, AffineTransform Tx){
+    double[] matrixElements = new double[6];
+    Tx.getMatrix(matrixElements);
+    
+    out.print("[ ");
+    for(int i=0;i<6;i++)
+      out.print(matrixElements[i]+" ");
+    out.println("] concat");
+  }
+
+  //-----------------------------------------------------------------------------
+  /**
+   * PrinterGraphics method - Returns the printer job associated with this object.
+   */
+  public PrinterJob getPrinterJob()
+  {
+    return printerJob;
+  }
+
+  /**
+   * The rest of the methods here are just pass-throughs to g.
+   */
+  public void clearRect(int x, int y, int width, int height)
+  {
+    g.clearRect(x, y, width, height);
+  }
+
+  public void clipRect(int x, int y, int width, int height)
+  {
+    g.clipRect(x, y, width, height);
+  }
+
+  public void copyArea(int x, int y, int width, int height, int dx, int dy)
+  {
+    g.copyArea(x, y, width, height, dx, dy);
+  }
+
+  public Graphics create()
+  {
+    return g.create();
+  }
+
+  public void dispose()
+  {
+  }
+
+  public void drawArc(int x, int y, int width, int height, int startAngle, 
+		      int arcAngle)
+  {
+    g.drawArc(x, y, width, height, startAngle, arcAngle);
+  }
+
+  public boolean drawImage(Image img, int x, int y, Color bgcolor, 
+			   ImageObserver observer)
+  {
+    return g.drawImage(img, x, y, bgcolor, observer);
+  }
+
+  public boolean drawImage(Image img, int x, int y, ImageObserver observer)
+  {
+    return g.drawImage(img, x, y, observer);
+  }
+
+  public boolean drawImage(Image img, int x, int y, int width, int height, 
+			   Color bgcolor, ImageObserver observer)
+  {
+    return g.drawImage(img, x, y, width, height, bgcolor, observer);
+  }
+
+  public boolean drawImage(Image img, int x, int y, int width, int height, 
+			   ImageObserver observer)
+  {
+    return g.drawImage(img, x, y, width, height, observer);
+  }
+
+  public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, 
+			   int sx1, int sy1, int sx2, int sy2, Color bgcolor, 
+			   ImageObserver observer)
+  {
+    return g.drawImage(img, dx1,  dy1,  dx2,  dy2,  
+		     sx1,  sy1,  sx2,  sy2, bgcolor, observer);
+  }
+
+  public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, 
+			   int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
+  {
+    return g.drawImage(img, dx1,  dy1,  dx2,  dy2,  
+		     sx1,  sy1,  sx2,  sy2, observer);
+  }
+
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    g.drawLine(x1, y1, x2, y2);
+  }
+
+  public void drawOval(int x, int y, int width, int height)
+  {
+    g.drawOval(x, y, width, height);
+  }
+
+  public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    g.drawPolygon(xPoints, yPoints, nPoints);
+  }
+
+  public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    g.drawPolyline(xPoints, yPoints, nPoints);
+  }
+
+  public void drawRoundRect(int x, int y, int width, int height, 
+			    int arcWidth, int arcHeight)
+  {
+    g.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
+  }
+
+  public void drawString(AttributedCharacterIterator iterator, int x, int y)
+  {
+    g.drawString(iterator, x, y);
+  }
+
+  public void drawString(String str, int x, int y)
+  {
+    g.drawString(str, x, y);
+  }
+
+  public void fillArc(int x, int y, int width, int height, 
+		      int startAngle, int arcAngle)
+  {
+    g.fillArc(x, y, width, height, startAngle, arcAngle);
+  }
+
+  public void fillOval(int x, int y, int width, int height)
+  {
+    g.fillOval(x, y, width, height);
+  }
+
+  public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    g.fillPolygon(xPoints, yPoints, nPoints);
+  }
+
+  public void fillRect(int x, int y, int width, int height)
+  {
+    g.fillRect(x, y, width, height);
+  }
+
+  public void fillRoundRect(int x, int y, int width, int height, 
+			    int arcWidth, int arcHeight)
+  {
+    g.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
+  }
+
+  public Shape getClip()
+  {
+    return g.getClip();
+  }
+
+  public Rectangle getClipBounds()
+  {
+    return g.getClipBounds();
+  }
+
+  public Color getColor()
+  {
+    return g.getColor();
+  }
+
+  public Font getFont()
+  {
+    return g.getFont();
+  }
+
+  public FontMetrics getFontMetrics(Font f)
+  {
+    return g.getFontMetrics(f);
+  }
+
+  public void setClip(int x, int y, int width, int height)
+  {
+    g.setClip(x, y, width, height);
+  }
+
+  public void setClip(Shape clip)
+  {
+    g.setClip(clip);
+  }
+
+  public void setColor(Color c)
+  {
+    g.setColor(c);
+  }
+
+  public void setFont(Font font)
+  {
+    g.setFont(font);
+  }
+
+  public void setPaintMode()
+  {
+    g.setPaintMode();
+  }
+
+  public void setXORMode(Color c1)
+  {
+    g.setXORMode(c1);
+  }
+
+  public void translate(int x, int y)
+  {
+    g.translate(x, y);
+  }
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/JavaPrinterJob.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,403 @@
+/* JavaPrinterJob.java -- AWT printing implemented on javax.print.
+   Copyright (C) 2006  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 gnu.java.awt.print;
+
+import java.awt.HeadlessException;
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.util.Locale;
+
+import javax.print.CancelablePrintJob;
+import javax.print.DocFlavor;
+import javax.print.DocPrintJob;
+import javax.print.PrintException;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.ServiceUI;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.IntegerSyntax;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.TextSyntax;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.JobName;
+import javax.print.attribute.standard.OrientationRequested;
+import javax.print.attribute.standard.RequestingUserName;
+
+/**
+ * This is the default implementation of PrinterJob
+ *
+ * @author Sven de Marothy
+ */
+public class JavaPrinterJob extends PrinterJob
+{
+  /**
+   * The print service associated with this job
+   */
+  private PrintService printer = null;
+
+  /**
+   * Printing options;
+   */
+  private PrintRequestAttributeSet attributes;
+
+  /**
+   * Available print services
+   */
+  private static PrintService[] services;
+
+  /**
+   * The actual print job.
+   */
+  private DocPrintJob printJob;
+
+  /**
+   * The Printable object to print.
+   */
+  private Printable printable;
+
+  /**
+   * Page format.
+   */
+  private PageFormat pageFormat;
+
+  /**
+   * A pageable, or null
+   */
+  private Pageable pageable = null;
+
+  /**
+   * Cancelled or not
+   */
+  private boolean cancelled = false;
+
+  static
+  {
+    // lookup all services without any constraints
+    services = PrintServiceLookup.lookupPrintServices
+      (DocFlavor.INPUT_STREAM.POSTSCRIPT, null);   
+  }
+
+  private static final Class copyClass = (new Copies(1)).getClass();
+  private static final Class jobNameClass = (new JobName("", null)).getClass();
+  private static final Class userNameClass = (new RequestingUserName("", null)).getClass();
+  
+  /**
+   * Initializes a new instance of <code>PrinterJob</code>. 
+   */
+  public JavaPrinterJob()
+  {
+    attributes = new HashPrintRequestAttributeSet();
+    setCopies(1);
+    setJobName("Java Printing");
+    pageFormat = new PageFormat(); // default page format.
+  }
+
+  private void getPageAttributes()
+  {
+    OrientationRequested orientation = (OrientationRequested)
+      attributes.get( OrientationRequested.LANDSCAPE.getCategory() );
+    if( orientation == null)
+      return;
+
+    if( orientation.equals(OrientationRequested.PORTRAIT) )
+      pageFormat.setOrientation(PageFormat.PORTRAIT);
+    else if( orientation.equals(OrientationRequested.LANDSCAPE) )
+      pageFormat.setOrientation(PageFormat.LANDSCAPE);
+    else if( orientation.equals(OrientationRequested.REVERSE_LANDSCAPE) )
+	pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+  }
+
+  /**
+   * Returns the number of copies to be printed.
+   *
+   * @return The number of copies to be printed.
+   */
+  public int getCopies()
+  {
+    return ((IntegerSyntax)attributes.get( jobNameClass )).getValue();
+  }
+
+  /**
+   * Sets the number of copies to be printed.
+   *
+   * @param copies The number of copies to be printed.
+   */
+  public void setCopies(int copies)
+  {
+    attributes.add( new Copies( copies ) );
+  }
+
+  /**
+   * Returns the name of the print job.
+   *
+   * @return The name of the print job.
+   */
+  public String getJobName()
+  {
+    return ((TextSyntax)attributes.get( jobNameClass )).getValue();
+  }
+
+  /**
+   * Sets the name of the print job.
+   *
+   * @param job_name The name of the print job.
+   */
+  public void setJobName(String job_name)
+  {
+    attributes.add( new JobName(job_name, Locale.getDefault()) );
+  }
+
+  /**
+   * Returns the printing user name.
+   *
+   * @return The printing username.
+   */
+  public String getUserName()
+  {
+    return ((TextSyntax)attributes.get( userNameClass )).getValue();
+  }
+
+  /**
+   * Cancels an in progress print job.
+   */
+  public void cancel()
+  {
+    try
+      {
+	if(printJob != null && (printJob instanceof CancelablePrintJob))
+	  {
+	    ((CancelablePrintJob)printJob).cancel();
+	    cancelled = true;
+	  }
+      }
+    catch(PrintException pe)
+      {
+      }
+  }
+
+  /**
+   * Tests whether or not this job has been cancelled.
+   *
+   * @return <code>true</code> if this job has been cancelled, <code>false</code>
+   * otherwise.
+   */
+  public boolean isCancelled()
+  {
+    return cancelled;
+  }
+
+  /**
+   * Clones the specified <code>PageFormat</code> object then alters the
+   * clone so that it represents the default page format.
+   *
+   * @param page_format The <code>PageFormat</code> to clone.
+   *
+   * @return A new default page format.
+   */
+  public PageFormat defaultPage(PageFormat page_format)
+  {
+    return new PageFormat();
+  }
+
+  /**
+   * Displays a dialog box to the user which allows the page format
+   * attributes to be modified.
+   *
+   * @param page_format The <code>PageFormat</code> object to modify.
+   *
+   * @return The modified <code>PageFormat</code>.
+   */
+  public PageFormat pageDialog(PageFormat page_format)
+    throws HeadlessException
+  {
+    return defaultPage(null);
+  }
+
+  /**
+   * Prints the pages.
+   */
+  public void print() throws PrinterException
+  {
+    if( printable == null && pageable == null ) // nothing to print?
+      return;
+
+    PostScriptGraphics2D pg = new PostScriptGraphics2D( this );
+    SpooledDocument doc = pg.spoolPostScript( printable, pageFormat, 
+					      pageable );
+
+    cancelled = false;
+    printJob = printer.createPrintJob();
+    try
+      {
+	printJob.print(doc, attributes);
+      }
+    catch (PrintException pe) 
+      {
+	PrinterException p = new PrinterException();
+	p.initCause(pe);
+	throw p;
+      }
+    // no printjob active.
+    printJob = null;
+  }
+
+  /**
+   * Prints the page with given attributes.
+   */
+  public void print (PrintRequestAttributeSet attributes)
+    throws PrinterException
+  {
+    this.attributes = attributes;
+    print();
+  }
+
+  /**
+   * Displays a dialog box to the user which allows the print job
+   * attributes to be modified.
+   *
+   * @return <code>false</code> if the user cancels the dialog box,
+   * <code>true</code> otherwise.
+   */
+  public boolean printDialog() throws HeadlessException
+  {
+    return printDialog( attributes );
+  }
+
+  /**
+   * Displays a dialog box to the user which allows the print job
+   * attributes to be modified.
+   *
+   * @return <code>false</code> if the user cancels the dialog box,
+   * <code>true</code> otherwise.
+   */
+  public boolean printDialog(PrintRequestAttributeSet attributes)
+    throws HeadlessException
+  {
+    PrintService chosenPrinter = ServiceUI.printDialog
+      (null, 50, 50, services, null, 
+       DocFlavor.INPUT_STREAM.POSTSCRIPT, attributes);
+
+    getPageAttributes();
+
+    if( chosenPrinter != null )
+      {
+	try
+	  {
+	    setPrintService( chosenPrinter );
+	  }
+	catch(PrinterException pe)
+	  {
+	    // Should not happen.
+	  }
+	return true;
+      }
+    return false;
+  }
+
+  /**
+   * This sets the pages that are to be printed.
+   *
+   * @param pageable The pages to be printed, which may not be <code>null</code>.
+   */
+  public void setPageable(Pageable pageable)
+  {
+    if( pageable == null )
+      throw new NullPointerException("Pageable cannot be null.");
+    this.pageable = pageable;
+  }
+
+  /**
+   * Sets this specified <code>Printable</code> as the one to use for
+   * rendering the pages on the print device.
+   *
+   * @param printable The <code>Printable</code> for the print job.
+   */
+  public void setPrintable(Printable printable)
+  {
+    this.printable = printable;
+  }
+
+  /**
+   * Sets the <code>Printable</code> and the page format for the pages
+   * to be printed.
+   *
+   * @param printable The <code>Printable</code> for the print job.
+   * @param page_format The <code>PageFormat</code> for the print job.
+   */
+  public void setPrintable(Printable printable, PageFormat page_format)
+  {
+    this.printable = printable;
+    this.pageFormat = page_format;
+  }
+
+  /**
+   * Makes any alterations to the specified <code>PageFormat</code>
+   * necessary to make it work with the current printer.  The alterations
+   * are made to a clone of the input object, which is then returned.
+   *
+   * @param page_format The <code>PageFormat</code> to validate.
+   *
+   * @return The validated <code>PageFormat</code>.
+   */
+  public PageFormat validatePage(PageFormat page_format)
+  {
+    // FIXME
+    return page_format;
+  }
+
+  /**
+   * Change the printer for this print job to service.  Subclasses that
+   * support setting the print service override this method.  Throws
+   * PrinterException when the class doesn't support setting the printer,
+   * the service doesn't support Pageable or Printable interfaces for 2D
+   * print output.
+   * @param service The new printer to use.
+   * @throws PrinterException if service is not valid.
+   */
+  public void setPrintService(PrintService service)
+    throws PrinterException
+  {
+    if(!service.isDocFlavorSupported(DocFlavor.INPUT_STREAM.POSTSCRIPT))
+      throw new PrinterException("This printer service is not supported.");
+    printer = service;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1349 @@
+/* PostScriptGraphics2D.java -- AWT printer rendering class.
+   Copyright (C) 2006  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 gnu.java.awt.print;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Paint;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.Stroke;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Arc2D;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.TextLayout;
+import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
+import java.awt.image.renderable.RenderableImage;
+import java.awt.image.RenderedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.PixelGrabber;
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterGraphics;
+import java.awt.print.PrinterJob;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.text.AttributedCharacterIterator;
+import java.util.Map;
+
+/**
+ * Class PostScriptGraphics2D - Class that implements the Graphics2D object,
+ * writing the output to a PostScript or EPS file
+ *
+ * @author Sven de Marothy
+ *
+ */
+class PostScriptGraphics2D extends Graphics2D
+{
+  /**
+   * The associated printer job.
+   */
+  private PrinterJob printerJob;
+
+  /**
+   * Output file.
+   */
+  private PrintWriter out;
+
+  // Graphics data
+  private AffineTransform currentTransform = new AffineTransform();
+  private AffineTransform pageTransform;
+  private RenderingHints renderingHints;
+  private Paint currentPaint = null;
+  private Shape clipShape = null;
+  private Font currentFont = null;
+  private Color currentColor = Color.black;
+  private Color backgroundColor = Color.white;
+  private Stroke currentStroke = null;
+  private static Stroke ordinaryStroke = new BasicStroke(0.0f,
+                                                         BasicStroke.CAP_BUTT,
+                                                         BasicStroke.JOIN_MITER);
+  private float cx; // current drawing position
+  private float cy; // current drawing position
+  private boolean currentFontIsPS; // set if currentFont is one of the above
+
+  // settings
+  private double pageX = 595;
+  private double pageY = 842;
+  private double Y = pageY;
+  private boolean gradientOn = false;
+
+  /** 
+   * Constructor
+   *
+   */
+  public PostScriptGraphics2D( PrinterJob pg )
+  {
+    printerJob = pg;
+    // create transform objects
+    pageTransform = new AffineTransform();
+    currentTransform = new AffineTransform();
+
+    /*
+      Create Rendering hints
+      No text aliasing
+      Quality color and rendering
+      Bicubic interpolation
+      Fractional metrics supported
+    */
+    renderingHints = new RenderingHints(null);
+    renderingHints.put(RenderingHints.KEY_RENDERING,
+                       RenderingHints.VALUE_RENDER_QUALITY);
+    renderingHints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
+                       RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
+    renderingHints.put(RenderingHints.KEY_INTERPOLATION,
+                       RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+    renderingHints.put(RenderingHints.KEY_FRACTIONALMETRICS,
+                       RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+    renderingHints.put(RenderingHints.KEY_COLOR_RENDERING,
+                       RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+  }
+
+  /**
+   * Spool a document to PostScript.
+   * If Pageable is non-null, it will print that, otherwise it will use
+   * the supplied printable and pageFormat.
+   */
+  public SpooledDocument spoolPostScript(Printable printable, 
+					 PageFormat pageFormat,
+					 Pageable pageable)
+    throws PrinterException
+  {
+    try 
+      {
+	// spool to a temporary file
+	File temp = File.createTempFile("cpspool", ".ps");
+	temp.deleteOnExit();
+	
+	out = new PrintWriter(new BufferedWriter
+			      (new OutputStreamWriter
+			       (new FileOutputStream(temp), 
+				"ISO8859_1"), 1000000));
+	
+	writePSHeader();
+	
+	if(pageable != null)
+	  {
+	    for(int index = 0; index < pageable.getNumberOfPages(); index++)
+	      spoolPage(out, pageable.getPrintable(index),
+			pageable.getPageFormat(index), index);
+	  }
+	else
+	  {
+	    int index = 0;
+	    while(spoolPage(out, printable, pageFormat, index++) ==
+		  Printable.PAGE_EXISTS);
+	  }
+	out.println("%%Trailer");
+	out.println("%%EOF");
+	out.close();
+	return new SpooledDocument( temp );
+      } 
+    catch (IOException e) 
+      {
+	PrinterException pe = new PrinterException();
+	pe.initCause(e);
+	throw pe;
+      }
+  }
+
+  //--------------------------------------------------------------------------
+
+  /** 
+   * Write the postscript file header,
+   * setup the page format and transforms. 
+   */
+  private void writePSHeader()
+  {
+    out.println("%!PS-Adobe-3.0");      
+    out.println("%%Title: "+printerJob.getJobName());
+    out.println("%%Creator: GNU Classpath ");
+    out.println("%%DocumentData: Clean8Bit");
+
+    out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier");
+    out.println("%%EndComments");
+    
+    out.println("%%BeginProlog");
+    out.println("%%EndProlog");
+    out.println("%%BeginSetup");
+    
+    out.println("%%EndFeature");
+    setupFonts();
+    out.println("%%EndSetup");
+ 
+    // set default fonts and colors
+    setFont( new Font("Dialog", Font.PLAIN, 12) );
+    currentColor = Color.white;
+    currentStroke = new BasicStroke();
+    setPaint(currentColor);
+    setStroke(currentStroke);
+  }
+
+  /**
+   * setupFonts - set up the font dictionaries for
+   * helvetica, times and courier
+   */
+  private void setupFonts()
+  {
+    out.println("/helveticaISO");
+    out.println("/Helvetica findfont dup length dict begin");
+    out.println("{ 1 index /FID eq { pop pop } { def } ifelse } forall");
+    out.println("/Encoding ISOLatin1Encoding def");
+    out.println("currentdict end definefont pop");
+
+    out.println("/timesISO");
+    out.println("/Times-Roman findfont dup length dict begin");
+    out.println("{ 1 index /FID eq { pop pop } { def } ifelse } forall");
+    out.println("/Encoding ISOLatin1Encoding def");
+    out.println("currentdict end definefont pop");
+
+    out.println("/courierISO");
+    out.println("/Courier findfont dup length dict begin");
+    out.println("{ 1 index /FID eq { pop pop } { def } ifelse } forall");
+    out.println("/Encoding ISOLatin1Encoding def");
+    out.println("currentdict end definefont pop");
+  }
+
+  /**
+   * Spools a single page, returns NO_SUCH_PAGE unsuccessful,
+   * PAGE_EXISTS if it was.
+   */
+  public int spoolPage(PrintWriter out,
+		       Printable printable, 
+		       PageFormat pageFormat, 
+		       int index) throws IOException, PrinterException
+  {
+    out.println("%%BeginPageSetup");
+
+    Paper p = pageFormat.getPaper();
+    pageX = p.getWidth();
+    pageY = p.getHeight();
+
+    if( pageFormat.getOrientation() == PageFormat.PORTRAIT )
+      out.println( "%%Orientation: Portrait" );
+    else
+      {
+	out.println( "%%Orientation: Landscape" );
+	double t = pageX;
+	pageX = pageY;
+	pageY = t;
+      }
+      
+    setClip(0, 0, (int)pageX, (int)pageY);
+
+    out.println("gsave % first save");
+    
+    // 595x842; 612x792 respectively
+    out.println("<< /PageSize [" +pageX + " "+pageY+ "] >> setpagedevice");
+
+    if( pageFormat.getOrientation() != PageFormat.LANDSCAPE )
+      {
+	pageTransform.translate(pageX, 0);
+	pageTransform.scale(-1.0, 1.0);
+      }
+
+    // save the original CTM
+    pushCTM();
+    concatCTM(pageTransform);
+    setTransform(new AffineTransform());
+
+    out.println("%%EndPageSetup");
+
+    out.println("gsave");
+
+    if( printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE )
+      return Printable.NO_SUCH_PAGE;
+    
+    out.println("grestore");
+    out.println("showpage");
+
+    return Printable.PAGE_EXISTS;
+  }
+
+  /** push the Current Transformation Matrix onto the PS stack */
+  private void pushCTM()
+  {
+    out.println("matrix currentmatrix   % pushCTM()");
+  }
+
+  /** pop the Current Transformation Matrix from the PS stack */
+  private void popCTM()
+  {
+    out.println("setmatrix % restore CTM");
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+
+  public Graphics create()
+  {
+    return null;
+  }
+
+  public void drawOval(int x, int y, int width, int height)
+  {
+    out.println("% drawOval()");
+    setStroke(ordinaryStroke);
+    draw(new Ellipse2D.Double(x, y, width, height));
+    setStroke(currentStroke);
+  }
+
+  public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    if (nPoints <= 0 || xPoints.length < nPoints || yPoints.length < nPoints)
+      return;
+    out.println("newpath % drawPolyLine()");
+    out.println(xPoints[0] + " " + yPoints[0] + " moveto");
+    for (int i = 1; i < nPoints; i++)
+      out.println(xPoints[i] + " " + yPoints[i] + " lineto");
+    out.println("closepath");
+    out.println("stroke");
+  }
+
+  public void drawRoundRect(int x, int y, int width, int height, int arcWidth,
+                            int arcHeight)
+  {
+    out.println("% drawRoundRect()");
+    RoundRectangle2D.Double rr = new RoundRectangle2D.Double(x, y, width,
+                                                             height, arcWidth,
+                                                             arcHeight);
+    setStroke(ordinaryStroke);
+    draw(rr);
+    setStroke(currentStroke);
+  }
+
+  public void fillRoundRect(int x, int y, int width, int height, int arcWidth,
+                            int arcHeight)
+  {
+    out.println("% fillRoundRect()");
+    RoundRectangle2D.Double rr = new RoundRectangle2D.Double(x, y, width,
+                                                             height, arcWidth,
+                                                             arcHeight);
+    fill(rr);
+  }
+
+  public void drawArc(int x, int y, int width, int height, int startAngle,
+                      int arcAngle)
+  {
+    setStroke(ordinaryStroke);
+    draw(new Arc2D.Double(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN));
+    setStroke(currentStroke);
+  }
+
+  public void fillArc(int x, int y, int width, int height, int startAngle,
+                      int arcAngle)
+  {
+    fill(new Arc2D.Double(x, y, width, height, startAngle, arcAngle, Arc2D.PIE));
+  }
+
+  public void fillOval(int x, int y, int width, int height)
+  {
+    out.println("% fillOval()");
+    fill( new Ellipse2D.Double(x, y, width, height) );
+  }
+
+  public void fillPolygon(int[] x, int[] y, int nPoints)
+  {
+    out.println("% fillPolygon()");
+    fill( new Polygon(x, y, nPoints) );
+  }
+
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    out.println("% drawLine()");
+    setStroke(ordinaryStroke);
+    out.println("newpath");
+    out.println(x1 + " " + (y1) + " moveto");
+    out.println(x2 + " " + (y2) + " lineto");
+    out.println("stroke");
+    setStroke(currentStroke);
+  }
+
+  //--------------- Image drawing ------------------------------------------   
+  public boolean drawImage(Image img, int x, int y, Color bgcolor,
+                           ImageObserver observer)
+  {
+    int w = img.getWidth(null);
+    int h = img.getHeight(null);
+
+    return drawImage(img, x, y, x + w, y + h, 0, 0, w - 1, h - 1, bgcolor,
+		     observer);
+  }
+
+  public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
+                           int sx1, int sy1, int sx2, int sy2, Color bgcolor,
+                           ImageObserver observer)
+  {
+    int n = 0;
+    boolean flipx = false;
+    boolean flipy = false;
+
+    // swap X and Y's
+    if (sx1 > sx2)
+      {
+	n = sx1;
+	sx1 = sx2;
+	sx2 = n;
+	flipx = ! flipx;
+      }
+    if (sy1 > sy2)
+      {
+	n = sy1;
+	sy1 = sy2;
+	sy2 = n;
+	flipy = ! flipy;
+      }
+    if (dx1 > dx2)
+      {
+	n = dx1;
+	dx1 = dx2;
+	dx2 = n;
+	flipx = ! flipx;
+      }
+    if (dy1 > dy2)
+      {
+	n = dy1;
+	dy1 = dy2;
+	dy2 = n;
+	flipy = ! flipy;
+      }
+    n = 0;
+    int sw = sx2 - sx1; // source width
+    int sh = sy2 - sy1; // source height
+    int[] pixels = new int[sw * sh]; // pixel buffer
+    int dw = dx2 - dx1; // destination width
+    int dh = dy2 - dy1; // destination height
+    double x_scale = ((double) dw) / ((double) sw);
+    double y_scale = ((double) dh) / ((double) sh);
+
+    out.println("% drawImage() 2");
+    out.println("gsave");
+    out.println(dx1 + " " + dy1 + " translate");
+    out.println(dw + " " + dh + " scale");
+    out.println(sw + " " + sh + " 8 [" + (flipx ? -sw : sw) + " 0 0 "
+                + (flipy ? -sh : sh) + " " + (flipx ? sw : 0) + " "
+                + (flipy ? sh : 0) + " ]");
+    out.println("{currentfile 3 string readhexstring pop} bind");
+    out.println("false 3 colorimage");
+
+    PixelGrabber pg = new PixelGrabber(img, sx1, sy1, sw, sh, pixels, 0, sw);
+    try
+      {
+	pg.grabPixels();
+      }
+    catch (InterruptedException e)
+      {
+	System.err.println("interrupted waiting for pixels!");
+	return (false);
+      }
+
+    if ((pg.getStatus() & ImageObserver.ABORT) != 0)
+      {
+	System.err.println("image fetch aborted or errored");
+	return (false);
+      }
+
+    for (int j = 0; j < sh; j++)
+      {
+	for (int i = 0; i < sw; i++)
+	  {
+	    out.print(colorTripleHex(new Color(pixels[j * sw + i])));
+	    if (((++n) % 11) == 0)
+	      out.println();
+	  }
+      }
+
+    out.println();
+    out.println("%%EOF");
+    out.println("grestore");
+    return true;
+  }
+
+  public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
+                           int sx1, int sy1, int sx2, int sy2,
+                           ImageObserver observer)
+  {
+    return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null,
+		     observer);
+  }
+
+  public boolean drawImage(Image img, int x, int y, ImageObserver observer)
+  {
+    return drawImage(img, x, y, null, observer);
+  }
+
+  public boolean drawImage(Image img, int x, int y, int width, int height,
+			   Color bgcolor, ImageObserver observer)
+  {
+    int sw = img.getWidth(null);
+    int sh = img.getHeight(null);
+    return drawImage(img, x, y, x + width, y + height, /* destination */
+		     0, 0, sw - 1, sh - 1, /* source */
+		     bgcolor, observer);
+    // correct?
+  }
+
+  public boolean drawImage(Image img, int x, int y, int width, int height,
+			   ImageObserver observer)
+  {
+    return drawImage(img, x, y, width, height, null, observer);
+  }
+
+  /** Renders a BufferedImage that is filtered with a BufferedImageOp. */
+  public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
+  {
+    BufferedImage result = op.filter(img, null);
+    drawImage(result, x, y, null);
+  }
+
+  /** Renders an image, applying a transform from image space
+      into user space before drawing. */
+  public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
+  {
+    AffineTransform oldTransform = new AffineTransform(currentTransform);
+    boolean ret;
+
+    transform(xform);
+    ret = drawImage(img, 0, 0, null, obs);
+    setTransform(oldTransform);
+
+    return ret;
+  }
+
+  /** Renders a RenderableImage, applying a transform from image
+      space into user space before drawing. */
+  public void drawRenderableImage(RenderableImage img, AffineTransform xform)
+  {
+    // FIXME
+  }
+
+  /** Renders a RenderedImage, applying a transform from
+      image space into user space before drawing. */
+  public void drawRenderedImage(RenderedImage img, AffineTransform xform)
+  {
+    // FIXME
+  }
+
+  //-------------------------------------------------------------------------
+  public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    setStroke(ordinaryStroke);
+    draw(new Polygon(xPoints, yPoints, nPoints));
+    setStroke(currentStroke);
+  }
+
+  public void drawString(String str, int x, int y)
+  {
+    drawString(str, (float) x, (float) y);
+  }
+
+  public void drawString(String str, float x, float y)
+  {
+    if( str.trim().equals("") )
+      return; // don't draw whitespace, silly!
+
+    if( currentFontIsPS )
+      {
+	drawStringPSFont(str, x, y);
+	return;
+      }
+
+    TextLayout text = new TextLayout(str, currentFont, getFontRenderContext());
+    Shape s = text.getOutline(AffineTransform.getTranslateInstance(x, y));
+    drawStringShape(s);
+  }
+
+  private void drawStringPSFont(String str, float x, float y)
+  {
+    out.println("% drawString PS font");
+    out.println(x + " " + y + " moveto");
+    saveAndInvertAxis();
+    out.println("(" + str + ") show");
+    restoreAxis();
+  }
+
+  private void saveAndInvertAxis()
+  {
+    // Invert the Y axis of the CTM.
+    popCTM();
+    pushCTM();
+
+    double[] test = 
+      {
+	pageTransform.getScaleX(), pageTransform.getShearY(),
+	pageTransform.getShearX(), pageTransform.getScaleY(),
+	pageTransform.getTranslateX(),
+	-pageTransform.getTranslateY() + pageY
+      };
+
+    double[] test2 = 
+      {
+	currentTransform.getScaleX(),
+	currentTransform.getShearY(),
+	-currentTransform.getShearX(),
+	-currentTransform.getScaleY(),
+	currentTransform.getTranslateX(),
+	currentTransform.getTranslateY()
+      };
+
+    AffineTransform total = new AffineTransform(test);
+    total.concatenate(new AffineTransform(test2));
+    concatCTM(total);
+  }
+
+  private void restoreAxis()
+  {
+    // reset the CTM
+    popCTM();
+    pushCTM();
+    AffineTransform total = new AffineTransform(pageTransform);
+    total.concatenate(currentTransform);
+    concatCTM(total);
+  }
+
+  /**
+   * special drawing routine for string shapes,
+   * which need to be drawn with the Y axis uninverted.
+   */
+  private void drawStringShape(Shape s)
+  {
+    saveAndInvertAxis();
+
+    // draw the shape s with an inverted Y axis.
+    PathIterator pi = s.getPathIterator(null);
+    float[] coords = new float[6];
+
+    while (! pi.isDone())
+      {
+	switch (pi.currentSegment(coords))
+	  {
+	  case PathIterator.SEG_MOVETO:
+	    out.println((coords[0]) + " " + (Y - coords[1]) + " moveto");
+	    cx = coords[0];
+	    cy = coords[1];
+	    break;
+	  case PathIterator.SEG_LINETO:
+	    out.println((coords[0]) + " " + (Y - coords[1]) + " lineto");
+	    cx = coords[0];
+	    cy = coords[1];
+	    break;
+	  case PathIterator.SEG_QUADTO:
+	    // convert to cubic bezier points
+	    float x1 = (cx + 2 * coords[0]) / 3;
+	    float y1 = (cy + 2 * coords[1]) / 3;
+	    float x2 = (2 * coords[2] + coords[0]) / 3;
+	    float y2 = (2 * coords[3] + coords[1]) / 3;
+
+	    out.print((x1) + " " + (Y - y1) + " ");
+	    out.print((x2) + " " + (Y - y2) + " ");
+	    out.println((coords[2]) + " " + (Y - coords[3]) + " curveto");
+	    cx = coords[2];
+	    cy = coords[3];
+	    break;
+	  case PathIterator.SEG_CUBICTO:
+	    out.print((coords[0]) + " " + (Y - coords[1]) + " ");
+	    out.print((coords[2]) + " " + (Y - coords[3]) + " ");
+	    out.println((coords[4]) + " " + (Y - coords[5]) + " curveto");
+	    cx = coords[4];
+	    cy = coords[5];
+	    break;
+	  case PathIterator.SEG_CLOSE:
+	    out.println("closepath");
+	    break;
+	  }
+	pi.next();
+      }
+    out.println("fill");
+
+    restoreAxis();
+  }
+
+  public void setColor(Color c)
+  {
+    /* don't set the color if it's already set */
+    if (c.equals(currentColor))
+      return;
+    gradientOn = false;
+    currentColor = c;
+    currentPaint = c; // Graphics2D extends colors to paint
+
+    out.println(colorTriple(c) + " setrgbcolor");
+  }
+
+  public void clearRect(int x, int y, int width, int height)
+  {
+    out.println("% clearRect");
+    Color c = currentColor;
+    setColor(backgroundColor);
+    fill(new Rectangle2D.Double(x, y, width, height));
+    setColor(c);
+  }
+
+  public void clipRect(int x, int y, int width, int height)
+  {
+    clip(new Rectangle2D.Double(x, y, width, height));
+  }
+
+  public void copyArea(int x, int y, int width, int height, int dx, int dy)
+  {
+    // FIXME
+  }
+
+  public void fillRect(int x, int y, int width, int height)
+  {
+    fill(new Rectangle2D.Double(x, y, width, height));
+  }
+
+  public void dispose()
+  {
+  }
+
+  public void setClip(int x, int y, int width, int height)
+  {
+    out.println("% setClip()");
+    setClip(new Rectangle2D.Double(x, y, width, height));
+  }
+
+  public void setClip(Shape s)
+  {
+    clip(s);
+  }
+
+  public Shape getClip()
+  {
+    return clipShape;
+  }
+
+  public Rectangle getClipBounds()
+  {
+    return clipShape.getBounds();
+  }
+
+  public Color getColor()
+  {
+    return currentColor;
+  }
+
+  public Font getFont()
+  {
+    return currentFont;
+  }
+
+  public FontMetrics getFontMetrics()
+  {
+    return getFontMetrics(currentFont);
+  }
+
+  public FontMetrics getFontMetrics(Font f)
+  {
+    // FIXME
+    return null;
+  }
+
+  public void setFont(Font font)
+  {
+    out.println("% setfont()");
+    if (font == null)
+      // use the default font
+      font = new Font("Dialog", Font.PLAIN, 12);
+    currentFont = font;
+    setPSFont(); // set up the PostScript fonts
+  }
+
+  /**
+   * Setup the postscript font if the current font is one
+   */
+  private void setPSFont()
+  {
+    currentFontIsPS = false;
+
+    String s = currentFont.getName();
+    out.println("% setPSFont: Fontname: " + s);
+    if (s.equalsIgnoreCase("Helvetica") || s.equalsIgnoreCase("SansSerif"))
+      out.print("/helveticaISO findfont ");
+    else if (s.equalsIgnoreCase("Times New Roman"))
+      out.print("/timesISO findfont ");
+    else if (s.equalsIgnoreCase("Courier"))
+      out.print("/courierISO findfont ");
+    else
+      return;
+
+    currentFontIsPS = true;
+
+    out.print(currentFont.getSize() + " scalefont ");
+    out.println("setfont");
+  }
+
+  /** XOR mode is not supported */
+  public void setPaintMode()
+  {
+  }
+
+  /** XOR mode is not supported */
+  public void setXORMode(Color c1)
+  {
+  }
+
+  public void close()
+  {
+    out.println("showpage");
+    out.println("%%Trailer");
+    out.println("grestore % restore original stuff");
+    out.println("%%EOF");
+
+    try
+      {
+	out.close();
+      }
+    catch (Exception e)
+      {
+      }
+    out = null;
+  }
+
+  //----------------------------------------------------------------
+  // Graphics2D stuff ----------------------------------------------
+
+  /**  Sets the values of an arbitrary number of
+       preferences for the rendering algorithms. */
+  public void addRenderingHints(Map hints)
+  {
+    /* rendering hint changes are disallowed */
+  }
+
+  /** write a shape to the file */
+  private void writeShape(Shape s)
+  {
+    PathIterator pi = s.getPathIterator(null);
+    float[] coords = new float[6];
+
+    while (! pi.isDone())
+      {
+	switch (pi.currentSegment(coords))
+	  {
+	  case PathIterator.SEG_MOVETO:
+	    out.println(coords[0] + " " + (coords[1]) + " moveto");
+	    cx = coords[0];
+	    cy = coords[1];
+	    break;
+	  case PathIterator.SEG_LINETO:
+	    out.println(coords[0] + " " + (coords[1]) + " lineto");
+	    cx = coords[0];
+	    cy = coords[1];
+	    break;
+	  case PathIterator.SEG_QUADTO:
+	    // convert to cubic bezier points
+	    float x1 = (cx + 2 * coords[0]) / 3;
+	    float y1 = (cy + 2 * coords[1]) / 3;
+	    float x2 = (2 * coords[2] + coords[0]) / 3;
+	    float y2 = (2 * coords[3] + coords[1]) / 3;
+
+	    out.print(x1 + " " + (Y - y1) + " ");
+	    out.print(x2 + " " + (Y - y2) + " ");
+	    out.println(coords[2] + " " + (Y - coords[3]) + " curveto");
+	    cx = coords[2];
+	    cy = coords[3];
+	    break;
+	  case PathIterator.SEG_CUBICTO:
+	    out.print(coords[0] + " " + coords[1] + " ");
+	    out.print(coords[2] + " " + coords[3] + " ");
+	    out.println(coords[4] + " " + coords[5] + " curveto");
+	    cx = coords[4];
+	    cy = coords[5];
+	    break;
+	  case PathIterator.SEG_CLOSE:
+	    out.println("closepath");
+	    break;
+	  }
+	pi.next();
+      }
+  }
+
+  /** Intersects the current Clip with the interior of
+      the specified Shape and sets the Clip to the resulting intersection. */
+  public void clip(Shape s)
+  {
+    clipShape = s;
+    out.println("% clip INACTIVE");
+    //	writeShape(s);
+    //	out.println("clip");
+  }
+
+  /** Strokes the outline of a Shape using the
+      settings of the current Graphics2D context.*/
+  public void draw(Shape s)
+  {
+    if(!(currentStroke instanceof BasicStroke))
+      fill(currentStroke.createStrokedShape(s));
+
+    out.println("% draw");
+    writeShape(s);
+    out.println("stroke");
+  }
+
+  /** Renders the text of the specified GlyphVector using the
+      Graphics2D context's rendering attributes. */
+  public void drawGlyphVector(GlyphVector gv, float x, float y)
+  {
+    out.println("% drawGlyphVector");
+    Shape s = gv.getOutline();
+    drawStringShape(AffineTransform.getTranslateInstance(x, y)
+		    .createTransformedShape(s));
+  }
+
+  /** Renders the text of the specified iterator,
+      using the Graphics2D context's current Paint.*/
+  public void drawString(AttributedCharacterIterator iterator, float x, float y)
+  {
+    TextLayout text = new TextLayout(iterator, getFontRenderContext());
+    Shape s = text.getOutline(AffineTransform.getTranslateInstance(x, y));
+    drawStringShape(s);
+  }
+
+  /** Renders the text of the specified iterator,
+      using the Graphics2D context's current Paint. */
+  public void drawString(AttributedCharacterIterator iterator, int x, int y)
+  {
+    drawString(iterator, (float) x, (float) y);
+  }
+
+  /** Fills the interior of a Shape using the settings of the Graphics2D context. */
+  public void fill(Shape s)
+  {
+    out.println("% fill");
+    if (! gradientOn)
+      {
+	writeShape(s);
+	out.println("fill");
+      }
+    else
+      {
+	out.println("gsave");
+	writeShape(s);
+	out.println("clip");
+	writeGradient();
+	out.println("shfill");
+	out.println("grestore");
+      }
+  }
+
+  /** Returns the background color used for clearing a region. */
+  public Color getBackground()
+  {
+    return backgroundColor;
+  }
+
+  /** Returns the current Composite in the Graphics2D context. */
+  public Composite getComposite()
+  {
+    // FIXME
+    return null;
+  }
+
+  /** Returns the device configuration associated with this Graphics2D. */
+  public GraphicsConfiguration getDeviceConfiguration()
+  {
+    // FIXME
+    out.println("% getDeviceConfiguration()");
+    return null;
+  }
+
+  /** Get the rendering context of the Font within this Graphics2D context. */
+  public FontRenderContext getFontRenderContext()
+  {
+    out.println("% getFontRenderContext()");
+
+    double[] scaling = 
+      {
+	pageTransform.getScaleX(), 0, 0,
+	-pageTransform.getScaleY(), 0, 0
+      };
+
+    return (new FontRenderContext(new AffineTransform(scaling), false, true));
+  }
+
+  /** Returns the current Paint of the Graphics2D context. */
+  public Paint getPaint()
+  {
+    return currentPaint;
+  }
+
+  /** Returns the value of a single preference for the rendering algorithms. */
+  public Object getRenderingHint(RenderingHints.Key hintKey)
+  {
+    return renderingHints.get(hintKey);
+  }
+
+  /** Gets the preferences for the rendering algorithms. */
+  public RenderingHints getRenderingHints()
+  {
+    return renderingHints;
+  }
+
+  /** Returns the current Stroke in the Graphics2D context. */
+  public Stroke getStroke()
+  {
+    return currentStroke;
+  }
+
+  /** Returns a copy of the current Transform in the Graphics2D context. */
+  public AffineTransform getTransform()
+  {
+    return currentTransform;
+  }
+
+  /** 
+   * Checks whether or not the specified Shape intersects 
+   * the specified Rectangle, which is in device space. 
+   */
+  public boolean hit(Rectangle rect, Shape s, boolean onStroke)
+  {
+    Rectangle2D.Double r = new Rectangle2D.Double(rect.getX(), rect.getY(),
+						  rect.getWidth(),
+						  rect.getHeight());
+    return s.intersects(r);
+  }
+
+  /** Sets the background color for the Graphics2D context.*/
+  public void setBackground(Color color)
+  {
+    out.println("% setBackground(" + color + ")");
+    backgroundColor = color;
+  }
+
+  /** Sets the Composite for the Graphics2D context.
+      Not supported. */
+  public void setComposite(Composite comp)
+  {
+  }
+
+  /** Sets the Paint attribute for the Graphics2D context.*/
+  public void setPaint(Paint paint)
+  {
+    currentPaint = paint;
+    gradientOn = false;
+    if (paint instanceof Color)
+      {
+	setColor((Color) paint);
+	return;
+      }
+    if (paint instanceof GradientPaint)
+      {
+	gradientOn = true;
+	return;
+      }
+  }
+
+  /* get a space seperated 0.0 - 1.0 color RGB triple */
+  private String colorTriple(Color c)
+  {
+    return (((double) c.getRed() / 255.0) + " "
+	    + ((double) c.getGreen() / 255.0) + " "
+	    + ((double) c.getBlue() / 255.0));
+  }
+
+  /**
+   * Get a nonsperated hex RGB triple, eg FFFFFF = white
+   * used by writeGradient and drawImage 
+   */
+  private String colorTripleHex(Color c)
+  {
+    String r = "00" + Integer.toHexString(c.getRed());
+    r = r.substring(r.length() - 2);
+    String g = "00" + Integer.toHexString(c.getGreen());
+    g = g.substring(g.length() - 2);
+    String b = "00" + Integer.toHexString(c.getBlue());
+    b = b.substring(b.length() - 2);
+    return r + g + b;
+  }
+
+  /* write the current gradient fill */
+  private void writeGradient()
+  {
+    GradientPaint paint = (GradientPaint) currentPaint;
+    out.println("% writeGradient()");
+
+    int n = 1;
+    double x;
+    double y;
+    double dx;
+    double dy;
+    Point2D p1 = currentTransform.transform(paint.getPoint1(), null);
+    Point2D p2 = currentTransform.transform(paint.getPoint2(), null);
+    x = p1.getX();
+    y = p1.getY();
+    dx = p2.getX() - x;
+    dy = p2.getY() - y;
+
+    // get number of repetitions
+    while (x + n * dx < pageY && y + n * dy < pageX && x + n * dx > 0
+	   && y + n * dy > 0)
+      n++;
+
+    out.println("<<"); // start
+    out.println("/ShadingType 2"); // gradient fill 
+    out.println("/ColorSpace [ /DeviceRGB ]"); // RGB colors
+    out.print("/Coords [");
+    out.print(x + " " + y + " " + (x + n * dx) + " " + (y + n * dy) + " ");
+    out.println("]"); // coordinates defining the axis
+    out.println("/Function <<");
+    out.println("/FunctionType 0");
+    out.println("/Order 1");
+    out.println("/Domain [ 0 1 ]");
+    out.println("/Range [ 0 1  0 1  0 1 ]");
+    out.println("/BitsPerSample 8");
+    out.println("/Size [ " + (1 + n) + " ]");
+    out.print("/DataSource < " + colorTripleHex(paint.getColor1()) + " "
+	      + colorTripleHex(paint.getColor2()) + " ");
+    for (; n > 1; n--)
+      if (paint.isCyclic())
+	{
+	  if ((n % 2) == 1)
+	    out.print(colorTripleHex(paint.getColor1()) + " ");
+	  else
+	    out.print(colorTripleHex(paint.getColor2()) + " ");
+	}
+      else
+	out.print(colorTripleHex(paint.getColor2()) + " ");
+    out.println(">");
+    out.println(">>");
+    out.println(">>");
+  }
+
+  /** Sets the value of a single preference for the rendering algorithms. */
+  public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
+  {
+    /* we don't allow the changing of rendering hints. */
+  }
+
+  /** Replaces the values of all preferences for the rendering algorithms
+      with the specified hints. */
+  public void setRenderingHints(Map hints)
+  {
+    /* we don't allow the changing of rendering hints. */
+  }
+
+  /** 
+   * Sets the Stroke for the Graphics2D context. BasicStroke fully implemented.
+   */
+  public void setStroke(Stroke s)
+  {
+    currentStroke = s;
+
+    if (! (s instanceof BasicStroke))
+      return;
+
+    BasicStroke bs = (BasicStroke) s;
+    out.println("% setStroke()");
+    try
+      {
+	// set the line width
+	out.println(bs.getLineWidth() + " setlinewidth");
+
+	// set the line dash
+	float[] dashArray = bs.getDashArray();
+	if (dashArray != null)
+	  {
+	    out.print("[ ");
+	    for (int i = 0; i < dashArray.length; i++)
+	      out.print(dashArray[i] + " ");
+	    out.println("] " + bs.getDashPhase() + " setdash");
+	  }
+	else
+	  out.println("[] 0 setdash"); // set solid
+
+	// set the line cap
+	switch (bs.getEndCap())
+	  {
+	  case BasicStroke.CAP_BUTT:
+	    out.println("0 setlinecap");
+	    break;
+	  case BasicStroke.CAP_ROUND:
+	    out.println("1 setlinecap");
+	    break;
+	  case BasicStroke.CAP_SQUARE:
+	    out.println("2 setlinecap");
+	    break;
+	  }
+
+	// set the line join
+	switch (bs.getLineJoin())
+	  {
+	  case BasicStroke.JOIN_BEVEL:
+	    out.println("2 setlinejoin");
+	    break;
+	  case BasicStroke.JOIN_MITER:
+	    out.println("0 setlinejoin");
+	    out.println(bs.getMiterLimit() + " setmiterlimit");
+	    break;
+	  case BasicStroke.JOIN_ROUND:
+	    out.println("1 setlinejoin");
+	    break;
+	  }
+      }
+    catch (Exception e)
+      {
+	out.println("% Exception in setStroke()");
+      }
+  }
+
+  //////////////////// TRANSFORM SETTING /////////////////////////////////////
+  private void concatCTM(AffineTransform Tx)
+  {
+    double[] matrixElements = new double[6];
+    Tx.getMatrix(matrixElements);
+
+    out.print("[ ");
+    for (int i = 0; i < 6; i++)
+      out.print(matrixElements[i] + " ");
+    out.println("] concat");
+  }
+
+  /** Sets the Transform in the Graphics2D context. */
+  public void setTransform(AffineTransform Tx)
+  {
+    // set the transformation matrix;
+    currentTransform = Tx;
+
+    // concatenate the current transform and the page transform
+    AffineTransform totalTransform = new AffineTransform(pageTransform);
+    totalTransform.concatenate(currentTransform);
+    out.println("% setTransform()");
+    out.println("% pageTransform:" + pageTransform);
+    out.println("% currentTransform:" + currentTransform);
+    out.println("% totalTransform:" + totalTransform);
+
+    popCTM();
+    pushCTM(); // set the CTM to it's original state
+    concatCTM(totalTransform); // apply our transforms
+  }
+
+  /** Composes an AffineTransform object with the Transform
+      in this Graphics2D according to the rule last-specified-first-applied. */
+  public void transform(AffineTransform Tx)
+  {
+    // concatenate the current transform
+    currentTransform.concatenate(Tx);
+    // and the PS CTM
+    concatCTM(Tx);
+  }
+
+  ////////////////////////// TRANSFORMS //////////////////////////////////////
+
+  /** shear transform */
+  public void shear(double shx, double shy)
+  {
+    out.println("% shear()");
+    AffineTransform Tx = new AffineTransform();
+    Tx.shear(shx, shy);
+    transform(Tx);
+  }
+
+  /** Translates the origin of the Graphics2D context
+      to the point (x, y) in the current coordinate system. */
+  public void translate(int x, int y)
+  {
+    out.println("% translate()");
+    AffineTransform Tx = new AffineTransform();
+    Tx.translate(x, y);
+    transform(Tx);
+  }
+
+  /** Translates the origin of the Graphics2D context
+      to the point (x, y) in the current coordinate system. */
+  public void translate(double x, double y)
+  {
+    out.println("% translate(" + x + ", " + y + ")");
+    AffineTransform Tx = new AffineTransform();
+    Tx.translate(x, y);
+    transform(Tx);
+  }
+
+  /** Concatenates the current Graphics2D Transform with a rotation transform.*/
+  public void rotate(double theta)
+  {
+    out.println("% rotate(" + theta + ")");
+    AffineTransform Tx = new AffineTransform();
+    Tx.rotate(theta);
+    transform(Tx);
+  }
+
+  /** Concatenates the current Graphics2D Transform with
+      a translated rotation transform.*/
+  public void rotate(double theta, double x, double y)
+  {
+    out.println("% rotate()");
+    AffineTransform Tx = new AffineTransform();
+    Tx.rotate(theta, x, y);
+    transform(Tx);
+  }
+
+  /** Concatenates the current Graphics2D Transform with a scaling
+      transformation Subsequent rendering is resized according to the
+      specified scaling factors relative to the previous scaling.*/
+  public void scale(double sx, double sy)
+  {
+    out.println("% scale(" + sx + ", " + sy + ")");
+    AffineTransform Tx = new AffineTransform();
+    Tx.scale(sx, sy);
+    transform(Tx);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/SpooledDocument.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/SpooledDocument.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/SpooledDocument.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/awt/print/SpooledDocument.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,91 @@
+/* SpooledDocument.java -- Reurgitate a spooled PostScript file
+   Copyright (C) 2006  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 gnu.java.awt.print;
+
+import javax.print.Doc;
+import javax.print.DocFlavor;
+import javax.print.attribute.DocAttributeSet;
+import java.io.File;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.Reader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class SpooledDocument implements Doc
+{
+  private FileInputStream fis;
+
+  public SpooledDocument(File file)
+  {
+    try 
+      {
+	fis = new FileInputStream(file);
+      }
+    catch (FileNotFoundException ffne) 
+      {
+	// Shouldn't happen.
+      }
+  }
+
+  public DocAttributeSet getAttributes()
+  {
+    return null;
+  }
+
+  public DocFlavor getDocFlavor()
+  {
+    return DocFlavor.INPUT_STREAM.POSTSCRIPT;
+  }
+
+  public Object getPrintData()
+  {
+    return fis;
+  }
+  
+  public Reader getReaderForText()
+  {
+    return new InputStreamReader(fis);
+  }
+
+  public InputStream getStreamForBytes()
+  {
+    return fis;
+ }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/BeanInfoEmbryo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/BeanInfoEmbryo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/BeanInfoEmbryo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/BeanInfoEmbryo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,171 @@
+/* gnu.java.beans.BeanInfoEmbryo
+   Copyright (C) 1998, 2002 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 gnu.java.beans;
+
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Vector;
+
+/**
+ ** A BeanInfoEmbryo accumulates information about a Bean
+ ** while it is in the process of being created, and then
+ ** when you are done accumulating the information, the
+ ** getBeanInfo() method may be called to create a BeanInfo
+ ** object based on the information.<P>
+ **
+ ** This class is not well-synchronized.  (It can be, it
+ ** just isn't yet.)
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 30 Jul 1998
+ ** @see java.beans.BeanInfo
+ **/
+
+public class BeanInfoEmbryo {
+
+	// by using a TreeMap the properties will be sorted alphabetically by name
+	// which matches the (undocumented) behavior of jdk
+	TreeMap properties = new TreeMap();
+	Hashtable events = new Hashtable();
+	Vector methods = new Vector();
+
+	BeanDescriptor beanDescriptor;
+	BeanInfo[] additionalBeanInfo;
+	java.awt.Image[] im;
+	String defaultPropertyName;
+	String defaultEventName;
+
+	public BeanInfoEmbryo() {
+	}
+
+	public BeanInfo getBeanInfo() {
+		int defaultProperty = -1;
+		int defaultEvent = -1;
+
+		PropertyDescriptor[] Aproperties = new PropertyDescriptor[properties.size()];
+		int i = 0;
+		Iterator it = properties.entrySet().iterator();
+		while (it.hasNext()) {
+			Aproperties[i] = (PropertyDescriptor) (((Map.Entry)it.next()).getValue());
+			if(defaultPropertyName != null && Aproperties[i].getName().equals(defaultPropertyName)) {
+				defaultProperty = i;
+			}
+			i++;
+		}
+
+		EventSetDescriptor[] Aevents = new EventSetDescriptor[events.size()];
+		i = 0;
+		Enumeration e = events.elements();
+		while (e.hasMoreElements()) {
+			Aevents[i] = (EventSetDescriptor) e.nextElement();
+			if(defaultEventName != null && Aevents[i].getName().equals(defaultEventName)) {
+				defaultEvent = i;
+			}
+			i++;
+		}
+
+		MethodDescriptor[] Amethods = new MethodDescriptor[methods.size()];
+		methods.copyInto(Amethods);
+
+		return new ExplicitBeanInfo(beanDescriptor,additionalBeanInfo,Aproperties,defaultProperty,Aevents,defaultEvent,Amethods,im);
+	}
+
+	public void setBeanDescriptor(BeanDescriptor b) {
+		beanDescriptor = b;
+	}
+
+	public void setAdditionalBeanInfo(BeanInfo[] b) {
+		additionalBeanInfo = b;
+	}
+
+	public boolean hasProperty(PropertyDescriptor p) {
+		return properties.get(p.getName()) != null;
+	}
+	public void addProperty(PropertyDescriptor p) {
+		properties.put(p.getName(),p);
+	}
+	public void addIndexedProperty(IndexedPropertyDescriptor p) {
+		properties.put(p.getName(),p);
+	}
+
+	public boolean hasEvent(EventSetDescriptor e) {
+		return events.get(e.getName()) != null;
+	}
+	public void addEvent(EventSetDescriptor e) {
+		events.put(e.getName(),e);
+	}
+
+	public boolean hasMethod(MethodDescriptor m) {
+          for(int i=0;i<methods.size();i++) {
+            Method thisMethod = ((MethodDescriptor)methods.elementAt(i)).getMethod();
+            if(m.getMethod().getName().equals(thisMethod.getName())
+               && Arrays.equals(m.getMethod().getParameterTypes(),
+                                thisMethod.getParameterTypes())) {
+              return true;
+            }
+          }
+          return false;
+	}
+	public void addMethod(MethodDescriptor m) {
+		methods.addElement(m);
+	}
+
+	public void setDefaultPropertyName(String defaultPropertyName) {
+		this.defaultPropertyName = defaultPropertyName;
+	}
+
+	public void setDefaultEventName(String defaultEventName) {
+		this.defaultEventName = defaultEventName;
+	}
+
+	public void setIcons(java.awt.Image[] im) {
+		this.im = im;
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DefaultExceptionListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DefaultExceptionListener.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DefaultExceptionListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DefaultExceptionListener.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* gnu.java.beans.DefaultExceptionListener
+   Copyright (C) 2004, 2006 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 gnu.java.beans;
+
+import java.beans.ExceptionListener;
+
+/** The DefaultExceptionListener is the default implementation of the
+ * {@link ExceptionListener} interface. An instance of
+ * this class is used whenever the user provided no
+ * <code>ExceptionListener</code> instance on its own.
+ *
+ * <p>The implementation just writes the exception's message
+ * to <code>System.err</code> and is used by the {@link java.beans.Encoder}
+ * and the {@link java.beans.XMLDecoder}.
+ * </p>
+ *
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class DefaultExceptionListener implements ExceptionListener
+{
+  public final static DefaultExceptionListener INSTANCE
+    = new DefaultExceptionListener();
+  
+  public void exceptionThrown(Exception e)
+  {
+    System.err.println("exception thrown: "
+                       + e + " - message: "
+                       + e.getMessage());
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,165 @@
+/* gnu.java.beans.DummyAppletContext
+   Copyright (C) 2004, 2005 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 gnu.java.beans;
+
+import java.applet.Applet;
+import java.applet.AppletContext;
+import java.applet.AudioClip;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/** A placeholder <code>AppletContext</code> implementation that does nothing.
+ *
+ * <p>This is the default implementation for GNU Classpath and is used for <code>Applet</code>
+ * beans being created with {@link java.beans.Beans.instantiate}.</p>
+ *
+ * <p>It has no functionality in order to allow it to be used without any dependencies
+ * (e.g. sound, network access, ...).</p>
+ *
+ * @author Robert Schuster
+ */
+class DummyAppletContext implements AppletContext
+{
+  private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_SET);
+
+  DummyAppletContext()
+  {
+  }
+
+  /** Implementation is VM neutral and returns a dummy {@link AudioClip} instance
+   * for every URL that returns a non-<code>null</code> object on
+   * <code>URL.openConnection()</code>.
+   *
+   * @see java.applet.AppletContext#getAudioClip(java.net.URL)
+   *
+   * FIXME: When Java Sound API (javax.sound) is included in Classpath or URL is able to handle
+   * sampled sound this should be adjusted.
+   */
+  public AudioClip getAudioClip(URL url)
+  {
+    return Applet.newAudioClip(url);
+  }
+
+  /** Loads the <code>Image</code> instance by delegating to
+   * {@link java.awt.Toolkit.createImage(URL) }.
+   *
+   * @see java.applet.AppletContext#getImage(java.net.URL)
+   * @see java.awt.Toolkit#createImage(java.net.URL)
+   */
+  public Image getImage(URL url)
+  {
+    return Toolkit.getDefaultToolkit().createImage(url);
+  }
+
+  /** Returns <code>null</code> for every argument.
+   *
+   * @see java.applet.AppletContext#getApplet(java.lang.String)
+   */
+  public Applet getApplet(String name)
+  {
+    return null;
+  }
+
+  /** Returns always an empty <code>Enumeration</code>.
+   *
+   * @see java.applet.AppletContext#getApplets()
+   */
+  public Enumeration getApplets()
+  {
+    return EMPTY_ENUMERATION;
+  }
+
+  /** Does nothing.
+   *
+   * @see java.applet.AppletContext#showDocument(java.net.URL)
+   */
+  public void showDocument(URL url)
+  {
+  }
+
+  /** Does nothing.
+   *
+   * @see java.applet.AppletContext#showDocument(java.net.URL, java.lang.String)
+   */
+  public void showDocument(URL url, String target)
+  {
+  }
+
+  /** Does nothing.
+   *
+   * @see java.applet.AppletContext#showStatus(java.lang.String)
+   */
+  public void showStatus(String message)
+  {
+  }
+
+  /** Does nothing.
+   *
+   * @see java.applet.AppletContext#setStream(java.lang.String, java.io.InputStream)
+   */
+  public void setStream(String key, InputStream stream)
+    throws IOException
+  {
+    throw new IOException("Dummy implementation imposes zero InputStream associations.");
+  }
+
+  /** Returns <code>null</code> for every argument.
+   *
+   * @see java.applet.AppletContext#getStream(java.lang.String)
+   */
+  public InputStream getStream(String key)
+  {
+    return null;
+  }
+
+  /** Returns always an empty iterator.
+   *
+   * @see java.applet.AppletContext#getStreamKeys()
+   */
+  public Iterator getStreamKeys()
+  {
+    return Collections.EMPTY_SET.iterator();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletStub.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletStub.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletStub.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/DummyAppletStub.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,115 @@
+/* gnu.java.beans.DummyAppletStub
+   Copyright (C) 2004, 2005 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 gnu.java.beans;
+
+import java.applet.AppletContext;
+import java.applet.AppletStub;
+import java.net.URL;
+
+/** Placeholder implementation of <code>AppletStub</code> providing no functionality.
+ * <p>This class is used for <code>Applet</code> being created with
+ * {@link java.beans.Bean.instantiate}.</p>
+ *
+ * @author Robert Schuster
+ */
+public class DummyAppletStub implements AppletStub
+{
+  private URL documentBase;
+  private URL codeBase;
+  private DummyAppletContext context;
+
+  public DummyAppletStub(URL newCodeBase, URL newDocumentBase)
+  {
+    codeBase = newCodeBase;
+    documentBase = newDocumentBase;
+
+    context = new DummyAppletContext();
+  }
+
+  /** Returns always <code>true</code>.
+   *
+   * @see java.applet.AppletStub#isActive()
+   */
+  public boolean isActive()
+  {
+    return true;
+  }
+
+  /**
+   * @see java.applet.AppletStub#getDocumentBase()
+   */
+  public URL getDocumentBase()
+  {
+    return documentBase;
+  }
+
+  /**
+   * @see java.applet.AppletStub#getCodeBase()
+   */
+  public URL getCodeBase()
+  {
+    return codeBase;
+  }
+
+  /** Implementation returns <code>null</code> for every parameter name.
+   *
+   * @see java.applet.AppletStub#getParameter(java.lang.String)
+   */
+  public String getParameter(String name)
+  {
+    return null;
+  }
+
+  /** Returns a non-functional context instance.
+   *
+   * @see java.applet.AppletStub#getAppletContext()
+   */
+  public AppletContext getAppletContext()
+  {
+    return context;
+  }
+
+  /** Does nothing.
+   *
+   * @see java.applet.AppletStub#appletResize(int, int)
+   */
+  public void appletResize(int width, int height)
+  {
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/ExplicitBeanInfo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/ExplicitBeanInfo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/ExplicitBeanInfo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/ExplicitBeanInfo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,149 @@
+/* ExplicitBeanInfo.java --
+   Copyright (C) 1998, 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 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 gnu.java.beans;
+
+import java.awt.Image;
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+
+/**
+ ** ExplicitBeanInfo lets you specify in the constructor
+ ** all the various parts of the BeanInfo.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 30 Jul 1998
+ ** @see java.beans.BeanInfo
+ **/
+
+public class ExplicitBeanInfo implements BeanInfo {
+	/** The BeanDescriptor returned by getBeanDescriptor. **/
+	protected BeanDescriptor beanDescriptor;
+
+	/** The EventSetDescriptor array returned by
+	 ** getEventSetDescriptors().
+	 **/
+	protected EventSetDescriptor[] eventSetDescriptors = new EventSetDescriptor[0];
+
+	/** The PropertyDescriptor array returned by
+	 ** getPropertyDescriptors().
+	 **/
+	protected PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[0];
+
+	/** The MethodDescriptor array returned by
+	 ** getMethodDescriptors().
+	 **/
+	protected MethodDescriptor[]   methodDescriptors;
+
+	/** The default property index. **/
+	protected int defaultPropertyIndex;
+
+	/** The default event index. **/
+	protected int defaultEventIndex;
+
+	/** The BeanInfo array returned by
+	 ** getAdditionalBeanInfo().
+	 **/
+	protected BeanInfo[] additionalBeanInfo;
+
+	/** The set of icons. **/
+	protected Image[] icons;
+
+	public ExplicitBeanInfo(BeanDescriptor beanDescriptor,
+	                        BeanInfo[] additionalBeanInfo,
+	                        PropertyDescriptor[] propertyDescriptors,
+				int defaultPropertyIndex,
+	                        EventSetDescriptor[] eventSetDescriptors,
+				int defaultEventIndex,
+	                        MethodDescriptor[] methodDescriptors,
+				Image[] icons) {
+		this.beanDescriptor = beanDescriptor;
+		this.additionalBeanInfo = additionalBeanInfo;
+		this.propertyDescriptors = propertyDescriptors;
+		this.defaultPropertyIndex = defaultPropertyIndex;
+		this.eventSetDescriptors = eventSetDescriptors;
+		this.defaultEventIndex = defaultEventIndex;
+		this.methodDescriptors = methodDescriptors;
+		this.icons = icons;
+	}
+
+	/** Get Bean descriptor. **/
+	public BeanDescriptor getBeanDescriptor() {
+		return beanDescriptor;
+	}
+
+	/** Get Bean events. **/
+	public EventSetDescriptor[] getEventSetDescriptors() {
+		return eventSetDescriptors;
+	}
+
+	/** Get default event set. **/
+	public int getDefaultEventIndex() {
+		return defaultEventIndex;
+	}
+
+	/** Get Bean properties. **/
+	public PropertyDescriptor[] getPropertyDescriptors() {
+		return propertyDescriptors;
+	}
+
+	/** Get "default" property. **/
+	public int getDefaultPropertyIndex() {
+		return defaultPropertyIndex;
+	}
+
+	/** Get Bean methods. **/
+	public MethodDescriptor[] getMethodDescriptors() {
+		return methodDescriptors;
+	}
+
+	/** Get additional Bean info. **/
+	public BeanInfo[] getAdditionalBeanInfo() {
+		return additionalBeanInfo;
+	}
+
+	/** Get Bean icons.
+	 ** @param iconType the type of icon
+	 **/
+	public Image getIcon(int iconType) {
+		return icons != null ? icons[iconType - 1] : null;
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/IntrospectionIncubator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/IntrospectionIncubator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/IntrospectionIncubator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/IntrospectionIncubator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,441 @@
+/* gnu.java.beans.IntrospectionIncubator
+   Copyright (C) 1998, 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 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 gnu.java.beans;
+
+import gnu.java.lang.ArrayHelper;
+import gnu.java.lang.ClassHelper;
+
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ ** IntrospectionIncubator takes in a bunch of Methods, and
+ ** Introspects only those Methods you give it.<br/>
+ **
+ ** See {@link addMethod(Method)} for details which rules apply to
+ ** the methods.
+ **
+ ** @author John Keiser
+ ** @author Robert Schuster
+ ** @see gnu.java.beans.ExplicitBeanInfo
+ ** @see java.beans.BeanInfo
+ **/
+
+public class IntrospectionIncubator {
+	Hashtable propertyMethods = new Hashtable();
+	Hashtable listenerMethods = new Hashtable();
+	Vector otherMethods = new Vector();
+
+	Class propertyStopClass;
+	Class eventStopClass;
+	Class methodStopClass;
+
+	public IntrospectionIncubator() {
+	}
+
+	/** Examines the given method and files it in a suitable collection.
+	 * It files the method as a property method if it finds:
+	 * <ul>
+	 * <li>boolean "is" getter</li>
+	 * <li>"get" style getter</li>
+	 * <li>single argument setter</li>
+	 * <li>indiced setter and getter</li> 
+	 * </ul>
+	 * It files the method as a listener method if all of these rules apply:
+	 * <ul>
+	 * <li>the method name starts with "add" or "remove"</li>
+	 * <li>there is only a single argument</li>
+	 * <li>the argument type is a subclass of <code>java.util.EventListener</code></li>
+	 * </ul>
+	 * All public methods are filed as such. 
+	 *   
+	 * @param method The method instance to examine.
+	 */
+	public void addMethod(Method method) {
+		if(Modifier.isPublic(method.getModifiers())) {
+			String name = ClassHelper.getTruncatedName(method.getName());
+			Class retType = method.getReturnType();
+			Class[] params = method.getParameterTypes();
+			boolean isVoid = retType.equals(java.lang.Void.TYPE);
+			Class methodClass = method.getDeclaringClass();
+			
+			/* Accepts the method for examination if no stop class is given or the method is declared in a subclass of the stop class.
+			 * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}.
+			 * This block finds out whether the method is a suitable getter or setter method (or read/write method).  
+			 */
+			if(isReachable(propertyStopClass, methodClass)) {
+				/* At this point a method may regarded as a property's read or write method if its name
+				 * starts with "is", "get" or "set". However, if a method is static it cannot be part
+				 * of a property.
+				 */
+				if(Modifier.isStatic(method.getModifiers())) {
+					// files method as other because it is static
+					otherMethods.addElement(method);
+				} else if(name.startsWith("is")
+				   && retType.equals(java.lang.Boolean.TYPE)
+				   && params.length == 0) {
+				   	// files method as boolean "is" style getter
+					addToPropertyHash(name,method,IS);
+				} else if(name.startsWith("get") && !isVoid) {
+					if(params.length == 0) {
+						// files as legal non-argument getter
+						addToPropertyHash(name,method,GET);
+					} else if(params.length == 1 && params[0].equals(java.lang.Integer.TYPE)) {
+						// files as legal indiced getter
+						addToPropertyHash(name,method,GET_I);
+					} else {
+						// files as other because the method's signature is not Bean-like
+						otherMethods.addElement(method);
+					}
+				} else if(name.startsWith("set") && isVoid) {
+					if(params.length == 1) {
+						// files as legal single-argument setter method
+						addToPropertyHash(name,method,SET);
+					} else if(params.length == 2 && params[0].equals(java.lang.Integer.TYPE)) {
+						// files as legal indiced setter method
+						addToPropertyHash(name,method,SET_I);
+					} else {
+						// files as other because the method's signature is not Bean-like
+						otherMethods.addElement(method);
+					}
+				}
+			}
+			
+			if(isReachable(eventStopClass, methodClass)) {
+				if(name.startsWith("add")
+				          && isVoid
+				          && params.length == 1
+				          && java.util.EventListener.class.isAssignableFrom(params[0])) {
+					addToListenerHash(name,method,ADD);
+				} else if(name.startsWith("remove")
+				          && isVoid
+				          && params.length == 1
+				          && java.util.EventListener.class.isAssignableFrom(params[0])) {
+					addToListenerHash(name,method,REMOVE);
+				}
+			}
+			 
+			if(isReachable(methodStopClass, methodClass)) {
+				// files as reachable public method
+				otherMethods.addElement(method);
+			}
+			
+		}
+	}
+
+	public void addMethods(Method[] m) {
+		for(int i=0;i<m.length;i++) {
+			addMethod(m[i]);
+		}
+	}
+
+	public void setPropertyStopClass(Class c) {
+		propertyStopClass = c;
+	}
+
+	public void setEventStopClass(Class c) {
+		eventStopClass = c;
+	}
+
+	public void setMethodStopClass(Class c) {
+		methodStopClass = c;
+	}
+
+
+	public BeanInfoEmbryo getBeanInfoEmbryo() throws IntrospectionException {
+		BeanInfoEmbryo b = new BeanInfoEmbryo();
+		findXXX(b,IS);
+		findXXXInt(b,GET_I);
+		findXXXInt(b,SET_I);
+		findXXX(b,GET);
+		findXXX(b,SET);
+		findAddRemovePairs(b);
+		for(int i=0;i<otherMethods.size();i++) {
+			MethodDescriptor newMethod = new MethodDescriptor((Method)otherMethods.elementAt(i));
+			if(!b.hasMethod(newMethod)) {
+				b.addMethod(new MethodDescriptor((Method)otherMethods.elementAt(i)));
+			}
+		}
+		return b;
+	}
+
+	public BeanInfo getBeanInfo() throws IntrospectionException {
+		return getBeanInfoEmbryo().getBeanInfo();
+	}
+
+
+	void findAddRemovePairs(BeanInfoEmbryo b) throws IntrospectionException {
+		Enumeration listenerEnum = listenerMethods.keys();
+		while(listenerEnum.hasMoreElements()) {
+			DoubleKey k = (DoubleKey)listenerEnum.nextElement();
+			Method[] m = (Method[])listenerMethods.get(k);
+			if(m[ADD] != null && m[REMOVE] != null) {
+				EventSetDescriptor e = new EventSetDescriptor(Introspector.decapitalize(k.getName()),
+				                                              k.getType(), k.getType().getMethods(),
+				                                              m[ADD],m[REMOVE]);
+				e.setUnicast(ArrayHelper.contains(m[ADD].getExceptionTypes(),java.util.TooManyListenersException.class));
+				if(!b.hasEvent(e)) {
+					b.addEvent(e);
+				}
+			}
+		}
+	}
+
+	void findXXX(BeanInfoEmbryo b, int funcType) throws IntrospectionException {
+		Enumeration keys = propertyMethods.keys();
+		while(keys.hasMoreElements()) {
+			DoubleKey k = (DoubleKey)keys.nextElement();
+			Method[] m = (Method[])propertyMethods.get(k);
+			if(m[funcType] != null) {
+				PropertyDescriptor p = new PropertyDescriptor(Introspector.decapitalize(k.getName()),
+				                                     m[IS] != null ? m[IS] : m[GET],
+				                                     m[SET]);
+				if(m[SET] != null) {
+					p.setConstrained(ArrayHelper.contains(m[SET].getExceptionTypes(),java.beans.PropertyVetoException.class));
+				}
+				if(!b.hasProperty(p)) {
+					b.addProperty(p);
+				}
+			}
+		}
+	}
+
+	void findXXXInt(BeanInfoEmbryo b, int funcType) throws IntrospectionException {
+		Enumeration keys = propertyMethods.keys();
+		while(keys.hasMoreElements()) {
+			DoubleKey k = (DoubleKey)keys.nextElement();
+			Method[] m = (Method[])propertyMethods.get(k);
+			if(m[funcType] != null) {
+				boolean constrained;
+				if(m[SET_I] != null) {
+					constrained = ArrayHelper.contains(m[SET_I].getExceptionTypes(),java.beans.PropertyVetoException.class);
+				} else {
+					constrained = false;
+				}
+
+				/** Find out if there is an array type get or set **/
+				Class arrayType = Array.newInstance(k.getType(),0).getClass();
+				DoubleKey findSetArray = new DoubleKey(arrayType,k.getName());
+				Method[] m2 = (Method[])propertyMethods.get(findSetArray);
+				IndexedPropertyDescriptor p;
+				if(m2 == null) {
+					p = new IndexedPropertyDescriptor(Introspector.decapitalize(k.getName()),
+				                                          null,null,
+				                                          m[GET_I],m[SET_I]);
+				} else {
+					if(constrained && m2[SET] != null) {
+						constrained = ArrayHelper.contains(m2[SET].getExceptionTypes(),java.beans.PropertyVetoException.class);
+					}
+					p = new IndexedPropertyDescriptor(Introspector.decapitalize(k.getName()),
+				                                          m2[GET],m2[SET],
+				                                          m[GET_I],m[SET_I]);
+				}
+				p.setConstrained(constrained);
+				if(!b.hasProperty(p)) {
+					b.addProperty(p);
+				}
+			}
+		}
+	}
+
+	static final int IS=0;
+	static final int GET_I=1;
+	static final int SET_I=2;
+	static final int GET=3;
+	static final int SET=4;
+
+	static final int ADD=0;
+	static final int REMOVE=1;
+
+	void addToPropertyHash(String name, Method method, int funcType) {
+		String newName;
+		Class type;
+
+		switch(funcType) {
+			case IS:
+				type = java.lang.Boolean.TYPE;
+				newName = name.substring(2);
+				break;
+			case GET_I:
+				type = method.getReturnType();
+				newName = name.substring(3);
+				break;
+			case SET_I:
+				type = method.getParameterTypes()[1];
+				newName = name.substring(3);
+				break;
+			case GET:
+				type = method.getReturnType();
+				newName = name.substring(3);
+				break;
+			case SET:
+				type = method.getParameterTypes()[0];
+				newName = name.substring(3);
+				break;
+			default:
+				return;
+		}
+		newName = capitalize(newName);
+		if (newName.length() == 0)
+			return;
+
+		DoubleKey k = new DoubleKey(type,newName);
+		Method[] methods = (Method[])propertyMethods.get(k);
+		if(methods == null) {
+			methods = new Method[5];
+			propertyMethods.put(k,methods);
+		}
+		methods[funcType] = method;
+	}
+
+	void addToListenerHash(String name, Method method, int funcType) {
+		String newName;
+		Class type;
+
+		switch(funcType) {
+			case ADD:
+				type = method.getParameterTypes()[0];
+				newName = name.substring(3,name.length()-8);
+				break;
+			case REMOVE:
+				type = method.getParameterTypes()[0];
+				newName = name.substring(6,name.length()-8);
+				break;
+			default:
+				return;
+		}
+		newName = capitalize(newName);
+		if (newName.length() == 0)
+			return;
+
+		DoubleKey k = new DoubleKey(type,newName);
+		Method[] methods = (Method[])listenerMethods.get(k);
+		if(methods == null) {
+			methods = new Method[2];
+			listenerMethods.put(k,methods);
+		}
+		methods[funcType] = method;
+	}
+
+	/* Determines whether <code>stopClass</code> is <code>null</code>
+	 * or <code>declaringClass<code> is a true subclass of <code>stopClass</code>.
+	 * This expression is useful to detect whether a method should be introspected or not.
+	 * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}.
+	 */
+	static boolean isReachable(Class stopClass, Class declaringClass) {
+		return stopClass == null || (stopClass.isAssignableFrom(declaringClass) && !stopClass.equals(declaringClass));
+	}
+
+	/** Transforms a property name into a part of a method name.
+	 * E.g. "value" becomes "Value" which can then concatenated with
+	 * "set", "get" or "is" to form a valid method name.
+	 * 
+	 * Implementation notes:
+	 * If "" is the argument, it is returned without changes.
+	 * If <code>null</code> is the argument, <code>null</code> is returned.
+	 * 
+	 * @param name Name of a property.
+	 * @return Part of a method name of a property.
+	 */
+	static String capitalize(String name) {
+		try {
+			if(Character.isUpperCase(name.charAt(0))) {
+				return name;
+			} else {
+				char[] c = name.toCharArray();
+				c[0] = Character.toLowerCase(c[0]);
+				return new String(c);
+			}
+		} catch(StringIndexOutOfBoundsException E) {
+			return name;
+		} catch(NullPointerException E) {
+			return null;
+		}
+	}
+}
+
+/** This class is a hashmap key that consists of a <code>Class</code> and a
+ * <code>String</code> element.
+ * 
+ * It is used for XXX: find out what this is used for
+ * 
+ * @author John Keiser
+ * @author Robert Schuster
+ */ 
+class DoubleKey {
+	Class type;
+	String name;
+
+	DoubleKey(Class type, String name) {
+		this.type = type;
+		this.name = name;
+	}
+
+	Class getType() {
+		return type;
+	}
+
+	String getName() {
+		return name;
+	}
+
+	public boolean equals(Object o) {
+		if(o instanceof DoubleKey) {
+			DoubleKey d = (DoubleKey)o;
+			return d.type.equals(type) && d.name.equals(name);
+		} else {
+			return false;
+		}
+	}
+
+	public int hashCode() {
+		return type.hashCode() ^ name.hashCode();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/TODO
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/TODO?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/TODO (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/TODO Thu Nov  8 16:56:19 2007
@@ -0,0 +1 @@
+- overhaul efficiency

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* gnu.java.beans.decoder.AbstractContext
+   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 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 gnu.java.beans.decoder;
+
+
+/** AbstractContext implements some basic functionality of the Context
+ * interface and is therefore the base of all Context implementations.
+ *
+ * @author Robert Schuster
+ */
+abstract class AbstractContext implements Context
+{
+  private boolean isStatement;
+  private String id;
+
+  public String getId()
+  {
+    return id;
+  }
+
+  public void setId(String newId)
+  {
+    id = newId;
+  }
+
+  public boolean isStatement()
+  {
+    return isStatement;
+  }
+
+  public void setStatement(boolean b)
+  {
+    isStatement = b;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractCreatableObjectContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,113 @@
+/* gnu.java.beans.decoder.AbstractCreatableContext
+   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 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 gnu.java.beans.decoder;
+
+
+/** AbstractCreatableObjectContext is the base class for all Context implementations
+ * which create a result object in their lifetime. It provides means for preventing
+ * to create the object twice.
+ *
+ * @author Robert Schuster
+ *
+ */
+abstract class AbstractCreatableObjectContext extends AbstractObjectContext
+{
+  AbstractCreatableObjectContext()
+  {
+  }
+
+  /** Adds a parameter object to this Context if the result object has not been
+   * created yet. Otherwise an AssemblyException is thrown that indicates a wrong
+   * behavior of the decoder.
+   */
+  public final void addParameterObject(Object o) throws AssemblyException
+  {
+    if (object == null)
+      addParameterObjectImpl(o);
+    else
+      throw new AssemblyException(new IllegalStateException("No more parameter objects are allowed when the object as already been created."));
+  }
+
+  /** Adds a parameter object to this Context. Implement this without caring
+   * for illegal states because this has been done already.
+   *
+   * @param obj The parameter object to be added. 
+   */
+  protected abstract void addParameterObjectImpl(Object obj);
+
+  /** Creates the result object if it does not exist already.
+   */
+  public final void notifyStatement(Context outerContext)
+    throws AssemblyException
+  {
+    if (object != null)
+      return;
+
+    object = createObject(outerContext);
+  }
+
+  /** Creates the result object. This method is called only once. Implement this
+   * without checking for double invocations as this is already being prevented.
+   *
+   * @param outerContext The Context that exists around this one. 
+   * @return The result object.
+   * @throws AssemblerException if the object creation fails somehow.
+   */
+  protected abstract Object createObject(Context outerContext)
+    throws AssemblyException;
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  public final Object endContext(Context outerContext)
+    throws AssemblyException
+  {
+    notifyStatement(outerContext);
+    return object;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#subContextFailed()
+   */
+  public boolean subContextFailed()
+  {
+    /* Returns true when the AbstractCreatableObjectContext has not created the result object yet
+     * (A failed subcontext automatically lets this context fail too.)
+     */
+    return object == null;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractElementHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,316 @@
+/* gnu.java.beans.decoder.AbstractElementHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+
+import org.xml.sax.Attributes;
+
+/** ElementHandler manages a Context instance and interacts with
+ * its parent and child handlers.
+ *
+ * @author Robert Schuster
+ */
+abstract class AbstractElementHandler implements ElementHandler
+{
+  /** The Context instance of this handler. The instance is available after the startElement()
+   * method was called. Otherwise the handler is marked as failed.
+   */
+  private Context context;
+
+  /** The parent handler. */
+  private ElementHandler parent;
+
+  /** Stores whether this handler is marked as failed. */
+  private boolean hasFailed;
+
+  /** Stores the character data which is contained in the body of the XML tag. */
+  private StringBuffer buffer = new StringBuffer();
+
+  /** Stores whether this ElementHandler can have subelements. The information for this is taken from
+   * javabeans.dtd which can be found here:
+   * <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3/">Java Persistence Article</a>
+   */
+  private boolean allowsSubelements;
+
+  /** Creates a new ElementHandler with the given ElementHandler instance
+   * as parent.
+   *
+   * @param parentHandler The parent handler.
+   */
+  protected AbstractElementHandler(ElementHandler parentHandler,
+                                   boolean allowsSubs)
+  {
+    parent = parentHandler;
+    allowsSubelements = allowsSubs;
+  }
+
+  /** Evaluates the attributes and creates a Context instance.
+   * If the creation of the Context instance fails the ElementHandler
+   * is marked as failed which may affect the parent handler other.
+   *
+   * @param attributes Attributes of the XML tag.
+   */
+  public final void start(Attributes attributes,
+                          ExceptionListener exceptionListener)
+  {
+    try
+      {
+	// lets the subclass create the appropriate Context instance
+	context = startElement(attributes, exceptionListener);
+      }
+    catch (AssemblyException pe)
+      {
+	Throwable t = pe.getCause();
+
+	if (t instanceof Exception)
+	  exceptionListener.exceptionThrown((Exception) t);
+	else
+	  throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report.");
+
+	notifyContextFailed();
+
+	return;
+      }
+  }
+
+  /** Analyses the content of the Attributes instance and creates a Context
+   * object accordingly.
+   * An AssemblerException is thrown when the Context instance could not
+   * be created.
+   *
+   * @param attributes Attributes of the XML tag.
+   * @return A Context instance.
+   * @throws AssemblerException when Context instance could not be created.
+   */
+  protected abstract Context startElement(Attributes attributes, ExceptionListener exceptionListener)
+    throws AssemblyException;
+
+  /** Post-processes the Context.
+   */
+  public final void end(ExceptionListener exceptionListener)
+  {
+    // skips processing if the handler is marked as failed (because the Context
+    // is then invalid or may not exist at all)
+    if (!hasFailed)
+      {
+	try
+	  {
+	    // note: the order of operations is very important here
+	    // sends the stored character data to the Context
+	    endElement(buffer.toString());
+
+	    // reports to the parent handler if this handler's Context is a
+	    // statement (returning no value BACK to the parent's Context)
+	    if (context.isStatement())
+	      {
+		// This may create a valid result in the parent's Context
+		// or let it fail
+		parent.notifyStatement(exceptionListener);
+
+		// skips any further processing if the parent handler is now marked
+		// as failed
+		if (parent.hasFailed())
+		  return;
+	      }
+
+	    // processes the Context and stores the result
+	    putObject(context.getId(), context.endContext(parent.getContext()));
+
+	    // transfers the Context's results to the parent's Context
+	    // if it is an expression (rather than a statement) 
+	    if (! context.isStatement())
+	      parent.getContext().addParameterObject(context.getResult());
+	  }
+	catch (AssemblyException pe)
+	  {
+	    // notifies that an exception was thrown in this handler's Context 
+	    Throwable t = pe.getCause();
+
+	    if (t instanceof Exception)
+	      exceptionListener.exceptionThrown((Exception) t);
+	    else
+	      throw (InternalError) new InternalError("Severe problem while decoding XML data.")
+	            .initCause(t);
+
+	    // marks the handler as failed
+	    notifyContextFailed();
+	  }
+      }
+  }
+
+  /** Notifies the handler's Context that its child Context will not return
+   * a value back. Some Context variants need this information to know when
+   * a method or a constructor call can be made.
+   *
+   * This method is called by a child handler.
+   */
+  public void notifyStatement(ExceptionListener exceptionListener)
+  {
+    try
+      {
+      	
+      	// propagates to parent handler first to generate objects
+      	// needed by this Context instance
+      	if(context.isStatement())
+      	{
+      		parent.notifyStatement(exceptionListener);
+      	}
+      	
+	// Some Context instances do stuff which can fail now. If that
+	// happens this handler is marked as failed.
+	context.notifyStatement(parent.getContext());
+      }
+    catch (AssemblyException ae)
+      {
+	// notifies that an exception was thrown in this handler's Context 
+	Throwable t = ae.getCause();
+
+	if (t instanceof Exception)
+	  exceptionListener.exceptionThrown((Exception) t);
+	else
+	  throw (InternalError) new InternalError("Severe problem while decoding XML data.")
+	        .initCause(t);
+
+	// marks the handler as failed
+	notifyContextFailed();
+      }
+  }
+
+  /** Marks this and any depending parent handlers as failed. Which means that on their end
+   * no result is calculated.
+   *
+   * When a handler has failed no more handlers are accepted within it.
+   */
+  public final void notifyContextFailed()
+  {
+    hasFailed = true;
+
+    // marks the parent handler as failed if its Context
+    // is affected by the failure of this handler's Context
+    if (parent.getContext().subContextFailed())
+      parent.notifyContextFailed();
+  }
+
+  /** Returns whether this handler has failed.
+   *
+   * This is used to skip child elements.
+   *
+   * @return Whether this handler has failed.
+   */
+  public final boolean hasFailed()
+  {
+    return hasFailed;
+  }
+
+  /** Processes the character data when the element ends.
+   *
+   * The default implementation does nothing for convenience.
+   *
+   * @param characters
+   * @throws AssemblerException
+   */
+  protected void endElement(String characters) throws AssemblyException
+  {
+    // XXX: throw an exception when unexpected character data is available?
+  }
+
+  /** Adds characters from the body of the XML tag to the buffer.
+   *
+   * @param ch
+   * @param start
+   * @param length
+   * @throws SAXException
+   */
+  public final void characters(char[] ch, int start, int length)
+  {
+    // simply appends character data
+    buffer.append(ch, start, length);
+  }
+
+  /** Stores an object globally under a unique id. If the id is
+   * null the object is not stored.
+   *
+   * @param objectId
+   * @param o
+   */
+  public void putObject(String objectId, Object o)
+  {
+    if (objectId != null)
+      parent.putObject(objectId, o);
+  }
+
+  /** Returns a previously stored object. If the id is null the
+   * result is null, too.
+   *
+   * @param objectId
+   * @return Returns a previously stored object or null.
+   */
+  public Object getObject(String objectId) throws AssemblyException
+  {
+    return objectId == null ? null : parent.getObject(objectId);
+  }
+
+  /** Returns the Class instance as if called Class.forName() but
+   * uses a ClassLoader given by the user.
+   *
+   * @param className
+   * @return
+   * @throws ClassNotFoundException
+   */
+  public Class instantiateClass(String className)
+    throws ClassNotFoundException
+  {
+    return parent.instantiateClass(className);
+  }
+
+  public final boolean isSubelementAllowed(String subElementName)
+  {
+    return allowsSubelements && ! subElementName.equals("java");
+  }
+
+  public final Context getContext()
+  {
+    return context;
+  }
+
+  public final ElementHandler getParent()
+  {
+    return parent;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AbstractObjectContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,127 @@
+/* gnu.java.beans.decoder.AbstractObjectContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/** AbstractObjectContext is the base for all Context implementations which
+ * create or provide a result object during their lifetime.
+ *
+ * <p>This class provides the implementation for an indexed get and set method.
+ * But this does not mean that the result object supports these operation.</p>
+ *
+ * @author Robert Schuster
+ *
+ */
+abstract class AbstractObjectContext extends AbstractContext
+{
+    protected Object object;
+
+    AbstractObjectContext()
+    {}
+
+    /** Sets the result object of the Context.
+     *
+     * @param obj The result object to be set.
+     */
+    protected final void setObject(Object obj)
+    {
+        object = obj;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object)
+     */
+    public final void set(int index, Object o) throws AssemblyException
+    {
+        try
+        {
+            Method method =
+                object.getClass().getMethod(
+                    "set",
+                    new Class[] { Integer.TYPE, Object.class });
+
+            method.invoke(object, new Object[] { new Integer(index), o });
+        }
+        catch (NoSuchMethodException nsme)
+        {
+            throw new AssemblyException(nsme);
+        }
+        catch (InvocationTargetException ite)
+        {
+            throw new AssemblyException(ite.getCause());
+        }
+        catch (IllegalAccessException iae)
+        {
+            throw new AssemblyException(iae);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#get(int)
+     */
+    public final Object get(int index) throws AssemblyException
+    {
+        try
+        {
+            Method method =
+                object.getClass().getMethod(
+                    "get",
+                    new Class[] { Integer.TYPE });
+
+            return method.invoke(object, new Object[] { new Integer(index)});
+        }
+        catch (NoSuchMethodException nsme)
+        {
+            throw new AssemblyException(nsme);
+        }
+        catch (InvocationTargetException ite)
+        {
+            throw new AssemblyException(ite.getCause());
+        }
+        catch (IllegalAccessException iae)
+        {
+            throw new AssemblyException(iae);
+        }
+    }
+
+    public final Object getResult()
+    {
+        return object;
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,122 @@
+/* gnu.java.beans.decoder.ArrayContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.Array;
+
+/** A Context implementation for a fixed size array. The array
+ * elements have to be set using IndexContext instances.
+ *
+ * @author Robert Schuster
+ */
+class ArrayContext extends AbstractContext
+{
+  private Object array;
+
+  ArrayContext(String id, Class klass, int length)
+  {
+    setId(id);
+    array = Array.newInstance(klass, length);
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  public void addParameterObject(Object o) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalStateException("Adding objects without an index to a fixed array is not possible."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#reportStatement()
+   */
+  public void notifyStatement(Context outerContext)
+  {
+    // method call intentionally ignored because there is not any useful effect 
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  public Object endContext(Context outerContext) throws AssemblyException
+  {
+    return array;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#subContextFailed()
+   */
+  public boolean subContextFailed()
+  {
+    // returns false to indicate that assembling the array does not fail only because
+    // a subelement failed.
+    return false;
+  }
+
+  public void set(int index, Object o) throws AssemblyException
+  {
+    try
+      {
+	Array.set(array, index, o);
+      }
+    catch (ArrayIndexOutOfBoundsException aioobe)
+      {
+	throw new AssemblyException(aioobe);
+      }
+  }
+
+  public Object get(int index) throws AssemblyException
+  {
+    try
+      {
+	return Array.get(array, index);
+      }
+    catch (ArrayIndexOutOfBoundsException aioobe)
+      {
+	throw new AssemblyException(aioobe);
+      }
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#getResult()
+   */
+  public Object getResult()
+  {
+    return array;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* gnu.java.beans.decoder.ArrayHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+import java.util.HashMap;
+
+import org.xml.sax.Attributes;
+
+/** ArrayHandler processes the <array> tag. Depending on the existance of the 'length' attribute a Context for
+ * a fixed-size or growable array is created.
+ *
+ * @author Robert Schuster
+ */
+class ArrayHandler extends AbstractElementHandler
+{
+  /** Contains a mapping between a textual description of a primitive type (like "byte") and
+   * its corresponding wrapper class. This allows it to easily construct Array objects for
+   * primitive data types.
+   */
+  private static HashMap typeMap = new HashMap();
+
+  static
+    {
+      typeMap.put("byte", Byte.TYPE);
+      typeMap.put("short", Short.TYPE);
+      typeMap.put("int", Integer.TYPE);
+      typeMap.put("long", Long.TYPE);
+
+      typeMap.put("float", Float.TYPE);
+      typeMap.put("double", Double.TYPE);
+
+      typeMap.put("boolean", Boolean.TYPE);
+
+      typeMap.put("char", Character.TYPE);
+    }
+
+  /**
+   * @param PersistenceParser
+   */
+  ArrayHandler(ElementHandler parent)
+  {
+    super(parent, true);
+  }
+
+  protected Context startElement(Attributes attributes, ExceptionListener exceptionListener)
+    throws AssemblyException, AssemblyException
+  {
+    String id = attributes.getValue("id");
+    String className = attributes.getValue("class");
+
+    if (className != null)
+      {
+	try
+	  {
+	    Class klass;
+
+	    if (typeMap.containsKey(className))
+	      klass = (Class) typeMap.get(className);
+	    else
+	      klass = instantiateClass(className);
+
+	    String length = attributes.getValue("length");
+	    if (length != null)
+	      // creates Array with predefined length
+	      return new ArrayContext(id, klass, Integer.parseInt(length));
+	    else
+	      // creates Array without length restriction
+	      return new GrowableArrayContext(id, klass);
+	  }
+	catch (ClassNotFoundException cnfe)
+	  {
+	    throw new AssemblyException(cnfe);
+	  }
+	catch (NumberFormatException nfe)
+	  {
+	    throw new AssemblyException(nfe);
+	  }
+      }
+
+    throw new AssemblyException(new IllegalArgumentException("Missing 'class' attribute in <array> tag."));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/AssemblyException.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,57 @@
+/* gnu.java.beans.decoder.AssemblyException
+   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 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 gnu.java.beans.decoder;
+
+
+/** The AssemblyException is used to wrap the cause of problems when assembling objects.
+ * In all cases only the wrapped exception is given to the PersistenceParser's
+ * ExceptionListener instance (never the AssemblyException itself).
+ * 
+ * <p>Note: Often multiple steps are needed to construct a fully usuable object instance.
+ * Such a construction can be called assembly and thats why this exception was
+ * named AssemblyException.</p>
+ *
+ * @author Robert Schuster
+ */
+class AssemblyException extends Exception
+{
+  AssemblyException(Throwable cause)
+  {
+    super(cause);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,67 @@
+/* gnu.java.beans.decoder.BooleanHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Boolean instance from the character data in a <boolean> tag.
+ *
+ * @author Robert Schuster
+ */
+class BooleanHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  BooleanHandler(ElementHandler parent)
+  {
+    super(parent);
+
+    // TODO Auto-generated constructor stub
+  }
+
+  protected Object parse(String number) throws AssemblyException
+  {
+    if (number.equals("true"))
+      return Boolean.TRUE;
+
+    if (number.equals("false"))
+      return Boolean.FALSE;
+
+    throw new AssemblyException(new IllegalArgumentException("Element contained no valid boolean value."));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ByteHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* gnu.java.beans.decoder.ByteHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Byte instance from the character data in a <byte> tag.
+ *
+ * @author Robert Schuster
+ */
+class ByteHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  ByteHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws NumberFormatException
+  {
+    return Byte.valueOf(number);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/CharHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/CharHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/CharHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/CharHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* gnu.java.beans.decoder.CharHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Character instance from the character data in a <char> tag.
+ *
+ * @author Robert Schuster
+ */
+class CharHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  CharHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws AssemblyException
+  {
+    if (number.length() > 1)
+      throw new AssemblyException(new IllegalArgumentException("Element contained no valid character."));
+
+    return new Character(number.charAt(0));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ClassHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* gnu.java.beans.decoder.ClassHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Class instance from the character data in a <class> tag.
+ *
+ * @author Robert Schuster
+ */
+class ClassHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  ClassHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String characters) throws AssemblyException
+  {
+    try
+      {
+	return instantiateClass(characters);
+      }
+    catch (ClassNotFoundException cnfe)
+      {
+	throw new AssemblyException(cnfe);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ConstructorContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,102 @@
+/* gnu.java.beans.decoder.ConstructorContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+/** A ConstructorContext is a {@link Context} implementation which collects the parameters for a constructor
+ * call and instantiates the result object using that constructor. After that sub-contexts can invoke
+ * methods on the result object.
+ *
+ * <p>The constructor is invoked when a sub-context is a statement or the Context ends.</p>
+ *
+ * @author Robert Schuster
+ */
+class ConstructorContext extends AbstractCreatableObjectContext
+{
+  private ArrayList arguments = new ArrayList();
+  private Class klass;
+
+  ConstructorContext(String id, Class newClass)
+  {
+    setId(id);
+    // sets superclass field 
+    klass = newClass;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  protected void addParameterObjectImpl(Object o)
+  {
+    arguments.add(o);
+  }
+
+  protected Object createObject(Context outerContext)
+    throws AssemblyException
+  {
+    Object[] args = arguments.toArray();
+
+    try
+      {
+	Constructor constructor = MethodFinder.getConstructor(klass, args);
+
+	// instantiates object (klass field gets re-set by superclass)
+	return constructor.newInstance(args);
+      }
+    catch (NoSuchMethodException nsme)
+      {
+	throw new AssemblyException(nsme);
+      }
+    catch (InvocationTargetException ite)
+      {
+	throw new AssemblyException(ite.getCause());
+      }
+    catch (IllegalAccessException iae)
+      {
+	throw new AssemblyException(iae);
+      }
+    catch (InstantiationException ie)
+      {
+	throw new AssemblyException(ie);
+      }
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/Context.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/Context.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/Context.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/Context.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,137 @@
+/* gnu.java.beans.decoder.Context
+   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 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 gnu.java.beans.decoder;
+
+/** A Context is the environment for an object which is being assembler. If there
+ * are no errors each handler creates one Context.
+ * <p>Depending on the result of isStatement() a Context can be statement or an
+ * expression. An expression returns a value to the Context of its parent handler,
+ * a statement does not. Whenever a Context is a statement the parent handler's
+ * Context is informed about that through the {@link notifyStatement}-method.</p>
+ *
+ * @author Robert Schuster
+ */
+interface Context
+{
+  /** Adds a parameter object to the context. This method is used when
+   * sub-Contexts return their result.
+   *
+   * Some Contexts do not accept more than a certain amount of objects
+   * and throw an AssemblerException if the amount is exceeded.
+   *
+   * @param o The object added to this context.
+   */
+  void addParameterObject(Object o) throws AssemblyException;
+
+  /** Notifies that the next element is a statement. This can mean
+   * that an argument list is complete to be called.
+   *
+   */
+  void notifyStatement(Context outerContext) throws AssemblyException;
+
+  /** Notifies that the context ends and the returns the appropriate result
+   * object.
+   *
+   * @param outerContext
+   * @return
+   */
+  Object endContext(Context outerContext) throws AssemblyException;
+
+  /** Notifies that the assembly of a subcontext failed and returns
+   * whether this Context is affected in a way that it fails too.
+   *
+   * @return Whether the failure of a subcontext lets this context fail, too.
+   */
+  boolean subContextFailed();
+
+  /** Calls an appropriate indexed set method if it is available or
+   * throws an AssemblerException if that is not allowed on this Context.
+   *
+   * The behaviour of this method is equal to List.set(int, Object).
+   *
+   * @param index Index position to be set.
+   * @param o Object to be set at the given index position.
+   * @throws AssemblerException Indexed set is not allowed or otherwise failed.
+   */
+  void set(int index, Object o) throws AssemblyException;
+
+  /** Calls an appropriate indexed get method if it is available or
+   * throws an AssemblerException if that is not allowed on this Context.
+   *
+   * The behaviour of this method is equal to List.get(int).
+   *
+   * @param index Index position of the object return.
+   * @throws AssemblerException Indexed get is not allowed or otherwise failed.
+   */
+  Object get(int index) throws AssemblyException;
+
+  /** Returns the result which was calculated by calling endContext() or reportStatement().
+   * Its the handler's responsibility to care that any of these two methods was called.
+   *
+   * This is used by sub-Contexts to access this Context's result.
+   *
+   * @return
+   */
+  Object getResult();
+
+  /** Gives this Context a unique id. For convenience the id may be null which means
+   * that no id exists at all.
+   *
+   * @param id
+   */
+  void setId(String id);
+
+  /** Returns this Context's unique id or null if does not have such an id.
+   *
+   * @return This Context's id or null.
+   */
+  String getId();
+
+  /** Returns whether this Context is a statement (not returning result back
+   * to parent handler's Context) or not (= expression).
+   *
+   * @return
+   */
+  boolean isStatement();
+
+  /** Sets whether this Context is a statement or not.
+   *
+   * @param b
+   */
+  void setStatement(boolean b);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DecoderContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,124 @@
+/* gnu.java.beans.decoder.DecoderContext
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.XMLDecoder;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/** DecoderContext is a Context implementation which allows access to
+ * the XMLDecoder instance itself. This is used for the <java> tag.
+ *
+ * @author Robert Schuster
+ */
+public class DecoderContext extends AbstractContext
+{
+  private XMLDecoder decoder;
+
+  public DecoderContext(XMLDecoder xmlDecoder)
+  {
+    decoder = xmlDecoder;
+  }
+
+  private ArrayList objects = new ArrayList();
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  public void addParameterObject(Object o) throws AssemblyException
+  {
+    objects.add(o);
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#reportStatement()
+   */
+  public void notifyStatement(Context outerContext) throws AssemblyException
+  {
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  public Object endContext(Context outerContext) throws AssemblyException
+  {
+    return decoder;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#subContextFailed()
+   */
+  public boolean subContextFailed()
+  {
+    return false;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object)
+   */
+  public void set(int index, Object o) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalArgumentException("Set method is not allowed in decoder context."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#get(int)
+   */
+  public Object get(int index) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalArgumentException("Get method is not allowed in decoder context."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#getResult()
+   */
+  public Object getResult()
+  {
+    return decoder;
+  }
+
+  /** Returns an Iterator that retrieves the assembled objects.
+   * 
+   * @return An Iterator retrieving assembled objects.
+   */
+  public Iterator iterator()
+  {
+    return objects.iterator();
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DoubleHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* gnu.java.beans.decoder.DoubleHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Double instance from the character data in a <double> tag.
+ *
+ * @author Robert Schuster
+ */
+class DoubleHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  DoubleHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws NumberFormatException
+  {
+    return Double.valueOf(number);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,116 @@
+/* gnu.java.beans.decoder.DummyContext
+   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 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 gnu.java.beans.decoder;
+
+/** The DummyContext is used as the Context implementation for the DummyHandler. It
+ * just prevents having a null-reference.
+ *
+ * <p>When the implementation is correct none of this class' methods
+ * (except <code>notifyStatement()</code>) is called.</p>
+ *
+ * @author Robert Schuster
+ */
+public class DummyContext extends AbstractContext
+{
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+     */
+    public void addParameterObject(Object o) throws AssemblyException
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#reportStatement()
+     */
+    public void notifyStatement(Context outerContext) throws AssemblyException
+    {
+    	// intentionally ignored
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+     */
+    public Object endContext(Context outerContext) throws AssemblyException
+    {
+        fail();
+	return null;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#subContextFailed()
+     */
+    public boolean subContextFailed()
+    {
+        fail();
+	return false;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object)
+     */
+    public void set(int index, Object o) throws AssemblyException
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#get(int)
+     */
+    public Object get(int index) throws AssemblyException
+    {
+        fail();
+	return null;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#getResult()
+     */
+    public Object getResult()
+    {
+        fail();
+	return null;
+    }
+
+    private void fail()
+    {
+        throw new InternalError("Invoking the DummyContext is not expected"
+				+ " - Please file a bug report at"
+				+ " http://www/gnu.org/software/classpath/.");
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/DummyHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,156 @@
+/* gnu.java.beans.decoder.DummyHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+
+import org.xml.sax.Attributes;
+
+/** An ElementHandler implementation that is used as an artificial root
+ * element. This avoids having to check for a null element.
+ *
+ * @author Robert Schuster
+ */
+class DummyHandler implements ElementHandler
+{
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#start(org.xml.sax.Attributes, java.beans.ExceptionListener)
+     */
+    public void start(
+        Attributes attributes,
+        ExceptionListener exceptionListener)
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#end(java.beans.ExceptionListener)
+     */
+    public void end(ExceptionListener exceptionListener)
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#characters(char[], int, int)
+     */
+    public void characters(char[] ch, int start, int length)
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#isSubelementAllowed(java.lang.String)
+     */
+    public boolean isSubelementAllowed(String subElementName)
+    {
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#instantiateClass(java.lang.String)
+     */
+    public Class instantiateClass(String className)
+        throws ClassNotFoundException
+    {
+        fail();
+	return null;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#reportStatement(java.beans.ExceptionListener)
+     */
+    public void notifyStatement(ExceptionListener exceptionListener)
+    {
+        // ignore
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#hasFailed()
+     */
+    public boolean hasFailed()
+    {
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#getContext()
+     */
+    public Context getContext()
+    {
+        return new DummyContext();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#contextFailed()
+     */
+    public void notifyContextFailed()
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#putObject(java.lang.String, java.lang.Object)
+     */
+    public void putObject(String objectId, Object o)
+    {
+        fail();
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.ElementHandler#getObject(java.lang.String)
+     */
+    public Object getObject(String objectId)
+    {
+        fail();
+	return null;
+    }
+
+    public ElementHandler getParent()
+    {
+        fail();
+	return null;
+    }
+
+    private void fail()
+    {
+        throw new InternalError("Invoking the DummyHandler is not expected"
+			        + " - Please file a bug report at "
+				+ " http://www.gnu.org/software/classpath/.");
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ElementHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,130 @@
+/* gnu.java.beans.decoder.ElementHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+
+import org.xml.sax.Attributes;
+
+/** ElementHandler manages a Context instance and interacts with
+ * its parent and child handlers.
+ *
+ * @author Robert Schuster
+ */
+interface ElementHandler
+{
+  /** Evaluates the attributes and creates a Context instance.
+   * If the creation of the Context instance fails the ElementHandler
+   * is marked as failed which may affect the parent handler other.
+   *
+   * @param attributes Attributes of the XML tag.
+   */
+  void start(Attributes attributes, ExceptionListener exceptionListener);
+
+  /** Post-processes the Context.
+   */
+  void end(ExceptionListener exceptionListener);
+
+  /** Adds characters from the body of the XML tag to the buffer.
+   *
+   * @param ch
+   * @param start
+   * @param length
+   * @throws SAXException
+   */
+  void characters(char[] ch, int start, int length);
+
+  /** Returns whether a subelement of the given name is allowed. The rules
+   * for evaluating this are derived from the javabeans.dtd which can be found
+   * here: <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3">Java Persistence Article</a>.
+   * 
+   * @param subElementName 
+   * @return
+   */
+  boolean isSubelementAllowed(String subElementName);
+
+  /** Provides the same functionality as Class.forName() but allows the decoder
+   * to use a different class loader.
+   * 
+   * @param className
+   * @return
+   * @throws ClassNotFoundException
+   */ 
+  Class instantiateClass(String className) throws ClassNotFoundException;
+
+  /** Notifies the handler's Context that its child Context will not return
+   * a value back. Some Context variants need this information to know when
+   * a method or a constructor call can be made.
+   *
+   * This method is called by a child handler.
+   */
+  void notifyStatement(ExceptionListener exceptionListener);
+
+  /** Returns whether this handler has failed.
+   *
+   * This is used to skip child elements.
+   *
+   * @return Whether this handler has failed.
+   */
+  boolean hasFailed();
+
+  /** Returns the Context instance this handler is working on.
+   * 
+   * @return The handler's Context instance.
+   */
+  Context getContext();
+
+  /** Notifies the handler that its Context failed and starts a recursive
+   * invocation of the parent handler if it is affected by that failure.
+   * 
+   * Although the method is a public API member it is only used internally.
+   */
+  void notifyContextFailed();
+
+  /** Stores the object under the given id. The object is not stored if the
+   * id is null.
+   * 
+   * @param objectId
+   * @param o
+   */
+  void putObject(String objectId, Object o);
+
+  Object getObject(String objectId) throws AssemblyException;
+
+  ElementHandler getParent();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/FloatHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* gnu.java.beans.decoder.FloatHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Float instance from the character data in a <float> tag.
+ *
+ * @author Robert Schuster
+ */
+class FloatHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  FloatHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws NumberFormatException
+  {
+    return Float.valueOf(number);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/GrowableArrayContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,138 @@
+/* gnu.java.beans.decoder.GrowableArrayContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.Array;
+
+/** A Context implementation for a growable array. The array
+ * elements have to be set using expressions.
+ *
+ * @author Robert Schuster
+ */
+class GrowableArrayContext extends AbstractContext
+{
+    private static final int INITIAL_SIZE = 16;
+    
+    private Class klass;
+    private Object array;
+    private int length;
+    
+    GrowableArrayContext(String id, Class newClass)
+    {
+        setId(id);
+        klass = newClass;
+        array = Array.newInstance(klass, INITIAL_SIZE);
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+     */
+    public void addParameterObject(Object o) throws AssemblyException
+    {
+      if (length == Array.getLength(array))
+        {
+          Object tmp = Array.newInstance(klass, length * 2);
+          System.arraycopy(array, 0, tmp, 0, length);
+          array = tmp;
+        }
+        
+      try {
+        Array.set(array, length++, o);
+      } catch(IllegalArgumentException iae) {
+        throw new AssemblyException(iae);
+      }
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#reportStatement()
+     */
+    public void notifyStatement(Context outerContext) throws AssemblyException
+    {
+        throw new AssemblyException(
+            new IllegalArgumentException("Statements inside a growable array are not allowed."));
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+     */
+    public Object endContext(Context outerContext) throws AssemblyException
+    {
+        if (length != Array.getLength(array))
+          {
+            Object tmp = Array.newInstance(klass, length);
+            System.arraycopy(array, 0, tmp, 0, length);
+            array = tmp;
+          }
+        
+        return array;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#subContextFailed()
+     */
+    public boolean subContextFailed()
+    {
+        // returns false to indicate that assembling the array does not fail only because
+        // a subelement failed
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object)
+     */
+    public void set(int index, Object o) throws AssemblyException
+    {
+      try {
+        Array.set(array, index, o);
+      } catch(IllegalArgumentException iae) {
+        throw new AssemblyException(iae);   
+      }
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#get(int)
+     */
+    public Object get(int index) throws AssemblyException
+    {
+      return Array.get(array, index);
+    }
+
+    public Object getResult()
+    {
+        return array;
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IndexContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IndexContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IndexContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IndexContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,130 @@
+/* gnu.java.beans.decoder.IndexContext
+   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 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 gnu.java.beans.decoder;
+
+/** IndexContext is Context implementation that senses whether it is an indexed get or set
+ * operation and invokes this operation.
+ *
+ * <p>An IndexContent is a get operation when no argument is provided and a set operation if one
+ * argument is provided.</p>
+ *
+ * @author Robert Schuster
+ */
+class IndexContext extends AbstractContext
+{
+  private Object result;
+  private Object argument;
+  private int index;
+  private boolean isSetter;
+
+  IndexContext(String id, int newIndex)
+  {
+    setId(id);
+    index = newIndex;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  public void addParameterObject(Object o) throws AssemblyException
+  {
+    if (! isSetter)
+      {
+	argument = o;
+	isSetter = true;
+      }
+    else
+      throw new AssemblyException(new IllegalStateException("More than one argument for indiced access is not possible."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#reportStatement()
+   */
+  public void notifyStatement(Context outerContext) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalStateException("Statements inside indiced access are not allowed."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  public Object endContext(Context outerContext) throws AssemblyException
+  {
+    if (isSetter)
+      {
+	// setter
+	outerContext.set(index, argument);
+
+	return null;
+      }
+    else
+      // getter
+      return result = outerContext.get(index);
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#subContextFailed()
+   */
+  public boolean subContextFailed()
+  {
+    // returns true to indicate that indiced access assembly fails when one of its
+    // argument could not be assembled
+    return true;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object)
+   */
+  public void set(int index, Object o) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalStateException("Setter is not allowed inside indiced access."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#get(int)
+   */
+  public Object get(int index) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalStateException("getter is not allowed insided indiced access."));
+  }
+
+  public Object getResult()
+  {
+    return result;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IntHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IntHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IntHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/IntHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* gnu.java.beans.decoder.IntHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Integer instance from the character data in a <int> tag.
+ *
+ * @author Robert Schuster
+ */
+class IntHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  IntHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws NumberFormatException
+  {
+    return Integer.valueOf(number);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/JavaHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,93 @@
+/* gnu.java.beans.decoder.JavaHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+import java.util.HashMap;
+
+import org.xml.sax.Attributes;
+
+/** Wraps a DecoderContext instance.
+ *
+ * @author Robert Schuster
+ */
+public class JavaHandler extends AbstractElementHandler
+{
+  private Context context;
+  private HashMap objectMap = new HashMap();
+  private ClassLoader classLoader;
+
+  /**
+   * @param PersistenceParser
+   */
+  JavaHandler(DummyHandler parent, Context decoderContext,
+              ClassLoader cl)
+  {
+    super(parent, true);
+
+    classLoader = cl;
+
+    context = decoderContext;
+
+  }
+
+  protected Context startElement(Attributes attributes, ExceptionListener exceptionListener)
+    throws AssemblyException
+  {
+    // may expect version and class attribute but it not used in JDK 
+    // so we do either
+    return context;
+  }
+
+  public Object getObject(String objectId)
+  {
+    return objectMap.get(objectId);
+  }
+
+  public void putObject(String objectId, Object o)
+  {
+    if (objectId != null)
+      objectMap.put(objectId, o);
+  }
+
+  public Class instantiateClass(String className)
+    throws ClassNotFoundException
+  {
+    return Class.forName(className, false, classLoader);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/LongHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/LongHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/LongHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/LongHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* gnu.java.beans.decoder.LongHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Creates a Long instance from the character data in a <long> tag.
+ *
+ * @author Robert Schuster
+ */
+class LongHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  LongHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws NumberFormatException
+  {
+    return Long.valueOf(number);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,107 @@
+/* gnu.java.beans.decoder.MethodContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+/** MethodContext collects arguments for a method call and creates the result object
+ * using it. The method is called using the result object of the parent Context.
+ *
+ * <p>When the result object is available methods can be called on it using sub-Contexts.</p>
+ *
+ * @author Robert Schuster
+ */
+class MethodContext extends AbstractCreatableObjectContext
+{
+    private ArrayList arguments = new ArrayList();
+    private String methodName;
+
+    MethodContext(String id, String newMethodName)
+    {
+        setId(id);
+        setStatement(true);
+        methodName = newMethodName;
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+     */
+    public void addParameterObjectImpl(Object o)
+    {
+        arguments.add(o);
+    }
+
+    /* (non-Javadoc)
+     * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+     */
+    protected Object createObject(Context outerContext)
+        throws AssemblyException
+    {
+        Object outerObject = outerContext.getResult();
+
+        if (outerObject == null)
+            throw new AssemblyException(
+                new NullPointerException(
+                    "No object to invoke method " + methodName));
+
+        Object[] args = arguments.toArray();
+
+        try
+        {
+            Method method =
+                MethodFinder.getMethod(
+                    outerObject.getClass(),
+                    methodName,
+                    args);
+            return method.invoke(outerObject, args);
+        }
+        catch (NoSuchMethodException nsme)
+        {
+            throw new AssemblyException(nsme);
+        }
+        catch (InvocationTargetException ite)
+        {
+            throw new AssemblyException(ite.getCause());
+        }
+        catch (IllegalAccessException iae)
+        {
+            throw new AssemblyException(iae);
+        }
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/MethodFinder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,177 @@
+/* gnu.java.beans.decoder.MethodFinder
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+class MethodFinder
+{
+	/** Provides a mapping between a wrapper class and its corresponding primitive's type. */
+	private static HashMap typeMapping = new HashMap();
+
+	static {
+		typeMapping.put(Byte.class, Byte.TYPE);
+		typeMapping.put(Short.class, Short.TYPE);
+		typeMapping.put(Integer.class, Integer.TYPE);
+		typeMapping.put(Long.class, Long.TYPE);
+		typeMapping.put(Float.class, Float.TYPE);
+		typeMapping.put(Double.class, Double.TYPE);
+
+		typeMapping.put(Character.class, Character.TYPE);
+		typeMapping.put(Boolean.class, Boolean.TYPE);
+	}
+
+	private MethodFinder()
+	{
+	}
+
+	/** Searches a Method which can accept the given arguments.
+	 *
+	 * @param klass
+	 * @param name
+	 * @param arguments
+	 * @return
+	 * @throws NoSuchMethodException
+	 */
+	static Method getMethod(Class klass, String name, Object[] arguments)
+		throws NoSuchMethodException
+	{
+		// prepares array containing the types of the arguments
+		Class[] argumentTypes = getArgumentTypes(arguments);
+
+		Method[] methods = klass.getMethods();
+
+		// iterates over all public methods
+		for (int i = 0; i < methods.length; i++)
+		{
+			if (methods[i].getName().equals(name))
+			{
+				if (matchingArgumentTypes(methods[i].getParameterTypes(),
+					argumentTypes))
+					return methods[i];
+			}
+		}
+
+		throw new NoSuchMethodException(
+			"Could not find a matching method named "
+				+ name
+				+ "() in class "
+				+ klass);
+	}
+
+	static Constructor getConstructor(Class klass, Object[] arguments)
+		throws NoSuchMethodException
+	{
+		Class[] argumentTypes = getArgumentTypes(arguments);
+		Constructor[] constructors = klass.getConstructors();
+
+		// iterates over all public methods
+		for (int i = 0; i < constructors.length; i++)
+		{
+			if (matchingArgumentTypes(constructors[i].getParameterTypes(),
+				argumentTypes))
+				return constructors[i];
+		}
+
+		throw new NoSuchMethodException(
+			"Could not find a matching constructor in class " + klass);
+	}
+
+	/** Transforms an array of argument objects into an array of argument types.
+	 * For each argument being null the argument is null, too. An argument type
+	 * being null means: Accepts everything (although this can be ambigous).
+	 * 
+	 * @param arguments
+	 * @return
+	 */
+	private static Class[] getArgumentTypes(Object[] arguments)
+	{
+		if (arguments == null)
+			return new Class[0];
+
+		// prepares array containing the types of the arguments
+		Class[] argumentTypes = new Class[arguments.length];
+		for (int i = 0; i < arguments.length; i++)
+			argumentTypes[i] =
+				(arguments[i] == null) ? null : arguments[i].getClass();
+		return argumentTypes;
+	}
+
+	/** Tests whether the argument types supplied to the method argument types
+	 * are assignable. In addition to the assignment specifications this method
+	 * handles the primitive's wrapper classes as if they were of their
+	 * primitive type (e.g Boolean.class equals Boolean.TYPE).
+	 * When a supplied argument type is null it is assumed that no argument
+	 * object was supplied for it and the test for this particular parameter will
+	 * pass.
+	 *
+	 * @param methodArgTypes
+	 * @param suppliedArgTypes
+	 * @return
+	 */
+	private static boolean matchingArgumentTypes(
+		Class[] methodArgTypes,
+		Class[] suppliedArgTypes)
+	{
+		if (methodArgTypes.length != suppliedArgTypes.length)
+			return false;
+
+		for (int i = 0; i < methodArgTypes.length; i++)
+		{
+			if (suppliedArgTypes[i] == null)
+			{
+				// by definition a non-existant argument type (null) can be converted to everything
+				continue;
+			}
+			else if (typeMapping.containsKey(suppliedArgTypes[i]))
+			{
+				Class primitiveType =
+					(Class) typeMapping.get(suppliedArgTypes[i]);
+				if (!(methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i])
+					|| methodArgTypes[i].isAssignableFrom(primitiveType)))
+					return false;
+			}
+			else if (!methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i]))
+				return false;
+		}
+
+		return true;
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/NullHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/NullHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/NullHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/NullHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* gnu.java.beans.decoder.NullHandler
+   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 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 gnu.java.beans.decoder;
+
+
+/** Just provides the 'null' object.
+ *
+ * @author Robert Schuster
+ */
+class NullHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  NullHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String characters) throws AssemblyException
+  {
+    if (! characters.equals(""))
+      throw new AssemblyException(new IllegalArgumentException("No characters inside <void> tag allowed."));
+
+    return null;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* gnu.java.beans.decoder.ObjectHandler
+   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 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 gnu.java.beans.decoder;
+
+/** ObjectContext is a {@link Context} implementation that wraps a simple Object instance.
+ * The instance can be provided when the Context is created (due to an 'idref'
+ * attribute) or later (eg. <int> tag)
+ *
+ * <p>The ObjectContext does not accept any parameter object and ignores notifications
+ * about sub-contexts being statements.</p>
+ *
+ * @author Robert Schuster
+ */
+final class ObjectContext extends AbstractObjectContext
+{
+  ObjectContext(Object newObject)
+  {
+    setObject(newObject);
+  }
+
+  ObjectContext(String id, Object newObject)
+  {
+    setId(id);
+    setObject(newObject);
+  }
+
+  ObjectContext()
+  {
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  public void addParameterObject(Object o) throws AssemblyException
+  {
+    throw new AssemblyException(new IllegalArgumentException("Adding objects to an ObjectContext is not allowed."));
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#reportStatement()
+   */
+  public void notifyStatement(Context outerContext) throws AssemblyException
+  {
+    // can ignore that
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  public Object endContext(Context outerContext) throws AssemblyException
+  {
+    // just returns the object which is encapsuled (may be null)
+    return getResult();
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#subContextFailed()
+   */
+  public boolean subContextFailed()
+  {
+    // this context will not fail when a subcontext fails because the result is
+    // already available when the context is created.
+    return false;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ObjectHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,169 @@
+/* gnu.java.beans.decoder.ObjectHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+
+import org.xml.sax.Attributes;
+
+/** An ObjectHandler parses the <object> tag and thereby creates various
+ * Context implementations.
+ *
+ * @author Robert Schuster
+ *
+ */
+public class ObjectHandler extends AbstractElementHandler
+{
+  /**
+   * XXX: Can all results be stored with an object id?
+   *
+   *
+   * @param PersistenceParser
+   */
+  ObjectHandler(ElementHandler parent)
+  {
+    super(parent, true);
+  }
+
+  protected Context startElement(Attributes attributes, ExceptionListener exceptionListener)
+    throws AssemblyException
+  {
+    String className = attributes.getValue("class");
+    String methodName = attributes.getValue("method");
+    String fieldName = attributes.getValue("field");
+    String index = attributes.getValue("index");
+    String propertyName = attributes.getValue("property");
+    String id = attributes.getValue("id");
+    String idRef = attributes.getValue("idref");
+
+    /* first check if we just want to access an existing object (idref present)
+     *
+     * note: <object idref="foo" method="bar"/> is not valid to call method "bar"
+     * on the object with id "foo". Instead this should return the object "foo"
+     * itself. The right way to this is:
+     * <object idref="foo">
+     *         <object method="bar"/>
+     * </object>
+     *
+     * This means that if idref is present class, method, field, index and
+     * property are obsolete.
+     */
+    if (idRef != null)
+      // reactivates an existing object and giving it another name if id exists
+      return new ObjectContext(id, getObject(idRef));
+
+    // decides whether we are in a static (className present) or dynamic context
+    if (className != null)
+      {
+	try
+	  {
+	    Class klass = instantiateClass(className);
+
+	    // class name exists which means that we are in a static context.
+	    // so we may want to ...
+	    // access a static field if the fieldName exists
+	    if (fieldName != null)
+	      {
+		try
+		  {
+		    return new ObjectContext(id,
+		                             klass.getField(fieldName).get(null));
+		  }
+		catch (NoSuchFieldException nsfe)
+		  {
+		    throw new AssemblyException(nsfe);
+		  }
+		catch (IllegalAccessException iae)
+		  {
+		    throw new AssemblyException(iae);
+		  }
+	      }
+
+	    // (falling through is important!)
+	    // run a constructor if methodName is "new" or null
+	    if (methodName == null || methodName.equals("new"))
+	      return new ConstructorContext(id, klass);
+
+	    // (falling through is important!)
+	    // run a static method on the given class (if methodName exists, which is implied already) 
+	    return new StaticMethodContext(id, klass, methodName);
+	    // XXX: should fail if unexpected attributes are present?
+	  }
+	catch (ClassNotFoundException cnfe)
+	  {
+	    throw new AssemblyException(cnfe);
+	  }
+      }
+    else
+      {
+	// className does not exist which means we are in the context of
+	// some object and want to ...
+	// access the get(int index) method if index != null
+	if (index != null)
+	  {
+	    try
+	      {
+		// Note: http://java.sun.com/products/jfc/tsc/articles/persistence3/ says
+		// that <void index="4"/> will make up a get()-call. But this is wrong because
+		// <void/> tags never return values (to the surrounding context)
+		return new IndexContext(id, Integer.parseInt(index));
+	      }
+	    catch (NumberFormatException nfe)
+	      {
+		throw new AssemblyException(nfe);
+	      }
+	  }
+
+	// access a method if methodName exists
+	if (methodName != null)
+	  return new MethodContext(id, methodName);
+
+	// (falling through is important!)
+	// access a property if a propertyName exists
+	if (propertyName != null && propertyName.length() > 0)
+	  // this is reported as an ordinary method access where the propertyName is
+	  // converted into a 'getter'-method name: convert first character of property name
+	  // to upper case and prepend 'get'
+	  // Note: This will be a getter-method because the <object> tag implies that a return
+	  // value is expected.
+	  return new PropertyContext(id, propertyName);
+      }
+
+    throw new AssemblyException(new IllegalArgumentException("Wrong or missing attributes for <object> tag."));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PersistenceParser.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,485 @@
+/* gnu.java.beans.PersistenceParser
+   Copyright (C) 2004, 2005 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+import java.beans.XMLDecoder;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/** The PersistenceParser parses an XML data stream and delegates actions to ElementHandler
+ * instances. The parser catches and recovers from all exception which reside from wrong usage
+ * of attributes and tags.
+ *
+ * @author Robert Schuster
+ */
+public class PersistenceParser extends DefaultHandler implements Context
+{
+	/** The ExceptionListener instance which is informed of non-critical parsing exceptions.
+	 */
+	private ExceptionListener exceptionListener;
+
+	/** When an element was not usable all elements inside it should be skipped.
+	 * This is done by skipping startElement() and endElement() invocations whenever
+	 * this value is above 0.
+	 */
+	private int skipElement;
+
+	/** Stores the Creator instances which can instantiate the appropriate handler implementation
+	 * for a given element.
+	 */
+	private HashMap handlerCreators = new HashMap();
+
+	/** Denotes the current ElementHandler. To avoid checking for null-values it is pre-assigned
+	 * with a DummyHandler instance which must not be used but acts as a root element.
+	 */
+	private ElementHandler currentHandler;
+
+	/** The real root element that stores all objects created during parsing.
+	 * Package-private to avoid an accessor method.
+	 */
+	JavaHandler javaHandler;
+
+	/** Stores the decoded objects. */
+	private List objects = new LinkedList();
+
+	/** The XMLDecoder instance that started this PersistenceParser */
+	private XMLDecoder decoder;
+
+	/** Creates a PersistenceParser which reads XML data from the given InputStream, reports
+	 * exceptions to ExceptionListener instance, stores resulting object in the DecoderContext
+	 * and uses the given ClassLoader to resolve classes.
+	 *
+	 * @param inputStream
+	 * @param exceptionListener
+	 * @param decoderContext
+	 * @param cl
+	 */
+	public PersistenceParser(
+		InputStream inputStream,
+		ExceptionListener exceptionListener,
+		ClassLoader cl,
+		XMLDecoder decoder)
+	{
+
+		this.exceptionListener = exceptionListener;
+		this.decoder = decoder;
+
+		DummyHandler dummyHandler = new DummyHandler();
+		currentHandler = dummyHandler;
+		javaHandler = new JavaHandler(dummyHandler, this, cl);
+
+		SAXParserFactory factory = SAXParserFactory.newInstance();
+
+		SAXParser parser;
+		try
+		{
+			parser = factory.newSAXParser();
+		}
+		catch (ParserConfigurationException pce)
+		{
+			// should not happen when a parser is available because we did
+			// not request any requirements on the XML parser
+			throw (InternalError) new InternalError(
+				"No SAX Parser available.").initCause(
+				pce);
+		}
+		catch (SAXException saxe)
+		{
+			// should not happen when a parser is available because we did
+			// not request any requirements on the XML parser
+			throw (InternalError) new InternalError(
+				"No SAX Parser available.").initCause(
+				saxe);
+		}
+
+		// prepares a map of Creator instances which can instantiate a handler which is
+		// appropriate for the tag that is used as a key for the Creator
+		handlerCreators.put("java", new JavaHandlerCreator());
+
+		// calls methods (properties), constructors, access fields
+		handlerCreators.put("object", new ObjectHandlerCreator());
+		handlerCreators.put("void", new VoidHandlerCreator());
+
+		handlerCreators.put("array", new ArrayHandlerCreator());
+
+		// these handler directly create an Object (or null)
+		handlerCreators.put("class", new ClassHandlerCreator());
+		handlerCreators.put("null", new NullHandlerCreator());
+
+		handlerCreators.put("char", new CharHandlerCreator());
+		handlerCreators.put("string", new StringHandlerCreator());
+		handlerCreators.put("boolean", new BooleanHandlerCreator());
+		handlerCreators.put("byte", new ByteHandlerCreator());
+		handlerCreators.put("short", new ShortHandlerCreator());
+		handlerCreators.put("int", new IntHandlerCreator());
+		handlerCreators.put("long", new LongHandlerCreator());
+		handlerCreators.put("float", new FloatHandlerCreator());
+		handlerCreators.put("double", new DoubleHandlerCreator());
+
+		// parses the data and sends all exceptions to the ExceptionListener
+		try
+		{
+			parser.parse(inputStream, this);
+		}
+		catch (SAXException saxe)
+		{
+			exceptionListener.exceptionThrown(
+				new IllegalArgumentException("XML data not well-formed."));
+		}
+		catch (IOException ioe)
+		{
+			exceptionListener.exceptionThrown(ioe);
+		}
+	}
+
+	public void startElement(
+		String uri,
+		String localName,
+		String qName,
+		Attributes attributes)
+		throws SAXException
+	{
+		/* The element is skipped if
+		 * a) the current handler has already failed or a previous error occured
+		 * which makes all children obsolete
+		 */
+		if (currentHandler.hasFailed() || skipElement > 0)
+		{
+			exceptionListener.exceptionThrown(
+				new IllegalArgumentException(
+					"Element unusable due to previous error: " + qName));
+
+			skipElement++;
+
+			return;
+		}
+
+		/* b) Subelements are not allowed within the current ElementHandler.
+		 */
+		if (!currentHandler.isSubelementAllowed(qName))
+		{
+			exceptionListener.exceptionThrown(
+				new IllegalArgumentException(
+					"Element is not allowed here: " + qName));
+
+			skipElement++;
+
+			return;
+		}
+
+		/* c) The tag name is not a key in the map of Creator instances. This means that
+		* either the XML data is of a newer version or simply contains a miss-spelled element.
+		*/
+		if (!handlerCreators.containsKey(qName))
+		{
+			exceptionListener.exceptionThrown(
+				new IllegalArgumentException(
+					"Element unusable because tag is unknown: " + qName));
+
+			skipElement++;
+
+			return;
+		}
+
+		// creates a new handler for the new element
+		AbstractElementHandler handler =
+			((Creator) handlerCreators.get(qName)).createHandler(
+				currentHandler);
+
+		// makes it the current handler to receive character data
+		currentHandler = handler;
+
+		// starts the handler
+		currentHandler.start(attributes, exceptionListener);
+	}
+
+	public void endElement(String uri, String localName, String qName)
+		throws SAXException
+	{
+		// skips processing the current handler if we are parsing an element
+		// which was marked invalid (in startElement() ) 
+		if (skipElement > 0)
+		{
+			skipElement--;
+			return;
+		}
+
+		// invokes the handler's finishing method
+		currentHandler.end(exceptionListener);
+
+		// removes the current handler and reactivates its parent
+		currentHandler = currentHandler.getParent();
+	}
+
+	/** Transfers character data to the current handler
+	 */
+	public void characters(char[] ch, int start, int length)
+		throws SAXException
+	{
+		// prevents sending character data of invalid elements
+		if (skipElement > 0)
+			return;
+
+		currentHandler.characters(ch, start, length);
+	}
+
+	/** Creator interface provided a mechanism to instantiate ElementHandler instances
+	 * for the appropriate tag.
+	 *
+	 * @author Robert Schuster
+	 */
+	interface Creator
+	{
+		/** Creates an ElementHandler instance using the given ElementHandler as its parent.
+		 *
+		 * @param parent The parent ElementHandler of the result.
+		 * @return A new ElementHandler instance.
+		 */
+		AbstractElementHandler createHandler(ElementHandler parent);
+	}
+
+	class BooleanHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new BooleanHandler(parent);
+		}
+	}
+
+	class ByteHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new ByteHandler(parent);
+		}
+	}
+
+	class ShortHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new ShortHandler(parent);
+		}
+	}
+
+	class IntHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new IntHandler(parent);
+		}
+	}
+
+	class LongHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new LongHandler(parent);
+		}
+	}
+
+	class FloatHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new FloatHandler(parent);
+		}
+	}
+
+	class DoubleHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new DoubleHandler(parent);
+		}
+	}
+
+	class CharHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new CharHandler(parent);
+		}
+	}
+
+	class StringHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new StringHandler(parent);
+		}
+	}
+
+	class JavaHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return javaHandler;
+		}
+	}
+
+	class ObjectHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new ObjectHandler(parent);
+		}
+	}
+
+	class VoidHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new VoidHandler(parent);
+		}
+	}
+
+	class ClassHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new ClassHandler(parent);
+		}
+	}
+
+	class NullHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new NullHandler(parent);
+		}
+	}
+
+	class ArrayHandlerCreator implements Creator
+	{
+		public AbstractElementHandler createHandler(ElementHandler parent)
+		{
+			return new ArrayHandler(parent);
+		}
+	}
+
+	/** Adds a decoded object to the Context. */
+	public void addParameterObject(Object o) throws AssemblyException
+	{
+		objects.add(o);
+	}
+
+	public void notifyStatement(Context outerContext) throws AssemblyException
+	{
+		// can be ignored because theis Context does not react to statement and expressions
+		// differently
+	}
+
+	public Object endContext(Context outerContext) throws AssemblyException
+	{
+		return null;
+	}
+
+	public boolean subContextFailed()
+	{
+		// failing of subcontexts is no problem for the mother of all contexts
+		return false;
+	}
+
+	public void set(int index, Object o) throws AssemblyException
+	{
+		// not supported
+		throw new AssemblyException(
+			new IllegalArgumentException("Set method is not allowed in decoder context."));
+	}
+
+	public Object get(int index) throws AssemblyException
+	{
+		// not supported
+		throw new AssemblyException(
+			new IllegalArgumentException("Get method is not allowed in decoder context."));
+	}
+
+	public Object getResult()
+	{
+		// returns the XMLDecoder instance which is requested by child contexts this way.
+		// That is needed to invoke methods on the decoder.
+		return decoder;
+	}
+
+	public void setId(String id)
+	{
+		exceptionListener.exceptionThrown(new IllegalArgumentException("id attribute is not allowed for <java> tag."));
+	}
+
+	public String getId()
+	{
+		// appears to have no id
+		return null;
+	}
+
+	public boolean isStatement()
+	{
+		// this context is a statement by definition because it never returns anything to a parent because
+		// there is no such parent (DummyContext does not count!)
+		return true;
+	}
+
+	public void setStatement(boolean b)
+	{
+		// ignores that because this Context is always a statement
+	}
+
+	/** Returns an Iterator instance which returns the decoded objects.
+	 * 
+	 * This method is used by the XMLDecoder directly. 
+	 */ 
+	public Iterator iterator()
+	{
+		return objects.iterator();
+	}
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/PropertyContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,137 @@
+/* gnu.java.beans.decoder.PropertyContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/** PropertyContext is a Context implementation that is very similar to MethodContext
+ * and IndexContext. The sole purpose of PropertyContext to find out whether it should
+ * 'set' or 'get' a certain property. This decision is made using the number of
+ * arguments.
+ * <p>When the method call has to be made and there is no argument we 'get' the property.
+ * With one argument it is 'set'.</p>
+ *
+ * @author Robert Schuster
+ */
+class PropertyContext extends AbstractObjectContext
+{
+  private Object argument;
+  private String propertyName;
+  private String prefix = "get";
+  private boolean methodCalled;
+
+  PropertyContext(String id, String newPropertyName)
+  {
+    setId(id);
+    propertyName = newPropertyName;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  public void addParameterObject(Object o) throws AssemblyException
+  {
+    if (methodCalled)
+      throw new AssemblyException(new IllegalArgumentException("Cannot add parameter object when method was already called."));
+
+    if (argument != null)
+      throw new AssemblyException(new IllegalArgumentException("Property attribut allows zero or one argument only."));
+
+    argument = o;
+	setStatement(true);
+    prefix = "set";
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  public void notifyStatement(Context outerContext) throws AssemblyException
+  {
+    if (methodCalled)
+      return;
+    methodCalled = true;
+
+    Object outerObject = outerContext.getResult();
+
+    if (outerObject == null)
+      throw new AssemblyException(new NullPointerException("No object to access property "
+	  + propertyName));
+    
+
+    // converts property name into a method name
+    String methodName = prefix + propertyName.substring(0, 1).toUpperCase()
+                        + propertyName.substring(1);
+
+    // prepares the argument
+    Object[] args = (argument != null) ? new Object[] { argument } : null;
+
+    try
+      {
+	Method method = MethodFinder.getMethod(outerObject.getClass(),
+	                                       methodName, args);
+
+	// stores the result whether it is available or not
+	setObject(method.invoke(outerObject, args));
+      }
+    catch (NoSuchMethodException nsme)
+      {
+	throw new AssemblyException(nsme);
+      }
+    catch (InvocationTargetException ite)
+      {
+	throw new AssemblyException(ite.getCause());
+      }
+    catch (IllegalAccessException iae)
+      {
+	throw new AssemblyException(iae);
+      }
+  }
+
+  public Object endContext(Context outerContext) throws AssemblyException
+  {
+    notifyStatement(outerContext);
+
+    return getResult();
+  }
+
+  public boolean subContextFailed()
+  {
+    return ! methodCalled;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/ShortHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,58 @@
+/* gnu.java.beans.decoder.ShortHandler
+   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 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 gnu.java.beans.decoder;
+
+/** Creates a Short instance from the character data in a <short> tag.
+ *
+ * @author Robert Schuster
+ */
+class ShortHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  ShortHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String number) throws NumberFormatException
+  {
+    return Short.valueOf(number);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/SimpleHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,111 @@
+/* gnu.java.beans.decoder.SimpleHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+
+import org.xml.sax.Attributes;
+
+/** XML element handler that is specialized on tags that contains a simple string in their
+ * body which has to be parsed in a specific way.
+ * <p>All of these tags have in common that they do not accept attributes. A warning is
+ * send to the parser's ExceptionListener when one or more attributes exist.</p>
+ *
+ * @author Robert Schuster
+ */
+abstract class SimpleHandler extends AbstractElementHandler
+{
+  private ObjectContext context;
+
+  /**
+   * @param PersistenceParser
+   */
+  SimpleHandler(ElementHandler parent)
+  {
+    super(parent, false);
+
+    // SimpleHandler do not accept any subelements
+  }
+
+  protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener)
+    throws AssemblyException
+  {
+  	
+    // note: simple elements should not have any attributes. We inform
+    // the user of this syntactical but uncritical problem by sending
+    // an IllegalArgumentException for each unneccessary attribute
+    int size = attributes.getLength();
+    for (int i = 0; i < size; i++) {
+            String attributeName = attributes.getQName(i);
+            Exception e =
+                    new IllegalArgumentException(
+                            "Unneccessary attribute '"
+                                    + attributeName
+                                    + "' discarded.");
+            exceptionListener.exceptionThrown(e);
+    }
+    
+    return context = new ObjectContext();
+  }
+
+  public void endElement(String characters)
+    throws AssemblyException, AssemblyException
+  {
+    // reports the number when the character data can be parsed
+    try
+      {
+	context.setObject(parse(characters));
+      }
+    catch (NumberFormatException nfe)
+      {
+	throw new AssemblyException(nfe);
+      }
+  }
+
+  /** Returns an object that is created from the given characters. If the string is
+   * converted into a number a NumberFormatException is cathed and reported
+   * appropriately.
+   *
+   * @param characters A string of characters that has to be processed in some way.
+   * @return An Object instance generated from the given data.
+   * @throws AssemblerException When the string was invalid.
+   * @throws NumberFormatException When the string could not be parsed into a number.
+   */
+  protected abstract Object parse(String characters)
+    throws AssemblyException, NumberFormatException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StaticMethodContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,95 @@
+/* gnu.java.beans.decoder.StaticMethodContext
+   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 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 gnu.java.beans.decoder;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+/**
+ * @author Robert Schuster
+ */
+class StaticMethodContext extends AbstractCreatableObjectContext
+{
+  private ArrayList arguments = new ArrayList();
+  private Class klass;
+  private String methodName;
+
+  StaticMethodContext(String id, Class newClass, String newMethodName)
+  {
+    setId(id);
+    klass = newClass;
+    methodName = newMethodName;
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object)
+   */
+  public void addParameterObjectImpl(Object o)
+  {
+    arguments.add(o);
+  }
+
+  /* (non-Javadoc)
+   * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
+   */
+  protected Object createObject(Context outerContext)
+    throws AssemblyException
+  {
+    Object[] args = arguments.toArray();
+
+    try
+      {
+	Method method = MethodFinder.getMethod(klass, methodName, args);
+	return method.invoke(null, args);
+      }
+    catch (NoSuchMethodException nsme)
+      {
+	throw new AssemblyException(nsme);
+      }
+    catch (InvocationTargetException ite)
+      {
+	// rethrows the reason for the InvocationTargetsException (ie. the exception in the called code)
+	throw new AssemblyException(ite.getCause());
+      }
+    catch (IllegalAccessException iae)
+      {
+	throw new AssemblyException(iae);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StringHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StringHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StringHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/StringHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,54 @@
+/* gnu.java.beans.decoder.StringHandler
+   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 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 gnu.java.beans.decoder;
+
+class StringHandler extends SimpleHandler
+{
+  /**
+   * @param PersistenceParser
+   */
+  StringHandler(ElementHandler parent)
+  {
+    super(parent);
+  }
+
+  protected Object parse(String characters)
+  {
+    return characters;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/VoidHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,140 @@
+/* gnu.java.beans.decoder.VoidHandler
+   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 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 gnu.java.beans.decoder;
+
+import java.beans.ExceptionListener;
+
+import org.xml.sax.Attributes;
+
+public class VoidHandler extends AbstractElementHandler
+{
+    /**
+     * @param PersistenceParser
+     */
+    VoidHandler(ElementHandler parent)
+    {
+        super(parent, true);
+    }
+
+    protected Context startElement(
+        Attributes attributes,
+        ExceptionListener exceptionListener)
+        throws AssemblyException
+    {
+        Context ctx = startElementImpl(attributes);
+        ctx.setStatement(true);
+
+        return ctx;
+    }
+
+    private Context startElementImpl(Attributes attributes)
+        throws AssemblyException
+    {
+        String id = attributes.getValue("id");
+        String className = attributes.getValue("class");
+        String methodName = attributes.getValue("method");
+        String propertyName = attributes.getValue("property");
+        String index = attributes.getValue("index");
+
+        if (className != null)
+        {
+            try
+            {
+                Class klass = instantiateClass(className);
+
+                // class name exists which means that we are in a static context.
+                // so we may want to ...
+                // run a constructor if methodName is "new" or null
+                if (methodName == null || methodName.equals("new"))
+                    // if the id is null the result cannot be by the decoder accessed but the
+                    // constructor may have side effects (e.g. registering itself in a global registry)
+                    return new ConstructorContext(id, klass);
+
+                // (falling through is important!)
+                // run a static method on the given class (if methodName exists, which is implied already) 
+                return new StaticMethodContext(id, klass, methodName);
+            }
+            catch (ClassNotFoundException cnfe)
+            {
+                throw new AssemblyException(cnfe);
+            }
+        }
+        else
+        {
+            // className does not exist which means we are in the context of
+            // some object and want to ...
+            // access an element by index
+            if (index != null)
+            {
+                // note: whether this resolves into get(i) or set(i, o) depends on the
+                // number of arguments and is decided by the ObjectAssembler
+                try
+                {
+                    return new IndexContext(id, Integer.parseInt(index));
+                }
+                catch (NumberFormatException nfe)
+                {
+                    throw new AssemblyException(nfe);
+                }
+            }
+
+            // access a method if methodName exists
+            if (methodName != null)
+                return new MethodContext(id, methodName);
+
+            // (falling through is important!)
+            // access a property if a propertyName exists
+            if (propertyName != null && propertyName.length() > 0)
+                // this is reported as an ordinary method invocation where the propertyName is
+                // converted into a 'setter'-method name: convert first character of property name
+                // to upper case and prepend 'set'
+                // Note: This will be a setter-method because the <void> tag implies that no return
+                // value is expected (but a side effect)
+                return new PropertyContext(id, propertyName);
+        }
+
+        // if code reaches this point the tag has wrong attributes. The following test
+        // does not make it better but can provide are more specific error message for
+        // a common mistake: <void> tags are not allowed to have an idref attribute
+        throw new AssemblyException(
+            new IllegalArgumentException(
+                (attributes.getValue("idref") == null)
+                    ? "Missing attributes for <void> tag"
+                    : "<void> does not support 'idref' attribute."));
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/decoder/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.beans.decoder package.
+   Copyright (C) 2005 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.beans.decoder</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/ColorEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/ColorEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/ColorEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/ColorEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* gnu.java.beans.editors.ColorEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.awt.Color;
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeByteEditor is a property editor for the
+ ** byte type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class ColorEditor extends PropertyEditorSupport {
+	Color[] stdColors = {Color.black,Color.blue,Color.cyan,
+	                     Color.darkGray,Color.gray,Color.green,
+	                     Color.lightGray,Color.magenta,Color.orange,
+	                     Color.pink,Color.red,Color.white,
+	                     Color.yellow};
+	String[] stdColorNames = {"black","blue","cyan",
+	                          "dark gray","gray","green",
+	                          "light gray","magenta","orange",
+	                          "pink","red","white",
+	                          "yellow"};
+
+	/** setAsText for Color checks for standard color names
+	 ** and then checks for a #RRGGBB value or just RRGGBB,
+	 ** both in hex.
+	 **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		if(val.length() == 0) {
+			throw new IllegalArgumentException("Tried to set empty value!");
+		}
+		for(int i=0;i<stdColorNames.length;i++) {
+			if(stdColorNames[i].equalsIgnoreCase(val)) {
+				setValue(stdColors[i]);
+				return;
+			}
+		}
+		if(val.charAt(0) == '#') {
+			setValue(new Color(Integer.parseInt(val.substring(1),16)));
+		} else {
+			setValue(new Color(Integer.parseInt(val,16)));
+		}
+	}
+
+	/** getAsText for Color turns the color into either one of the standard
+	 ** colors or into an RGB hex value with # prepended. **/
+	public String getAsText() {
+		for(int i=0;i<stdColors.length;i++) {
+			if(stdColors[i].equals(getValue())) {
+				return stdColorNames[i];
+			}
+		}
+		return "#" + Integer.toHexString(((Color)getValue()).getRGB() & 0x00FFFFFF);
+	}
+
+	/** getTags for Color returns a list of standard colors. **/
+	public String[] getTags() {
+		return stdColorNames;
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/FontEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/FontEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/FontEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/FontEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* gnu.java.beans.editors.FontEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.awt.Font;
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** FontEditor is a property editor for java.awt.Font.
+ **
+ ** <STRONG>To Do:</STRONG> Add custom font chooser
+ ** component.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class FontEditor extends PropertyEditorSupport {
+	/** setAsText for Font calls Font.decode(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Font.decode(val));
+	}
+
+	/** getAsText for Font returns a value in the format
+	 ** expected by Font.decode().
+	 **/
+	public String getAsText() {
+		Font f = (Font)getValue();
+		if(f.isBold()) {
+			if(f.isItalic()) {
+				return f.getName()+"-bolditalic-"+f.getSize();
+			} else {
+				return f.getName()+"-bold-"+f.getSize();
+			}
+		} else if(f.isItalic()) {
+			return f.getName()+"-italic-"+f.getSize();
+		} else {
+			return f.getName()+"-"+f.getSize();
+		}
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeBooleanEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeBooleanEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeBooleanEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeBooleanEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,76 @@
+/* gnu.java.beans.editors.NativeBooleanEditor
+   Copyright (C) 1998, 2002 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeBooleanEditor is a property editor for the
+ ** boolean type.<P>
+ **
+ ** <STRONG>To Do:</STRONG> add support for a checkbox
+ ** as the custom editor.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeBooleanEditor extends PropertyEditorSupport {
+	String[] tags = {"true","false"};
+
+	/**
+	 * setAsText for boolean checks for true or false or t or f.
+	 * "" also means false.
+	 **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) {
+			setValue(Boolean.TRUE);
+		} else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f") || val.equals("")) {
+			setValue(Boolean.FALSE);
+		} else {
+			throw new IllegalArgumentException("Value must be true, false, t, f or empty.");
+		}
+	}
+
+
+	/** getAsText for boolean calls Boolean.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeByteEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeByteEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeByteEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeByteEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.NativeByteEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeByteEditor is a property editor for the
+ ** byte type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeByteEditor extends PropertyEditorSupport {
+	/** setAsText for byte calls Byte.valueOf(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Byte.valueOf(val));
+	}
+
+	/** getAsText for byte calls Byte.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeDoubleEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeDoubleEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeDoubleEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeDoubleEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.NativeDoubleEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeDoubleEditor is a property editor for the
+ ** double type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeDoubleEditor extends PropertyEditorSupport {
+	/** setAsText for double calls Double.valueOf(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Double.valueOf(val));
+	}
+
+	/** getAsText for double calls Double.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeFloatEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeFloatEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeFloatEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeFloatEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.NativeFloatEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeFloatEditor is a property editor for the
+ ** float type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeFloatEditor extends PropertyEditorSupport {
+	/** setAsText for float calls Float.valueOf(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Float.valueOf(val));
+	}
+
+	/** getAsText for float calls Float.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeIntEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeIntEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeIntEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeIntEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.NativeIntEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeIntEditor is a property editor for the
+ ** int type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeIntEditor extends PropertyEditorSupport {
+	/** setAsText for int calls Integer.valueOf(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Integer.valueOf(val));
+	}
+
+	/** getAsText for int calls Integer.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeLongEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeLongEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeLongEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeLongEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.NativeLongEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeLongEditor is a property editor for the
+ ** long type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeLongEditor extends PropertyEditorSupport {
+	/** setAsText for long calls Long.valueOf(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Long.valueOf(val));
+	}
+
+	/** getAsText for long calls Long.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeShortEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeShortEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeShortEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/NativeShortEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.NativeShortEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeShortEditor is a property editor for the
+ ** short type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class NativeShortEditor extends PropertyEditorSupport {
+	/** setAsText for short calls Short.valueOf(). **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(Short.valueOf(val));
+	}
+
+	/** getAsText for short calls Short.toString(). **/
+	public String getAsText() {
+		return getValue().toString();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/StringEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/StringEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/StringEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/StringEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* gnu.java.beans.editors.StringEditor
+   Copyright (C) 1998 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 gnu.java.beans.editors;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ ** NativeByteEditor is a property editor for the
+ ** byte type.
+ **
+ ** @author John Keiser
+ ** @version 1.1.0, 29 Jul 1998
+ **/
+
+public class StringEditor extends PropertyEditorSupport {
+	/** setAsText just sets the value. **/
+	public void setAsText(String val) throws IllegalArgumentException {
+		setValue(val);
+	}
+
+	/** getAsText just returns the value. **/
+	public String getAsText() {
+		return (String)getValue();
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/TODO
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/TODO?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/TODO (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/TODO Thu Nov  8 16:56:19 2007
@@ -0,0 +1,4 @@
+- write tests for all editors
+- add some sort of ColorChooser as a custom editor for ColorEditor
+- add a FileNameEditor
+- add a FontChooser as a custom editor for FontEditor

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/editors/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.beans.editors package.
+   Copyright (C) 2005 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.beans.editors</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ArrayPersistenceDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ArrayPersistenceDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ArrayPersistenceDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ArrayPersistenceDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,153 @@
+/* ArrayPersistenceDelegate.java - A PersistenceDelegate that handles arrays.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.Statement;
+
+import java.lang.reflect.Array;
+import java.util.HashMap;
+
+public class ArrayPersistenceDelegate extends PersistenceDelegate
+{
+  private static final HashMap NULL_VALUES = new HashMap();
+
+  static
+    {
+      NULL_VALUES.put(Boolean.TYPE, Boolean.FALSE);
+      NULL_VALUES.put(Byte.TYPE, Byte.valueOf((byte) 0));
+      NULL_VALUES.put(Short.TYPE, Short.valueOf((short) 0));
+      NULL_VALUES.put(Integer.TYPE, Integer.valueOf(0));
+      NULL_VALUES.put(Long.TYPE, Long.valueOf(0));
+      NULL_VALUES.put(Float.TYPE, Float.valueOf(0.0f));
+      NULL_VALUES.put(Double.TYPE, Double.valueOf(0.0));
+    }
+
+  protected Expression instantiate(Object oldInstance, Encoder out)
+  {
+    Class type = oldInstance.getClass().getComponentType();
+
+    // oldInstance is expected to be an array, then
+    // getClass().getComponentType() should lead
+    // to its component type.
+    assert (type != null);
+
+    // Not handling primitive types in a special way here
+    // causes that Class.forName("int") is built as an Expression
+    // later which would cause an exception if executed. A special
+    // handling to avoid the execution for primitive types can be
+    // java.beans.Encoder.writeExpression() .
+    return new Expression(
+                          oldInstance,
+                          Array.class,
+                          "newInstance",
+                          new Object[] {
+                            type,
+                            new Integer(Array.getLength(oldInstance)) });
+  }
+
+  protected void initialize(Class type, Object oldInstance, Object newInstance,
+                            Encoder out)
+  {
+    int length = Array.getLength(oldInstance);
+
+    // Compares the array value against a prototypical
+    // null value of the array's component type in order to skip
+    // writing the default values of an array.
+    
+    // Note: I have no idea why the persistence delegate for arrays writes
+    // an Expression that reads the value and then writes a Statement that sets
+    // the value. However it turned out that object arrays work better with the
+    // get-Expression and primitive array work fine with the set-Statement.
+    
+    type = type.getComponentType();
+    if (type.isPrimitive())
+      {
+        Object nullValue = NULL_VALUES.get(type);
+
+        for (int i = 0; i < length; i++)
+          {
+            Object oldValue = Array.get(oldInstance, i);
+
+            if (!oldValue.equals(nullValue))
+              {
+                out.writeExpression(new Expression(Array.class, "get",
+                                                   new Object[] { oldInstance,
+                                                                 Integer.valueOf(i),
+                                                                 }));
+                
+                out.writeStatement(new Statement(Array.class, "set",
+                                               new Object[] {
+                                                 oldInstance,
+                                                 Integer.valueOf(i),
+                                                 oldValue
+                                                 }));
+              }
+          }
+        
+      }
+    else
+      {
+
+        for (int i = 0; i < length; i++)
+          {
+            Object oldValue = Array.get(oldInstance, i);
+            
+            if (oldValue != null)
+              {
+                out.writeExpression(new Expression(Array.class, "get",
+                                                 new Object[] { oldInstance,
+                                                               Integer.valueOf(i),
+                                                               }));
+                
+                out.writeStatement(new Statement(Array.class, "set",
+                                                   new Object[] {
+                                                     oldInstance,
+                                                     Integer.valueOf(i),
+                                                     oldValue
+                                                     }));
+              }
+          }
+      }
+    
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ClassPersistenceDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ClassPersistenceDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ClassPersistenceDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ClassPersistenceDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* ClassPersistenceDelegate.java - A PersistenceDelegate for the Class type.
+   Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+
+/** <p>The <code>ClassPersistenceDelegate</code> creates
+ * <code>Expression</code> instances which denote class resolutions.</p>
+ * 
+ * <p>The class resolution is always the last step when serializing a tree
+ * of objects. Due to the recursive nature of the algorithm we need a way
+ * to end the recursion. This is achieved by the implementation of this
+ * {@link instantiate} method. Arbitrary classes are described with a call
+ * to <code>Class.forName</code>. However for the <code>Class</code> class
+ * we call <code>getClass()</code> on a <code>String.class</code> instance.
+ * This in turn lead to the resolution of the String class which is always
+ * encoded as <code>"".getClass()</code>. Finally the <code>Encoder</code>
+ * treats strings in a special way so that the recursion ends here.  
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class ClassPersistenceDelegate extends PersistenceDelegate
+{
+
+  protected Expression instantiate(Object oldInstance, Encoder out)
+  {
+    Class oldClass = (Class) oldInstance;
+    
+    // Due to the special handling of String instances in the Encoder
+    // this Expression does not lead to further class resolutions.
+    if (oldClass == String.class)
+      return new Expression(oldClass, "", "getClass", null);
+
+    // This Expression will lead to the class resolution of String.class.
+    if (oldClass == Class.class)
+      return new Expression(oldClass, String.class, "getClass", null);
+
+    // This Expression will lead to the class resolution of Class.class. 
+    return new Expression(oldClass, Class.class, "forName",
+                          new Object[] { oldClass.getName() });
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/CollectionPersistenceDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,84 @@
+/* CollectionPersistenceDelegate.java - A PersistenceDelegate for Collection subclasses.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.util.Collection;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.Statement;
+
+import java.util.Iterator;
+
+/** <p>A <code>PersistenceDelegate</code> implementation that calls
+ * the no-argument constructor to create the Collection instance and
+ * uses an iterator to add all the objects it reaches through it.</p>
+ * 
+ * <p>It is used for <code>Set</code> and <code>List</code>
+ * implementations.</p>
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class CollectionPersistenceDelegate extends PersistenceDelegate
+{
+
+  protected Expression instantiate(Object oldInstance, Encoder out)
+  {
+    return new Expression(
+                          oldInstance,
+                          oldInstance.getClass(),
+                          "new",
+                          null);
+  }
+
+  protected void initialize(Class type, Object oldInstance, Object newInstance,
+                            Encoder out)
+  {
+    Iterator ite = ((Collection) oldInstance).iterator();
+
+    while (ite.hasNext())
+      {
+        out.writeStatement(new Statement(oldInstance, "add",
+                                         new Object[] { ite.next() }));
+
+      }
+
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Context.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Context.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Context.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Context.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,88 @@
+/* Context.java -- Provides calling context information to ScannerStates.
+   Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+/** A <code>Contect</code> object describes the current state
+ * and the call number while processing the original object
+ * tree in the {@link ScanEngine}.
+ * 
+ * <p>The class allows to distinguish the different calling states
+ * and is neccessary for the child element skipping feature of
+ * the {@link GenericScannerState}.</p> 
+ *  
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class Context
+{
+  private String state;
+  
+  private int call;
+  
+  Context(String newState, int newCall)
+  {
+    state = newState;
+    call = newCall;
+  }
+
+  public int hashCode()
+  {
+    int hc = 7;
+    hc = 31 * hc + state.hashCode();
+    hc = 31 * hc + call;
+    
+    return hc;
+  }
+  
+  public boolean equals(Object o)
+  {
+    if (!(o instanceof Context))
+      return false;
+    
+    Context that = (Context) o;
+    
+    return state.equals(that.state)
+      && call == that.call;
+  }
+  
+  public String toString()
+  {
+    return "Context [state=" + state + ", call=" + call + "]";
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/GenericScannerState.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,257 @@
+/* GenericScannerState.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.util.HashMap;
+
+import gnu.java.beans.encoder.elements.ArrayInstantiation;
+import gnu.java.beans.encoder.elements.Array_Get;
+import gnu.java.beans.encoder.elements.Array_Set;
+import gnu.java.beans.encoder.elements.ClassResolution;
+import gnu.java.beans.encoder.elements.Element;
+import gnu.java.beans.encoder.elements.List_Get;
+import gnu.java.beans.encoder.elements.List_Set;
+import gnu.java.beans.encoder.elements.MethodInvocation;
+import gnu.java.beans.encoder.elements.NullObject;
+import gnu.java.beans.encoder.elements.ObjectInstantiation;
+import gnu.java.beans.encoder.elements.ObjectReference;
+import gnu.java.beans.encoder.elements.PrimitiveInstantiation;
+import gnu.java.beans.encoder.elements.StaticFieldAccess;
+import gnu.java.beans.encoder.elements.StaticMethodInvocation;
+import gnu.java.beans.encoder.elements.StringReference;
+
+/**
+ * This class is a {@link ScannerState} implementation that creates
+ * suitable {@link gnu.java.beans.encoder.elements.Element} instances
+ * for each transition variant.
+ * 
+ * <p>Furthermore it can optionally skip a certain number of child
+ * elements. The algorithm can cope with the fact that one 
+ * <code>GenericScannerState</code> instance may be called at
+ * different levels of recursions.</p>
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+class GenericScannerState extends ScannerState
+{
+  private int skipElements, initialSkipElements;
+
+  final Root root;
+
+  HashMap skipValues;
+
+  GenericScannerState(Root newRoot)
+  {
+    root = newRoot;
+  }
+
+  GenericScannerState(Root root, int skipElements)
+  {
+    this(root);
+    this.skipElements = initialSkipElements = skipElements;
+
+    if (skipElements > 0)
+      skipValues = new HashMap();
+  }
+  
+  protected void enterImpl(Context ctx)
+  {
+    if (skipValues != null)
+      {
+        Integer skip = (Integer) skipValues.get(ctx);
+        
+        if (skip == null)
+          {
+            skip = Integer.valueOf(initialSkipElements);
+            skipValues.put(ctx, skip);
+          }
+        
+        skipElements = skip.intValue();
+      }
+  }
+
+  void methodInvocation(String methodName)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new MethodInvocation(methodName));
+  }
+
+  void staticMethodInvocation(String className, String methodName)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new StaticMethodInvocation(className, methodName));
+  }
+
+  void staticFieldAccess(String className, String fieldName)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new StaticFieldAccess(className, fieldName));
+  }
+
+  void classResolution(String className)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new ClassResolution(className));
+  }
+
+  void objectInstantiation(String className, ObjectId objectId)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    Element elem = new ObjectInstantiation(className);
+    elem.initId(objectId);
+
+    root.addChild(elem);
+  }
+
+  void primitiveInstantiation(String primitiveName, String valueAsString)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new PrimitiveInstantiation(primitiveName, valueAsString));
+  }
+
+  void objectArrayInstantiation(String arrayClassName, String lengthAsString,
+                          ObjectId objectId)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    Element elem = new ArrayInstantiation(arrayClassName, lengthAsString);
+    elem.initId(objectId);
+
+    root.addChild(elem);
+  }
+
+  void primitiveArrayInstantiation(String arrayClassName, String lengthAsString,
+                                ObjectId objectId)
+  {
+    objectArrayInstantiation(arrayClassName, lengthAsString, objectId);
+  }
+
+  void arraySet(String indexAsString)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new Array_Set(indexAsString));
+  }
+
+  void arrayGet(String indexAsString)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new Array_Get(indexAsString));
+  }
+
+  void listGet()
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new List_Get());
+  }
+
+  void listSet()
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new List_Set());
+  }
+
+  void nullObject()
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new NullObject());
+  }
+
+  void stringReference(String string)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new StringReference(string));
+  }
+
+  void objectReference(ObjectId id)
+  {
+    if (skipValues != null && skipElements > 0)
+      return;
+
+    root.addChild(new ObjectReference(id));
+  }
+
+  void end()
+  {
+    if (skipValues != null)
+      {
+        if (skipElements > 0)
+          skipElements--;
+        else
+          {
+            // Finishes the Element we are constructing.
+            root.end();
+          }
+        skipValues.put(context(), Integer.valueOf(skipElements));
+      }
+    else
+      root.end();
+
+  }
+
+  void enter()
+  {
+
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/IgnoringScannerState.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,133 @@
+/* IgnoringScannerState.java -- A ScannerState that does nothing.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+/** A special {@link ScannerState} implementation that ignores all child
+ * elements.
+ * 
+ * <p>Consider the call hierarchy:
+ * <code>
+ * methodInvocation
+ *   objectInstantiation
+ *     classResolution*
+ *       objectInstantiation
+ *         classResolution
+ * </code>
+ * </p>
+ * 
+ * <p>When the ignoring state is active one can filter the elements of
+ * one level. One has to set up the state machine that a transition
+ * via "class resolution" from a state that was reached via "object
+ * instantation" reaches an <code>IgnoringScannerState</code>.</p>
+ * 
+ * <p>Setting the default successor of a <code>IgnoringScannerState</code>
+ * to itself causes all elements of the call hierarchy to be skipped
+ * until another state is reached by going back.</p> 
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+class IgnoringScannerState extends ScannerState
+{
+
+  void methodInvocation(String methodName)
+  {
+  }
+
+  void staticMethodInvocation(String className, String methodName)
+  {
+  }
+
+  void staticFieldAccess(String className, String fieldName)
+  {
+  }
+
+  void classResolution(String className)
+  {
+  }
+
+  void objectInstantiation(String className, ObjectId objectId)
+  {
+  }
+
+  void primitiveInstantiation(String primitiveName, String valueAsString)
+  {
+  }
+
+  void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId)
+  {
+  }
+
+  void primitiveArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId)
+  {
+  }
+
+  void arraySet(String indexAsString)
+  {
+  }
+
+  void arrayGet(String indexAsString)
+  {
+  }
+
+  void listGet()
+  {
+  }
+
+  void listSet()
+  {
+  }
+
+  void nullObject()
+  {
+  }
+
+  void stringReference(String string)
+  {
+  }
+
+  void objectReference(ObjectId id)
+  {
+  }
+  
+  void end()
+  {
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/MapPersistenceDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,81 @@
+/* MapPersistenceDelegate.java -- A PersistenceDelegate for Map subclasses.
+
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.util.Map;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.Statement;
+
+import java.util.Iterator;
+
+/**
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class MapPersistenceDelegate extends PersistenceDelegate
+{
+
+  protected Expression instantiate(Object oldInstance, Encoder out)
+  {
+    return new Expression(
+                          oldInstance,
+                          oldInstance.getClass(),
+                          "new",
+                          null);
+  }
+
+  protected void initialize(Class type, Object oldInstance, Object newInstance,
+                            Encoder out)
+  {
+    Map map = (Map) oldInstance;
+    Iterator ite = map.keySet().iterator();
+
+    while (ite.hasNext())
+      {
+        Object key = ite.next();
+        out.writeStatement(new Statement(oldInstance, "put",
+                                         new Object[] { key, map.get(key) }));
+
+      }
+
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ObjectId.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ObjectId.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ObjectId.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ObjectId.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,132 @@
+/* ObjectId.java -- Simple object identification mechanism for XML encoding.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.util.HashMap;
+
+/**
+ * <p>
+ * ObjectId provides an object identification mechanism which gives each object
+ * a name in the form <code><class><Nameindex></code>.
+ * </p>
+ * 
+ * <p>
+ * Each id can be in an unused state which means that only one instance of the
+ * object is in use and a special id is not needed. Certain {@link
+ * gnu.java.beans.encoder.elements.Element} subclasses use this feature to find
+ * out whether they write the "id" attribute or not.
+ * </p>
+ * <p>
+ * An <code>ObjectId</code> instance is typically given to multiple objects.
+ * The second user should then invoke the {@link #init} method to generate the
+ * identification string and bring the id in the 'used' state.
+ * </p>
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class ObjectId
+{
+  /**
+   * Stores the index an object of a specific type should be given.
+   */
+  private static HashMap nameIndices = new HashMap();
+
+  private String id;
+
+  private Class klass;
+
+  ObjectId(Class klass)
+  {
+    this.klass = klass;
+  }
+
+  public boolean isUnused()
+  {
+    return id == null;
+  }
+
+  public String toString()
+  {
+    return (id != null) ? id : "<unused id>";
+  }
+
+  /**
+   * <p>
+   * Generates a simple Id by concatenating a class name with a self-increasing
+   * number.
+   * </p>
+   */
+  public void init()
+  {
+    assert (klass != null);
+
+    if (id != null)
+      return;
+
+    Integer count = (Integer) nameIndices.get(klass);
+    if (count == null)
+      {
+        count = Integer.valueOf(0);
+      }
+
+    if (klass.isArray())
+      {
+        Class ct = klass.getComponentType();
+        if (ct == Boolean.TYPE)
+          id = "booleanArray" + count.intValue();
+        else if (ct == Byte.TYPE)
+          id = "byteArray" + count.intValue();
+        else if (ct == Short.TYPE)
+          id = "shortArray" + count.intValue();
+        else if (ct == Integer.TYPE)
+          id = "intArray" + count.intValue();
+        else if (ct == Long.TYPE)
+          id = "longArray" + count.intValue();
+        else if (ct == Float.TYPE)
+          id = "floatArray" + count.intValue();
+        else if (ct == Double.TYPE)
+          id = "doubleArray" + count.intValue();
+      }
+    else
+      id = klass.getName() + count.intValue();
+
+    nameIndices.put(klass, Integer.valueOf(count.intValue() + 1));
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/PrimitivePersistenceDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,74 @@
+/* PrimitivePersistenceDelegate.java
+ -- A PersistenceDelegate for primitive data types.
+   Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+
+/**
+ * A shared PersistenceDelegate implementation for all primitive types.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class PrimitivePersistenceDelegate extends PersistenceDelegate
+{
+
+  protected Expression instantiate(Object oldInstance, Encoder out)
+  {
+    // The implementation relies on the fact that every primitive
+    // wrapper class has a constructor accepting a String argument.
+    // By using these constructors creating a primitive instance
+    // depends on the String class only.
+    return new Expression(oldInstance, oldInstance.getClass(), "new",
+                          new Object[] { oldInstance.toString() });
+  }
+
+  protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out)
+  {
+    // This is a hack to make serializing primitive arrays work correctly.
+    // Instead of modifying an existing primitive instance to make it equal
+    // with another instance (which is not possible because primitives are
+    // immutable) we create a new instance. This is against the specification
+    // of the initialize method but make things work fine.
+    out.writeExpression(new Expression(oldInstance, oldInstance.getClass(), "new",
+                          new Object[] { oldInstance.toString() }));
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ReportingScannerState.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,131 @@
+/* ReportingScannerState.java -- A state for debugging purposes.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+/**
+ * A <code>ScannerState</code> implementation that prints useful details
+ * about its arguments. Use it when the XML encoding does not work correctly
+ * and you want to find out how things relate to each other.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+class ReportingScannerState extends ScannerState
+{
+
+  void methodInvocation(String methodName)
+  {
+	System.out.println("methodInvocation: " + methodName + "()");
+  }
+
+  void staticMethodInvocation(String className, String methodName)
+  {
+	System.out.println("staticMethodInvocation: " + className + "." + methodName + "()");
+  }
+
+  void staticFieldAccess(String className, String fieldName)
+  {
+    System.out.println("staticFieldAccess: " + className + "." + fieldName);
+  }
+
+  void classResolution(String className)
+  {
+	System.out.println("classResolution: " + className);
+  }
+
+  void objectInstantiation(String className, ObjectId objectId)
+  {
+	System.out.println("objectInstantiation: " + className);
+  }
+
+  void primitiveInstantiation(String primitiveName, String valueAsString)
+  {
+	System.out.println("primitiveInstantiation: (" + primitiveName + ") " + valueAsString);
+  }
+
+  void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId)
+  {
+    System.out.println("objectArrayInstantiation: new " + arrayClassName + "[" + lengthAsString + "]");
+  }
+
+  void primitiveArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId)
+  {
+    System.out.println("primitiveArrayInstantiation: new " + arrayClassName + "[" + lengthAsString + "]");
+  }
+
+  void arraySet(String indexAsString)
+  {
+	System.out.println("arraySet: " + indexAsString);
+  }
+
+  void arrayGet(String indexAsString)
+  {
+	System.out.println("arrayGet: " + indexAsString);
+  }
+
+  void listGet()
+  {
+	System.out.println("listGet");
+  }
+
+  void listSet()
+  {
+	System.out.println("listSet");
+  }
+
+  void nullObject()
+  {
+	System.out.println("nullObject");
+  }
+
+  void stringReference(String string)
+  {
+    System.out.println("stringReference: " + string);
+  }
+
+  void objectReference(ObjectId id)
+  {
+    System.out.println("objectReference: " + id);
+  }
+
+ void end()
+ {
+ 	System.out.println("-close");
+ }
+ 
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Root.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Root.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Root.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Root.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,198 @@
+/* Root.java -- The root of an object tree.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.beans.XMLEncoder;
+import java.util.Iterator;
+import java.util.Stack;
+
+import gnu.java.beans.encoder.elements.Element;
+
+/** <p><code>Root</code> provides a simple interface to a tree of
+ * objects.</p>
+ * 
+ * <p>Using an instance of this class a logical representation of
+ * the real object tree that is serialized can be built. When the
+ * actual data should be written as XML <code>Root</code> and
+ * {@link gnu.java.beans.encoder.elements.Element} class can provide
+ * context information which is used to write the best fitting
+ * XML representation.</p>
+ *   
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class Root
+{
+  private Stack parents = new Stack();
+
+  private Element rootElement, current;
+  
+  private boolean started;
+
+  public Root()
+  {
+    rootElement = current = new RootElement();
+  }
+
+  /** <p>Adds another child element to the tree.</p>
+   * 
+   * <p>The new element automatically becomes the current
+   * element.</p>
+   * 
+   * @param elem The new child element.
+   */
+  public void addChild(Element elem)
+  {
+    current.addChild(elem);
+
+    parents.push(current);
+    current = elem;
+  }
+
+  /**
+   * <p>Marks that the end of the current element
+   * is reached and that no more childs are added to
+   * it.</p>
+   * 
+   * <p>The behavior is to return to the nearest parent
+   * element.</p>
+   */
+  public void end()
+  {
+    current = (Element) parents.pop();
+  }
+
+  /**
+   * <p>Goes back to the nearest parent element but
+   * deletes the just created child.</p>
+   * 
+   * <p>This is used if something went wrong while
+   * processing the child element's {@link java.beans.Expression}
+   * or {@link java.beans.Statement}.</p>
+   *
+   */
+  public void deleteLast()
+  {
+    current = (Element) parents.pop();
+
+    current.removeLast();
+  }
+
+  /**
+   * <p>Traverses the elements in the object tree
+   * and creates their XML representation in the output
+   * stream of the given {@link Writer}.</p>
+   * 
+   * <p>Finally the <code>Writer</code> is flushed.</p>
+   *  
+   * @param writer The Writer instance that generates the XML representation.
+   */
+  public void traverse(Writer writer)
+  {
+    if (!started)
+      {
+        writer.writePreamble();
+        rootElement.writeStart(writer);
+      }
+    started = true;
+    
+    traverse(writer, rootElement.iterator());
+    
+    rootElement.clear();
+    
+    writer.flush();
+  }
+
+  /** Writes the closing element and closes the {@link Writer}
+   * 
+   * @param writer The Writer instance that generates the XML representation.
+   */
+  public void close(Writer writer)
+  {
+    rootElement.writeEnd(writer);
+    writer.close();
+  }
+
+  /** Recursively traverses the object tree.
+   * 
+   * @param writer The Writer instance that generates the XML representation.
+   * @param ite An Iterator returning Element instances.
+   */
+  private void traverse(Writer writer, Iterator ite)
+  {
+    while (ite.hasNext())
+      {
+        Element e = (Element) ite.next();
+        e.writeStart(writer);
+
+        traverse(writer, e.iterator());
+
+        e.writeEnd(writer);
+        
+        e.clear();
+      }
+  }
+
+  /** <p>A special Element implementation that represents the
+   * encoder's context.</p>
+   * 
+   * <p>This element is written only once per Writer.</p>
+   * 
+   * <p>It is assumed that this element is never empty to simplify
+   * the implementation.</p>
+   * 
+   * @author Robert Schuster (robertschuster at fsfe.org);
+   *
+   */
+  static class RootElement extends Element
+  {
+    public void writeStart(Writer writer)
+    {
+      writer.write("java", new String[] { "version", "class" },
+                   new String[] { System.getProperty("java.version"),
+                                 XMLEncoder.class.getName() }, false);
+    }
+    
+    public void writeEnd(Writer writer)
+    {
+      writer.writeEnd(false);
+    }
+
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScanEngine.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,860 @@
+/* ScanEngine.java 
+ -- Scans the input and generates an object tree that can be written as XML.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.beans.Expression;
+import java.beans.Statement;
+import java.io.OutputStream;
+import java.lang.reflect.Array;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Stack;
+
+/** <p>The <code>ScanEngine</code> is the main class of the backend of the
+ * XML persistence algorithm. It scans {@link java.beans.Expression} and
+ * {@link java.beans.Statement} instances and some raw objects via the
+ * {@link #writeObject} method and feeds it to a state machine. The
+ * state machine then constructs and object tree which is finally
+ * written as XML by a {@link Writer} implementation.</p>
+ * 
+ * <p>How does it work?</p>
+ * <p>The <code>ScanEngine</code> sits below the {@link java.beans.XMLEncoder}
+ * class and is called by it exclusively. The <code>XMLEncoder</code> sends
+ * interpretive data by invoking {@link #writeExpression}, {@link #writeStatement}
+ * and {@link #writeObject}. The invocations of <code>writeExpression</code> and
+ * <code>writeStatement</code> are usually nested into each other and provide
+ * more information then necessary to generate the XML representation.
+ * Furthermore the meaning of certain <code>Expressions</code> differs
+ * depending on the enclosing elements or the inner elements have to be
+ * simply discarded.</p>
+ * 
+ * <p>To cope with this state dependant nature the <code>ScanEngine</code>
+ * contains a state machine which is programmed statically (no adjustments are
+ * needed, all <code>ScanEngine</code> engines use the same setup). The
+ * <code>ScanEngine</code>'s job is to decode the <code>Expression</code>s,
+ * <code>Statement</code>s and certain objects (namely <code>String</code>,
+ * <code>null</code> objects and instances which are repeatedly provided to
+ * the encoder) into 13 low-level (event) methods, which denote the meaning of the
+ * argument. For example an <code>Expression</code> can be an array
+ * instantiation which provokes a call to {@link arrayInstantiation} or
+ * it can be a class resolution leading to a call to {@link #classResolution}.
+ * For the state machione the 13 methods are the distinct way to transit
+ * from one state to another. Whenever the <code>ScanEngine</code> calls
+ * one of the event methods the current's state successor for that event
+ * is fetched from the state machine configuration, the successpr becomes
+ * the current state and then the event method is called in the new current
+ * state. The last step allows the state instance to do something meaningful
+ * to the object tree.</p>
+ * 
+ * <p>The state machine knows the concept of returning to the previous
+ * state. This is done using a stack of states which is popped every
+ * time a call to <code>writeStatement</code>, <code>writeExpression</code>
+ * in the <code>XMLEncoder</code> ends by calling the {@link #end} method.
+ * Note that due to the inheritance relationship of <code>Encoder</code>
+ * and <code>XMLEncoder</code> it is impossible for the
+ * <code>ScanEngine</code> itself to decide when an expression or statement
+ * ended. This can only be done in case of {@link #writeObject} calls because
+ * they are not nested.</p>
+ * 
+ * <p>When the XML persistence mechanism reaches an object twice (and more)
+ * it should generate an XML element using the "idref" attribute and add
+ * an "id" attribute to its first instantiation. This complicates things a bit
+ * because the first instantiation will always be part of the object tree
+ * as some {@link gnu.java.beans.encoder.elements.Element} subclass instance when the
+ * second and further objects accesses are written. Therefore the {@link ObjectId}
+ * class was introduced which is shared between all the object tree elements
+ * and has the notion of an "unused" state meaning that no identification
+ * is needed. The relationship between an object and its <code>ObjectId</code>
+ * instance is stored in the <code>ScanEngine</code> and gets cleared whenever
+ * the {@link #flush} method is called. This method also writes the currently
+ * built object tree and generates the XML representation.</p>
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class ScanEngine
+{
+  
+  /** Change this to true to let the ScanEngine print state transition
+   * information.
+   */
+  boolean DEBUG = false;
+
+  /**
+   * Stores the scanner engine states as values and their names as keys.
+   */
+  HashMap states = new HashMap();
+
+  /**
+   * Stores former scanner state and makes it possible to come back to them.
+   */
+  Stack parents = new Stack();
+
+  /**
+   * The currently active scanner state.
+   */
+  ScannerState current;
+
+  /**
+   * The root of an object tree that is later written to XML.
+   */
+  Root root;
+
+  /**
+   * The Writer used to generate the XML output.
+   */
+  Writer writer;
+
+  /** Stores the relationship between objects and their {@link ObjectId} instance.
+   */
+  IdentityHashMap objects = new IdentityHashMap();
+  
+  public ScanEngine(OutputStream os)
+  {
+    // TODO: Provide another Writer implementation (e.g. one that does not use
+    // the XML APIs at all).
+    writer = new StAXWriter(os);
+    root = new Root();
+
+    final ScannerState start = current = new GenericScannerState(root);;
+    ScannerState conf;
+
+    // Use the ReportingScannerState to debug serialization issues.
+    register(ScannerState.DEFAULT_STATE_NAME, new IgnoringScannerState());
+
+    register("start", start);
+
+    // Special dead-end state where all transitions are ignored.
+    register("ignoreAll", new IgnoringScannerState())
+      .setDefaultSuccessor("ignoreAll");
+
+    // Object reference, string reference, null object
+    start.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "simple");
+    start.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "simple");
+    start.putSuccessor(ScannerState.TRANSITION_NULL_OBJECT, "simple");
+    register("simple", new GenericScannerState(root))
+      .setDefaultSuccessor("ignoreAll");
+
+    // Class resolution.
+    start.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "classRes0");
+    register("classRes0",
+             new GenericScannerState(root)).setDefaultSuccessor("ignoreAll");
+
+    // Object instantiation.
+    start.putSuccessor(ScannerState.TRANSITION_OBJECT_INSTANTIATION,
+                       "newObj0");
+    conf = register("newObj0", new GenericScannerState(root));
+    conf.setDefaultSuccessor("ignoreAll");
+    
+    // Simply use the start state to encode method invocations inside of
+    // objects.
+    conf.putSuccessor(ScannerState.TRANSITION_METHOD_INVOCATION, "start");
+
+    // Primitive instantiations.
+    start.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                       "newPrimitive0");
+    register("newPrimitive0",
+             new GenericScannerState(root)).setDefaultSuccessor("ignoreAll");
+
+    // Object arrays use the ARRAY_GET transition to create setting the
+    // array values.
+    start.putSuccessor(ScannerState.TRANSITION_OBJECT_ARRAY_INSTANTIATION,
+                       "newObjectArray");
+    conf = register("newObjectArray", new GenericScannerState(root));
+    conf.putSuccessor(ScannerState.TRANSITION_ARRAY_GET, "newOArrayGet");
+    conf.putSuccessor(ScannerState.TRANSITION_ARRAY_SET, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                      "ignoreAll");
+    
+    // Get here when a value is set in the array.
+    register("newOArrayGet",
+             conf = new GenericScannerState(root));
+    
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                      "newOArrayGet_ignoreFirstInteger");
+    
+    // "newArrayGet_ignoreFirstInteger" is set up mostly identical like the "start"
+    // state. Otherwise things would not behave the same when done inside
+    // arrays.
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "simple");
+    conf.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "simple");
+    conf.putSuccessor(ScannerState.TRANSITION_NULL_OBJECT, "simple");
+    conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "classRes0");
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_INSTANTIATION, "newObj0");
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_ARRAY_INSTANTIATION,
+                      "newPrimitiveArray");
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_ARRAY_INSTANTIATION,
+                      "newObjectArray");
+    
+    conf = register("newOArrayGet_ignoreFirstInteger",
+                    new GenericScannerState(root, 1));
+    
+    // In non-int primitive arrays class resolutions can happen
+    // but they should be ignored.
+    conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
+    
+    // Spurious object and string references occur when setting array
+    // elements. This suppresses them.
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                      "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "ignoreAll");
+    
+    conf.setDefaultSuccessor("start");
+
+    // Primitive arrays use the ARRAY_SET transition to create setting the
+    // array values. This turned out to be the only working solution.
+    // When primitive arrays were handled by ARRAY_GET the values in boolean
+    // arrays were always skipped.
+    start.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_ARRAY_INSTANTIATION,
+                       "newPrimitiveArray");
+    conf = register("newPrimitiveArray", new GenericScannerState(root));
+    conf.putSuccessor(ScannerState.TRANSITION_ARRAY_GET, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_ARRAY_SET, "newPArraySet");
+    conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                      "ignoreAll");
+    
+    conf = register("newPArraySet", new GenericScannerState(root));
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                      "newPArraySet_ignoreFirstInteger");
+    
+    // Primitive arrays ignore all kinds of non-primitive object information.
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE,
+                      "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_NULL_OBJECT, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ingoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_INSTANTIATION, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_ARRAY_INSTANTIATION,
+                      "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_ARRAY_INSTANTIATION,
+                      "ignoreAll");
+
+    conf = register("newPArraySet_ignoreFirstInteger",
+                    new GenericScannerState(root, 1));
+    
+    // In non-int primitive arrays class resolutions can happen
+    // but they should be ignored.
+    conf.putSuccessor(ScannerState.TRANSITION_CLASS_RESOLUTION, "ignoreAll");
+    
+    // Spurious object and string references occur when setting array
+    // elements. This suppresses them.
+    conf.putSuccessor(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION,
+                      "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_OBJECT_REFERENCE, "ignoreAll");
+    conf.putSuccessor(ScannerState.TRANSITION_STRING_REFERENCE, "ignoreAll");
+    conf.setDefaultSuccessor("start");
+
+  }
+
+  /** Registers a <code>ScannerState</code> under a certain name.
+   * 
+   * @param name Name of the state
+   * @param state The <code>ScannerState</code> instance.
+   * @return The second argument.
+   */
+  private ScannerState register(String name, ScannerState state)
+  {
+    state.init(name);
+    
+    states.put(name, state);
+
+    return state;
+  }
+  
+  /** Generates or returns an id for the given object which can be activated
+   * later if the object is suitable.
+   * 
+   * <p>Objects are unsuitable if they are an instance of a primitive wrapper
+   * or String.</p>
+   * 
+   * @param value The object to retrieve an id for. 
+   * @return The id for the object or <code>null</code>.
+   */
+  private ObjectId retrieveId(Object value)
+  {
+    Class valueClass = value.getClass();
+    ObjectId id = null;
+    
+    // Although multiple accesses to Class objects are not handled
+    // through ids we generate one for them, too. This allows us to detect
+    // second time references to such objects in the writeObject method
+    // and handle them in a special way.
+    if (valueClass != String.class
+        && valueClass.getSuperclass() != Number.class
+        && valueClass != Boolean.class)
+      {
+        if ((id = (ObjectId) objects.get(value)) == null)
+          {
+            id = new ObjectId(valueClass);
+            objects.put(value, id);
+          }
+      }
+    
+    return id;
+  }
+
+  /** Scans the argument and calls one of event methods. See
+   * the introduction of this class for details.
+   * 
+   * @param expr The expression to serialize.
+   */
+  public void writeExpression(Expression expr)
+  {
+    String methodName = expr.getMethodName();
+    Object[] args = expr.getArguments();
+    Object target = expr.getTarget();
+    Object value = null;
+    
+    try
+      {
+        value = expr.getValue();
+      }
+    catch (Exception e)
+      {
+        throw (InternalError)
+          new InternalError(
+          "The Expression's value should be available at this point.")
+          .initCause(e);
+      }
+
+    // TODO: What if the value is null?
+    ObjectId id;
+    Class valueClass = value.getClass();
+
+    if (target == Array.class)
+      {
+        if (methodName.equals("newInstance"))
+          {
+            id = retrieveId(value);
+            
+            Class ct = (Class) args[0];
+            
+            if (ct.isPrimitive() || ct == Boolean.class || ct == Byte.class
+                || ct == Short.class || ct == Integer.class || ct == Long.class
+                || ct == Float.class || ct == Double.class)
+              primitiveArrayInstantiation(ct.getName(),
+                                          args[1].toString(),
+                                          id);
+            else
+              objectArrayInstantiation(ct.getName(),
+                                       args[1].toString(),
+                                       id);
+            
+            return;
+          }
+        else if (methodName.equals("get"))
+          {
+            arrayGet(args[1].toString());
+
+            // The encoder does not call the ScanEngine
+            // when an object is serialized that we already know.
+            // We test for this situation and insert the object reference
+            // manually.
+            // Since there is already a workaround for the Class class
+            // in writeObject we have to except it from this behavior.
+            id = (ObjectId) objects.get(value);
+            if (id != null && valueClass != Class.class)
+              {
+                objectReference(id);
+                end();
+              }
+            
+            return;
+          }
+        else if (methodName.equals("set"))
+          {
+            arraySet(args[1].toString());
+            return;
+          }
+      }
+    
+    id = retrieveId(value);
+
+    if (target instanceof Class)
+      {
+        if (methodName.equals("new"))
+          {
+            Class targetClass = (Class) target;
+
+            // All primitive types have short-hand forms for their
+            // constructors.
+            if (valueClass == Boolean.class)
+              primitiveInstantiation("boolean", args[0].toString());
+            else if (valueClass == Byte.class)
+              primitiveInstantiation("byte", args[0].toString());
+            else if (valueClass == Short.class)
+              primitiveInstantiation("short", args[0].toString());
+            else if (valueClass == Integer.class)
+              primitiveInstantiation("int", args[0].toString());
+            else if (valueClass == Long.class)
+              primitiveInstantiation("long", args[0].toString());
+            else if (valueClass == Float.class)
+              primitiveInstantiation("float", args[0].toString());
+            else if (valueClass == Double.class)
+              primitiveInstantiation("double", args[0].toString());
+            else
+              objectInstantiation(targetClass.getName(), id);
+
+            return;
+          }
+        else if (value instanceof Class)
+          {
+            String className = ((Class) value).getName();
+
+            // At this point we know that some *static* method will be called.
+
+            if (methodName.equals("forName"))
+              {
+                // However "Class.forName" represents class resolution and has a
+                // special syntax.
+                classResolution(className);
+                return;
+              }
+            else if (methodName.equals("getField"))
+              {
+                // The same goes for "Class.getField".
+                // Note: The name of the wanted field is given in
+                // the argument array.
+                staticFieldAccess(className, args[0].toString());
+                return;
+              }
+            else
+              {
+                // If nothing fits it is just a static method
+                // invocation which we decode as such.
+                staticMethodInvocation(className, methodName);
+                return;
+              }
+          }
+      }
+    else if (target instanceof List)
+      {
+        // Special behavior for indexed get and set method for list-style
+        // classes.
+        // The arguments are in the args array but we need them as subelements.
+        if (methodName.equals("get"))
+          {
+            listGet();
+            return;
+          }
+        else if (methodName.equals("set"))
+          {
+            listSet();
+            return;
+          }
+      }
+
+    // If nothing else could be used then this is a normal
+    // method invocation.
+    methodInvocation(methodName);
+  }
+
+  /**
+   * Ends the current state and returns to the last one.
+   */
+  public void end()
+  {
+    current.end();
+
+    if (DEBUG) System.err.print("back from " + current.getName());
+
+    ScannerState oldCurrent = current;
+    current = (ScannerState) parents.pop();
+
+    if (DEBUG) System.err.println(" to " + current.getName());
+  }
+
+  /**
+   * Returns to the last state and deletes the last element in the object tree.
+   */
+  public void revoke()
+  {
+    ScannerState oldCurrent = current;
+    current = (ScannerState) parents.pop();
+
+    root.deleteLast();
+  }
+
+  /** Scans the argument and calls one of event methods. See
+   * the introduction of this class for details.
+   * 
+   * @param stmt The statement to serialize.
+   */
+  public void writeStatement(Statement stmt)
+  {
+    // This is a simplified version of writeExpression. Everything
+    // that would not create something that is embedded in a <void> tag
+    // is left out (instantiation, getters, ...).
+    // TODO: Is this the right thing to do?
+
+    String methodName = stmt.getMethodName();
+    Object target = stmt.getTarget();
+    Object[] args = stmt.getArguments();
+
+    if (target == Array.class && methodName.equals("set"))
+      {
+        arraySet(args[1].toString());
+        return;
+      }
+
+    if (target instanceof List)
+      {
+        if (methodName.equals("set"))
+          {
+            listSet();
+            return;
+          }
+      }
+
+    // If nothing else could be used then this is a normal
+    // method invocation.
+    methodInvocation(methodName);
+  }
+
+  /** Scans the argument and calls one of event methods. See
+   * the introduction of this class for details.
+   * 
+   * @param o The object to serialize.
+   */
+  public boolean writeObject(Object o)
+  {
+    ObjectId id = null;
+
+    if (o == null)
+      {
+        // Handle null objects which have a special syntax.
+        nullObject();
+        end();
+      }
+    else if (o.getClass() == String.class)
+      {
+        // Handle strings which are treated extremely special
+        // in the encoder (they are never converted into a
+        // Expression).
+        stringReference((String) o);
+        end();
+      }
+    else if ((id = (ObjectId) objects.get(o)) != null)
+      {
+        // Multiple references to a Class object do not generate
+        // an object reference but we use the id to detect that
+        // situation.
+        if (o.getClass() == Class.class)
+          {
+            classResolution(((Class) o).getName());
+            end();
+            return false;
+          }
+        
+        // If our object has a corresponding ObjectId instance
+        // then generate an objectReference. This will 
+        // initialize the id (= brings it in the "used" state)
+        // when this is the first referal.
+        objectReference(id);
+        end();
+        return false;
+      }
+
+    return true;
+  }
+
+  /**
+   * Writes the currently constructed object tree out as
+   * XML and clears the object to {@link ObjectId} relations.
+   */
+  public void flush()
+  {
+    // Make all references unreachable. That means we have to generate
+    // new object ids.
+    objects.clear();
+
+    root.traverse(writer);
+  }
+
+  /** Writes the final bits if the object tree and closes the stream
+   * afterwards.
+   */
+  public void close()
+  {
+    flush();
+    root.close(writer);
+  }
+
+  /**
+   * Does a transition from one state to another using the given event.
+   * 
+   * <p>This involves saving the current state, retrieving it's
+   * successor and setting it as the current state.</p>
+   * 
+   * @param transition One of {@link ScannerStates]'s transition constants.
+   */
+  private void transition(int transition)
+  {
+    parents.push(current);
+
+    String stateName = current.getSuccessor(transition);
+    
+    if (DEBUG)
+      {
+        System.err.println("from state: " + current.getName() + "\n\troute: "
+                           + ScannerState.transitionNames[transition]
+                           + "\n\t\tto state: "
+                           + stateName);
+      }
+    
+    ScannerState newState = (ScannerState) states.get(stateName);
+    
+    newState.enter(new Context(current.getName(), current.getCalls()));
+
+    assert (newState != null) : "State '" + stateName + "' was not defined.";
+
+    current = newState;
+  }
+
+  /** Event method that denotes a (non-static) method invocation.
+   *
+   * <p>More details about this method can be found in this
+   * class' introduction.</p>
+   * 
+   * @param methodName The name of the method which is called.
+   */
+  void methodInvocation(String methodName)
+  {
+    transition(ScannerState.TRANSITION_METHOD_INVOCATION);
+
+    current.methodInvocation(methodName);
+  }
+
+  /** Event method that denotes a static method invocation.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param methodName The name of the method which is called.
+  * @param className The name of the class in which the method is called.
+  */
+  void staticMethodInvocation(String className, String methodName)
+  {
+    transition(ScannerState.TRANSITION_STATIC_METHOD_INVOCATION);
+
+    current.staticMethodInvocation(className, methodName);
+  }
+
+  /** Event method that denotes the retrieval of a static field's value.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param fieldName The name of the field whose value is retrieved.
+  * @param className The name of the class in which the method is called.
+  */
+  void staticFieldAccess(String className, String fieldName)
+  {
+    transition(ScannerState.TRANSITION_STATIC_FIELD_ACCESS);
+
+    current.staticFieldAccess(className, fieldName);
+  }
+
+  /** Event method that denotes the resolution of a class.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param className The name of the class in which the method is called.
+  */
+  void classResolution(String className)
+  {
+    transition(ScannerState.TRANSITION_CLASS_RESOLUTION);
+
+    current.classResolution(className);
+  }
+
+  /** Event method that denotes the instantiation of an object.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param className The name of the class in which the method is called.
+  * @param objectId An ObjectId instance which can be activated later.
+  */
+  void objectInstantiation(String className, ObjectId objectId)
+  {
+    transition(ScannerState.TRANSITION_OBJECT_INSTANTIATION);
+
+    current.objectInstantiation(className, objectId);
+  }
+
+  /** Event method that denotes the instantiation of a primitive.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param primitiveName One of "boolean, "byte", "short", "int", "long"
+  * , "float" or "double"
+  * @param valueAsString The value of the primitive as a String.
+  */
+  void primitiveInstantiation(String primitiveName, String valueAsString)
+  {
+    transition(ScannerState.TRANSITION_PRIMITIVE_INSTANTIATION);
+
+    current.primitiveInstantiation(primitiveName, valueAsString);
+  }
+
+  /** Event method that denotes the instantiation of an object array.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param arrayClassName The array's class name.
+  * @param objectId An ObjectId instance which can be activated later.
+  * @param lengthAsString The array's length as String.
+  */
+  void objectArrayInstantiation(String arrayClassName, String lengthAsString,
+                          ObjectId objectId)
+  {
+    transition(ScannerState.TRANSITION_OBJECT_ARRAY_INSTANTIATION);
+
+    current.objectArrayInstantiation(arrayClassName, lengthAsString, objectId);
+  }
+
+  /** Event method that denotes the instantiation of a primitive array.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param arrayClassName The array's class name.
+  * @param objectId An ObjectId instance which can be activated later.
+  * @param lengthAsString The array's length as String.
+  */
+  void primitiveArrayInstantiation(String arrayClassName, String lengthAsString,
+                                ObjectId objectId)
+  {
+    transition(ScannerState.TRANSITION_PRIMITIVE_ARRAY_INSTANTIATION);
+
+    current.objectArrayInstantiation(arrayClassName, lengthAsString, objectId);
+  }
+  
+  /** Event method that denotes the setting of a value in an array.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param indexAsString The index to as a String.
+  */
+  void arraySet(String indexAsString)
+  {
+    transition(ScannerState.TRANSITION_ARRAY_SET);
+
+    current.arraySet(indexAsString);
+  }
+
+  /** Event method that denotes the retrieval of a value in an array.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  * 
+  * @param indexAsString The index to as a String.
+  */
+  void arrayGet(String indexAsString)
+  {
+    transition(ScannerState.TRANSITION_ARRAY_GET);
+
+    current.arrayGet(indexAsString);
+  }
+
+  /** Event method that denotes the setting of a value in a list.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  */
+  void listSet()
+  {
+    transition(ScannerState.TRANSITION_LIST_SET);
+
+    current.listSet();
+  }
+
+  /** Event method that denotes the retrieval of a value in a list.
+  *
+  * <p>More details about this method can be found in this
+  * class' introduction.</p>
+  */
+  void listGet()
+  {
+    transition(ScannerState.TRANSITION_LIST_GET);
+
+    current.listGet();
+  }
+
+  /** Event method that denotes the null value.
+  */
+  void nullObject()
+  {
+    transition(ScannerState.TRANSITION_NULL_OBJECT);
+
+    current.nullObject();
+  }
+
+  /** Event method that denotes a string.
+   * 
+   * @param string The string that should be written.
+   */
+  void stringReference(String string)
+  {
+    transition(ScannerState.TRANSITION_STRING_REFERENCE);
+
+    current.stringReference(string);
+  }
+
+  /** Event method that denotes a reference to an existing object.
+   * 
+   * @param id The ObjectId to be used.
+   */
+  void objectReference(ObjectId id)
+  {
+    transition(ScannerState.TRANSITION_OBJECT_REFERENCE);
+
+    current.objectReference(id);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScannerState.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScannerState.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScannerState.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/ScannerState.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,236 @@
+/* ScannerState.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.util.HashMap;
+
+/** <p>Provides the infrastructure for the state machine and the transition
+ * mechanism.</p>
+ * 
+ * <p>Each states knows a set of successor. There can be one successor for
+ * every transition variant. Furthermore a state knows about a default
+ * successor which is taken when there is no special setup for a
+ * transition.</p>
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public abstract class ScannerState
+{
+
+  static final int TRANSITION_METHOD_INVOCATION = 0;
+
+  static final int TRANSITION_STATIC_METHOD_INVOCATION = 1;
+
+  static final int TRANSITION_STATIC_FIELD_ACCESS = 2;
+
+  static final int TRANSITION_CLASS_RESOLUTION = 3;
+
+  static final int TRANSITION_OBJECT_INSTANTIATION = 4;
+
+  static final int TRANSITION_PRIMITIVE_INSTANTIATION = 5;
+
+  static final int TRANSITION_OBJECT_ARRAY_INSTANTIATION = 6;
+
+  static final int TRANSITION_PRIMITIVE_ARRAY_INSTANTIATION = 7;
+
+  static final int TRANSITION_ARRAY_SET = 8;
+
+  static final int TRANSITION_ARRAY_GET = 9;
+
+  static final int TRANSITION_LIST_SET = 10;
+
+  static final int TRANSITION_LIST_GET = 11;
+
+  static final int TRANSITION_NULL_OBJECT = 12;
+
+  static final int TRANSITION_STRING_REFERENCE = 13;
+
+  static final int TRANSITION_OBJECT_REFERENCE = 14;
+
+  static final int TRANSITION_FIRST = 0;
+
+  static final int TRANSITION_LAST = 14;
+
+  static final String DEFAULT_STATE_NAME = "default";
+
+  String defaultSuccessor = DEFAULT_STATE_NAME;
+
+  static String[] transitionNames = { "METHOD_INVOCATION", "STATIC_METHOD_INVOCATION",
+                              "STATIC_FIELD_ACCESS", "CLASS_RESOLUTION",
+                              "OBJECT_INSTANTIATION",
+                              "PRIMITIVE_INSTANTIATION", "OBJECT_ARRAY_INSTANTIATION",
+                              "PRIMITIVE_ARRAY_INSTANTIATION",
+                              "ARRAY_SET", "ARRAY_GET", "LIST_SET", "LIST_GET",
+                              "NULL_OBJECT", "STRING_REFERENCE", "OBJECT_REFERENCE" };
+
+  /**
+   * Stores the transition setup as the relation
+   * transition->successor's state name.
+   */
+  HashMap transitions = new HashMap();
+  
+  int calls;
+  
+  Context context;
+  
+  String name;
+  
+  final void init(String newName)
+  {
+    assert (name == null);
+    
+    name = newName;
+  }
+  
+  final String getName()
+  {
+    return name;
+  }
+  
+  final void enter(Context ctx)
+  {
+    calls++;
+    context = ctx;
+    
+    enterImpl(ctx);
+  }
+  
+  protected void enterImpl(Context ctx)
+  {
+  }
+  
+  final Context context()
+  {
+    return context;
+  }
+  
+  final int getCalls()
+  {
+    return calls;
+  }
+
+  /**
+   * <p>Stores a successor's state name for a certain transition.</p>
+   * 
+   * <p>This method is only used at the configuration time of the state
+   * machine.</p>
+   * 
+   * @param transition One of the transition constants.
+   * @param stateName The state name of the successor.
+   */
+  final void putSuccessor(int transition, String stateName)
+  {
+    assert (transition >= TRANSITION_FIRST && transition <= TRANSITION_LAST) :
+      "Transition identifier '" + transition + "' is unknown.";
+
+    transitions.put(new Integer(transition), stateName);
+  }
+
+  /** <p>Retrieves a the state name of a successor for the given transition
+   * constant.</p>
+   * 
+   * <p>Returns the default successor's state name if no special setup was
+   * prepared.</p>
+   * 
+   * @param transition One of the transition constants.
+   * @return The state name of the successor.
+   */
+  final String getSuccessor(int transition)
+  {
+    String state = (String) transitions.get(new Integer(transition));
+
+    return (state == null) ? defaultSuccessor : state;
+  }
+
+  /**
+   * Sets the name for the default successor state.
+   * 
+   * @param newDefaultSuccessor The default successor's state name.
+   */
+  final void setDefaultSuccessor(String newDefaultSuccessor)
+  {
+    defaultSuccessor = newDefaultSuccessor;
+  }
+
+  abstract void methodInvocation(String methodName);
+
+  abstract void staticMethodInvocation(String className, String methodName);
+
+  abstract void staticFieldAccess(String className, String fieldName);
+
+  abstract void classResolution(String className);
+
+  abstract void objectInstantiation(String className, ObjectId objectId);
+
+  abstract void primitiveInstantiation(String primitiveName,
+                                       String valueAsString);
+
+  abstract void objectArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId);
+  
+  abstract void primitiveArrayInstantiation(String arrayClassName, String lengthAsString, ObjectId objectId);
+
+  abstract void arraySet(String indexAsString);
+
+  abstract void arrayGet(String indexAsString);
+
+  abstract void listGet();
+
+  abstract void listSet();
+
+  abstract void nullObject();
+
+  abstract void stringReference(String string);
+
+  abstract void objectReference(ObjectId id);
+
+  /**
+   * <p>A special event that does not provoke a direct transition.</p>
+   * 
+   * <p>Instead the transition is done by the <code>ScanEngine</code>: It goes
+   * back to the previous state and just uses this method to inform the state
+   * about this happening.</p>
+   */
+  abstract void end();
+
+  void enter()
+  {
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/StAXWriter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,233 @@
+/* StAXWriter.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/** A {@link Writer} implementation based on the StAX API.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class StAXWriter implements Writer
+{
+  XMLStreamWriter writer;
+
+  int indent = 0;
+  
+  public StAXWriter(OutputStream os)
+  {
+    try
+      {
+        XMLOutputFactory factory = XMLOutputFactory.newInstance();
+        writer = factory.createXMLStreamWriter(os);
+      }
+    catch (XMLStreamException se)
+      {
+        throw (InternalError)
+          new InternalError(
+          "Could not instantiate a streaming XML writer.")
+          .initCause(se);
+      }
+
+  }
+  
+  public void flush()
+  {
+    if (writer != null)
+      {
+        try
+          {
+            writer.flush();
+          }
+        catch (XMLStreamException xse)
+          {
+            // TODO: find out
+          }
+      }
+
+  }
+
+  public void close()
+  {
+    if (writer != null)
+      {
+        try
+          {
+            writer.close();
+          }
+        catch (XMLStreamException xse)
+          {
+            // TODO: find out
+          }
+        writer = null;
+      }
+
+  }
+
+  public void writePreamble()
+  {
+    try
+      {
+        writer.writeStartDocument("UTF-8", "1.0");
+      }
+    catch (XMLStreamException xmlse)
+      {
+
+      }
+  }
+
+  public void writeEnd(boolean wasEmpty)
+  {
+    try
+      {
+        indent -= 2;
+
+        if (wasEmpty)
+          return;
+
+        for (int i = 0; i < indent; i++)
+          writer.writeCharacters(" ");
+
+        writer.writeEndElement();
+
+        writer.writeCharacters("\n");
+      }
+    catch (XMLStreamException xmlse)
+      {
+
+      }
+  }
+  
+  public void writeEndNoChildren()
+  {
+    try
+      {
+        writer.writeEndElement();
+        writer.writeCharacters("\n");
+      }
+    catch (XMLStreamException xmlse)
+      {
+
+      }
+  }
+
+  public void write(String tagName, boolean empty)
+  {
+    write(tagName, null, null, null, empty);
+  }
+
+  public void write(String tagName, String value)
+  {
+    write(tagName, value, null, null, value == null);
+  }
+
+  public void writeNoChildren(String tagName, String value)
+  {
+    try
+      {
+        for (int i = 0; i < indent; i++)
+          writer.writeCharacters(" ");
+
+        writer.writeStartElement(tagName);
+
+        writer.writeCharacters(value);
+      }
+    catch (XMLStreamException xmlse)
+      {
+
+      }
+  }
+
+  public void write(String tagName, String attributeName,
+                    String attributeValue, boolean empty)
+  {
+    write(tagName, null, new String[] { attributeName },
+          new String[] { attributeValue }, empty);
+  }
+
+  public void write(String tagName, String value, String[] attributeNames,
+                    String[] attributeValues, boolean empty)
+  {
+    try
+      {
+        for (int i = 0; i < indent; i++)
+
+          writer.writeCharacters(" ");
+
+        if (empty)
+          writer.writeEmptyElement(tagName);
+        else
+          writer.writeStartElement(tagName);
+
+        if (attributeNames != null)
+          for (int i = 0; i < attributeNames.length; i++)
+            writer.writeAttribute(attributeNames[i], attributeValues[i]);
+
+        writer.writeCharacters("\n");
+
+        indent += 2;
+
+        if (value != null)
+          {
+            for (int i = 0; i < indent; i++)
+              writer.writeCharacters(" ");
+
+            writer.writeCharacters(value);
+
+            writer.writeCharacters("\n");
+          }
+      }
+    catch (XMLStreamException xmlse)
+      {
+
+      }
+  }
+
+  public void write(String tagName, String[] attributeNames,
+                    String[] attributeValues, boolean empty)
+  {
+    write(tagName, null, attributeNames, attributeValues, empty);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Writer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Writer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Writer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/Writer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,174 @@
+/* Writer.java -- Writing interface for XML persistence.
+ Copyright (C) 2005 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 gnu.java.beans.encoder;
+
+/** A <code>Writer</code> represents a simplified interface to an XML
+ * writer that is used for the XML persistence mechanism.
+ * 
+ * <p>Its sole purpose is to allow multiple backends which may remove
+ * the need to have certain APIs in the classpath. Eg. it is possible
+ * to write a stripped down XML Writer that does not rely on SAX, StAX
+ * or DOM APIs.</p>
+ * 
+ * <p>The caller may assume that every action is done immediately. However
+ * it is possible that the underlying implementation uses buffering streams.
+ * To make sure the data is written call the {@link flush} method.</p>
+ * 
+ * <p>The <code>Writer</code> implementation should care about the formatting
+ * of the XML stream making it possible to generate three types of formats using
+ * a special method invocation chain.</p>
+ * 
+ * <p>Write
+ * <code>
+ * <element/>
+ * </code>
+ * by issuing <code>write("element", true)</code> (or any of the other
+ * write-variants that allows specifying the <code>isEmpty</code> argument)
+ * and <code>writeEnd(true)</code>.</p>
+ * 
+ * <p>Write
+ * <code>
+ * <element>body</element>
+ * </code>
+ * by issuing <code>writeNoChildren("element", "body")</code> and <code>writeNoChildrenEnd()</code>.</p>
+ * 
+ * <p>
+ * Write
+ * <code>
+ * <element>
+ *   <child1/>
+ *   <child2/>
+ *   ...
+ * <element/>
+ * </code>
+ * by issuing <code>write("element", false)</code> (or any of the other
+ * write-variants that allows specifying the <code>isEmpty</code> argument)
+ * and <code>writeEnd(false)</code>.</p>
+ * 
+ * <p>Note: It is important that the values of <code>isEmpty</code> and
+ * <code>wasEmpty</code> match. Otherwise strange things might happen to
+ * the layout.</p>
+ *
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public interface Writer
+{
+  // TODO: This interface's design is not the best. Feel free to 
+  // improve it as you like.
+
+  /** Writes the XML preamble. */
+  void writePreamble();
+
+  /** Writes the end of an XML tag.
+   * 
+   * <p>If your tag has not generated any body text or child
+   * elements provide <code>true</code> as the argument to generate
+   * more space efficient variant of the tag.>/p> 
+   * 
+   * @param wasEmpty Whether the tag was empty or not.
+   */
+  void writeEnd(boolean wasEmpty);
+
+  /** Writes an XML tag without any attributes. 
+   * 
+   * @param tagName The name of the tag to write.
+   * @param empty Whether the element has child elements.
+   */
+  void write(String tagName, boolean empty);
+
+  /** Writes an XML tag with one attribute name and value.
+   * 
+   * @param tagName The name of the tag to write.
+   * @param attributeName The name of attribute. 
+   * @param attributeValue The attribute's value.
+   * @param empty Whether the element has child elements.
+   */
+  void write(String tagName, String attributeName, String attributeValue, boolean empty);
+
+  /** Writes an XML tag with multiple attributes and a body text.
+   * 
+   * @param tagName The name of the tag to write.
+   * @param value The element's body content.
+   * @param attributeNames A set of attribute names.
+   * @param attributeValues A set of attribute values.
+   * @param empty Whether the element has child elements.
+   */
+  void write(String tagName, String value, String[] attributeNames,
+             String[] attributeValues, boolean empty);
+
+  /** Writes an XML tag with multiple attributes without a body text.
+   * 
+   * @param tagName The name of the tag to write.
+   * @param attributeNames A set of attribute names.
+   * @param attributeValues A set of attribute values.
+   * @param empty Whether the element has child elements.
+   */
+  void write(String tagName, String[] attributeNames, String[] attributeValues, boolean empty);
+
+  /** Writes an XML tag with no attributes but with a body text
+   * that may have child elements.
+   * 
+   * @param tagName The name of the tag to write.
+   * @param value The element's body content.
+   */
+  void write(String tagName, String value);
+
+  /** Writes an XML tag with no attributes but with a body text
+   * that does not have child elements.
+   * 
+   * @param tagName The name of the tag to write.
+   * @param value The element's body content.
+   */
+  void writeNoChildren(String tagName, String value);
+  
+  /** Writes the end of an XML tag that has no child elements.
+   * 
+   * <p>Must be used in combination with {@link writeNoChildren} only.</p>
+   */
+  void writeEndNoChildren();
+
+  /** Forces the implementation to write some data.
+   */
+  void flush();
+
+  /** Closes the writer.
+   */
+  void close();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ArrayInstantiation.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,74 @@
+/* ArrayInstantiation.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.ObjectId;
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting the instantiation of an array.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class ArrayInstantiation extends Element
+{
+  final String className;
+
+  final String lengthAsString;
+
+  public ArrayInstantiation(String newClassName, String newLengthAsString)
+  {
+    className = newClassName;
+    lengthAsString = newLengthAsString;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    ObjectId objectId = getId();
+    if (objectId.isUnused())
+      writer.write("array", new String[] { "class", "length" },
+                   new String[] { className, lengthAsString }, isEmpty());
+    else
+      writer.write("array", new String[] { "id", "class", "length" },
+                   new String[] { objectId.toString(), className,
+                                 lengthAsString }, isEmpty());
+
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Get.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* Array_Get.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/**
+ * Generates an XML element denoting the retrieval of an array value.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public class Array_Get extends Element
+{
+  final String indexAsString;
+
+  public Array_Get(String newIndexAsString)
+  {
+    indexAsString = newIndexAsString;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("void", "index", indexAsString, isEmpty());
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Set.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Set.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Set.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Array_Set.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,57 @@
+/* Array_Set.java -- FIXME: briefly describe file purpose
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+public class Array_Set extends Element
+{
+  final String indexAsString;
+
+  public Array_Set(String newIndexAsString)
+  {
+    indexAsString = newIndexAsString;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("void", "index", indexAsString, isEmpty());
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ClassResolution.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,67 @@
+/* ClassResolution.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting the resolution of a class.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class ClassResolution extends Element
+{
+  final String className;
+
+  public ClassResolution(String newClassName)
+  {
+    className = newClassName;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.writeNoChildren("class", className);
+  }
+  
+  public void writeEnd(Writer writer)
+  {
+    writer.writeEndNoChildren();
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Element.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Element.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Element.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/Element.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,157 @@
+/* Element.java -- Base class for object tree elements.
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import gnu.java.beans.encoder.ObjectId;
+import gnu.java.beans.encoder.Writer;
+
+/** <code>Element</code> is the base class for the object tree elements.
+ * 
+ * <p>It provides the neccessary infrastructure every element subclass
+ * needs in order to interact with the {@link gnu.java.beans.encoder.Root}
+ * class.</p>
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ */
+public abstract class Element
+{
+  /**
+   * Stores the child elements.
+   */
+  private LinkedList children = new LinkedList();
+  
+  /**
+   * An optional ObjectId instance which is needed for certain subclasses
+   * only.
+   */
+  private ObjectId objectId;
+  
+  /** Sets an {@link gnu.java.beans.encoder.ObjectId} instance in this
+   * <code>Element</code>.
+   * 
+   * <p>This can only be done once.</p>
+   * 
+   * @param objectId An ObjectId instance.
+   */
+  public final void initId(ObjectId objectId)
+  {
+    assert (this.objectId == null);
+    assert (objectId != null);
+    
+    this.objectId = objectId;
+  }
+
+  /** Adds a child element to this <code>Element</code>.
+   * 
+   * @param elem The new child.
+   */
+  public final void addChild(Element elem)
+  {
+    children.add(elem);
+  }
+  
+  /** Removes the child element added last.
+   */
+  public final void removeLast()
+  {
+    children.removeLast();
+  }
+  
+  /** Provides access to the child elements via an iterator.
+   * 
+   * @return An iterator for the child elements.
+   */
+  public final Iterator iterator(){
+    return children.iterator();
+  }
+  
+  /** Clears all the stored child elements.
+   * 
+   */
+  public final void clear()
+  {
+   children.clear(); 
+  }
+  
+  /** Returns whether this element contains child elements.
+   * 
+   * <p>This method is useful to decide which formatting variant
+   * for the XML element can be chosen.</p>
+   * 
+   * @return Whether the element has child elements.
+   */
+  public final boolean isEmpty()
+  {
+    return children.isEmpty(); 
+  }
+  
+  /** Retrieves the element's {@link gnu.java.beans.encoder.ObjectId} instance
+   * if it has one.
+   * 
+   * @return The ObjectId instance or <code>null</code>.
+   */
+  public final ObjectId getId()
+  {
+    return objectId;
+  }
+  
+  /** Writes the opening XML tag.
+   * 
+   * @param writer The writer to be used for XML writing.
+   */
+  public abstract void writeStart(Writer writer);
+  
+  /** Writes the closing XML tag.
+   * 
+   * <p>By default this does <code>writer.writeEnd(children.isEmpty())</code>.
+   * Override if neccessary, for example when using the
+   * {@link gnu.java.beans.encoder.Writer#writeNoChildren}</code> method
+   * variants. 
+   * 
+   * @param writer The writer to be used for XML writing.
+   */
+  public void writeEnd(Writer writer)
+  {
+    writer.writeEnd(children.isEmpty());
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Get.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* List_Get.java
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting the retrieval of a list's element.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class List_Get extends Element
+{
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("object", "get");
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/List_Set.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* List_Set.java
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting the setting of a list's element.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class List_Set extends Element
+{
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("object", "set");
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/MethodInvocation.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* MethodCall.java
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting a non-static method call.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class MethodInvocation extends Element
+{
+  final String methodName;
+  
+  public MethodInvocation(String newMethodName)
+  {
+    methodName = newMethodName;
+  }
+  
+  public void writeStart(Writer writer)
+  {
+    writer.write("void", "method", methodName, isEmpty());
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/NullObject.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* NullObject.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting the <code>null</code> value.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class NullObject extends Element
+{
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("null", true);
+  }
+
+  public void writeEnd(Writer writer)
+  {
+    writer.writeEnd(true);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectInstantiation.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* ObjectInstantiation.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.ObjectId;
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting the instantiation of an object.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class ObjectInstantiation extends Element
+{
+  final String className;
+
+  public ObjectInstantiation(String newClassName)
+  {
+    className = newClassName;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    ObjectId objectId = getId();
+    if (objectId.isUnused())
+      writer.write("object", "class", className, isEmpty());
+    else
+      writer.write("object", new String[] { "id", "class" },
+                   new String[] { objectId.toString(), className }, isEmpty());
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/ObjectReference.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* StringInstantiation.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.ObjectId;
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting referencing an existing object.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class ObjectReference extends Element
+{
+  final ObjectId id;
+
+  public ObjectReference(ObjectId newId)
+  {
+    id = newId;
+    
+    // Initializing the Id here is making sure it gets
+    // actually used. This step modifies the Id instance
+    // in other elements.
+    id.init();
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("object", "idref", id.toString(), isEmpty());
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/PrimitiveInstantiation.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,69 @@
+/* PrimitiveInstantiation.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting a primitive data value.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class PrimitiveInstantiation extends Element
+{
+  final String primitiveName;
+
+  final String valueAsString;
+
+  public PrimitiveInstantiation(String newPrimitiveName, String newValueAsString)
+  {
+    primitiveName = newPrimitiveName;
+    valueAsString = newValueAsString;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.writeNoChildren(primitiveName, valueAsString);
+  }
+
+  public void writeEnd(Writer writer)
+  {
+    writer.writeEndNoChildren();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticFieldAccess.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* StaticFieldAccess.java
+ Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/** Generates an XML element denoting a static method call.
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class StaticFieldAccess extends Element
+{
+  final String className;
+
+  final String fieldName;
+
+  public StaticFieldAccess(String newClassName, String newFieldName)
+  {
+    className = newClassName;
+    fieldName = newFieldName;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.write("object", new String[] { "class", "field" },
+                 new String[] { className, fieldName }, isEmpty());
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StaticMethodInvocation.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,67 @@
+/* StaticMethodCall.java
+  -- A class denoting an XML element which makes up a static method call.
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+/**
+ * 
+ * @author Robert Schuster (robertschuster at fsfe.org)
+ *
+ */
+public class StaticMethodInvocation extends Element
+{
+  final String className;
+  
+  final String methodName;
+  
+  public StaticMethodInvocation(String newClassName, String newMethodName)
+  {
+    className = newClassName;
+    methodName = newMethodName;
+  }
+  
+  public void writeStart(Writer writer)
+  {
+    writer.write("void", new String[] { "class", "method" },
+                 new String[] { className, methodName }, isEmpty());
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/encoder/elements/StringReference.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,63 @@
+/* StringInstantiation.java
+  -- A class denoting an XML element which retrieves an array element.
+   Copyright (C) 2005 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 gnu.java.beans.encoder.elements;
+
+import gnu.java.beans.encoder.Writer;
+
+public class StringReference extends Element
+{
+  final String string;
+
+  public StringReference(String newString)
+  {
+    string = newString;
+  }
+
+  public void writeStart(Writer writer)
+  {
+    writer.writeNoChildren("string", string);
+  }
+  
+  public void writeEnd(Writer writer)
+  {
+    writer.writeEndNoChildren();
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/beans/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.beans package.
+   Copyright (C) 2005 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.beans</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ASN1ParsingException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ASN1ParsingException.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ASN1ParsingException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ASN1ParsingException.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* ASN1ParsingException.java -- ASN.1 parsing exception.
+   Copyright (C) 2003 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 gnu.java.io;
+
+/**
+ * Signals a malformed ASN.1 sequence.
+ */
+public class ASN1ParsingException extends java.io.IOException
+{
+
+	public ASN1ParsingException()
+	{
+		super();
+	}
+
+	public ASN1ParsingException(String msg)
+	{
+		super(msg);
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/Base64InputStream.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/Base64InputStream.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/Base64InputStream.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/Base64InputStream.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,216 @@
+/* Base64InputStream.java -- base-64 input stream.
+   Copyright (C) 2003, 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 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 gnu.java.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A filter input stream that decodes data encoded in the Base-64
+ * encoding scheme.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public class Base64InputStream extends FilterInputStream
+{
+
+  // Constants and fields.
+  // ------------------------------------------------------------------------
+
+  /** Base-64 digits. */
+  private static final String BASE_64 = 
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+  /** Base-64 padding character. */
+  private static final char BASE_64_PAD = '=';
+
+  /** Decoding state. */
+  private int state;
+
+  /** Intermediate decoded value. */
+  private int temp;
+
+  /** EOF flag. */
+  private boolean eof;
+
+  private final byte[] one = new byte[1];
+
+  // Constructors.
+  // ------------------------------------------------------------------------
+
+  /**
+   * Create a new Base-64 input stream. The input bytes must be the
+   * ASCII characters A-Z, a-z, 0-9, + and /, with optional whitespace,
+   * and will be decoded into a byte stream.
+   *
+   * @param in The source of Base-64 input.
+   */
+  public Base64InputStream(InputStream in)
+  {
+    super(in);
+    state = 0;
+    temp = 0;
+    eof = false;
+  }
+
+  // Class method.
+  // ------------------------------------------------------------------------
+
+  /**
+   * Decode a single Base-64 string to a byte array.
+   *
+   * @param base64 The Base-64 encoded data.
+   * @return The decoded bytes.
+   * @throws IOException If the given data do not compose a valid Base-64
+   *  sequence.
+   */
+  public static byte[] decode(String base64) throws IOException
+  {
+    Base64InputStream in =
+      new Base64InputStream(new ByteArrayInputStream(base64.getBytes()));
+    ByteArrayOutputStream out =
+      new ByteArrayOutputStream((int) (base64.length() / 0.666));
+    byte[] buf = new byte[1024];
+    int len;
+    while ((len = in.read(buf)) != -1)
+      out.write(buf, 0, len);
+    return out.toByteArray();
+  }
+
+  // Instance methods.
+  // ------------------------------------------------------------------------
+
+  public int available()
+  {
+    return 0;
+  }
+
+  public int read() throws IOException
+  {
+    if (read(one) == 1)
+      return one[0];
+    return -1;
+  }
+
+  public int read(byte[] buf, int off, int len) throws IOException
+  {
+    if (eof)
+      return -1;
+    int count = 0;
+    while (count < len)
+      {
+        int i;
+        while (Character.isWhitespace((char) (i = in.read())));
+        int pos = BASE_64.indexOf((char) i);
+        if (pos >= 0)
+          {
+            switch (state)
+              {
+                case 0:
+                  temp = pos << 2;
+                  state = 1;
+                  break;
+                case 1:
+                  buf[count++] = (byte) (temp | (pos >>> 4));
+                  temp = (pos & 0x0F) << 4;
+                  state = 2;
+                  break;
+                case 2:
+                  buf[count++] = (byte) (temp | (pos >>> 2));
+                  temp = (pos & 0x03) << 6;
+                  state = 3;
+                  break;
+                case 3:
+                  buf[count++] = (byte) (temp | pos);
+                  state = 0;
+                  break;
+              }
+          }
+        else if (i == BASE_64_PAD)
+          {
+            switch (state)
+              {
+                case 0:
+                case 1:
+                  throw new IOException("malformed Base-64 input");
+                case 2:
+                  while (Character.isWhitespace((char) (i = in.read())));
+                  if (i != BASE_64_PAD)
+                    throw new IOException("malformed Base-64 input");
+                case 3:
+                  while (Character.isWhitespace((char) (i = in.read())));
+              }
+            eof = true;
+            break;
+          }
+        else  // First non-Base-64 character, consider it end-of-stream.
+          {
+            if (state != 0)
+              throw new IOException("malformed Base-64 input");
+            eof = true;
+            break;
+          }
+      }
+      return count;
+  }
+
+  public boolean markSupported()
+  {
+    return false;
+  }
+
+  public void mark(int markLimit) { }
+
+  public void reset() throws IOException
+  {
+    throw new IOException("reset not supported");
+  }
+
+  public long skip(long n) throws IOException
+  {
+    long skipped;
+    for (skipped = 0; skipped < n; skipped++)
+      if (read() == -1)
+        break;
+    return skipped;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ClassLoaderObjectInputStream.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,73 @@
+/* gnu.java.io.ClassLoaderObjectInputStream
+   Copyright (C) 1998 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 gnu.java.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.StreamCorruptedException;
+
+/**
+ * ClassLoaderObjectInputStream is ObjectInputStream, with
+ * the ability to use a specific ClassLoader.
+ *
+ * @author Geoff Berry
+ * @version 1.1.0, 29 Jul 1998
+ */
+
+public class ClassLoaderObjectInputStream extends ObjectInputStream {
+	ClassLoader myClassLoader;
+
+	/** Create the new ClassLoaderObjectInputStream.
+	 * @param in the InputStream to read the Objects from.
+	 * @param myClassLoader the ClassLoader to load classes
+	 *        with.
+	 */
+	public ClassLoaderObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException,StreamCorruptedException {
+		super(in);
+		this.myClassLoader = myClassLoader;
+	}
+
+	/** Overriden method to use the loadClass() method from
+	 * the ClassLoader.
+	 */
+	public Class resolveClass(String name) throws IOException, ClassNotFoundException {
+		return myClassLoader.loadClass(name);
+	}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/NullOutputStream.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/NullOutputStream.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/NullOutputStream.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/NullOutputStream.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* NullOutputStream.java -- OutputStream that does absolutely nothing
+   Copyright (C) 1998 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 gnu.java.io;
+
+import java.io.OutputStream;
+
+/**
+   This is a placeholder OutputStream that does absolutley nothing
+   when written to.  It is intended to be used in the same manner as
+   /dev/null.  None of this class's methods do anything at all.
+*/
+public class NullOutputStream extends OutputStream
+{
+  public NullOutputStream() {}
+  public void write( int b ) {}
+  public void write( byte b[] ) {}
+  public void write( byte b[], int off, int len ) {}
+  public void flush() {}
+  public void close() {}
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/ObjectIdentityWrapper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* ObjectIdentityWrapper.java -- Wrapper class used to override equals()
+    and hashCode() to be as discriminating as possible
+   Copyright (C) 1998 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 gnu.java.io;
+
+/**
+   This class is a thin wrapper around <code>Object</code> that makes
+   the methods <code>hashCode()</code> and <code>equals(Object)</code>
+   as discriminating as possible.
+*/
+public class ObjectIdentityWrapper
+{
+
+  /**
+     Constructs a <code>ObjectIdentityWrapper</code> that is wrapped
+     around o.
+  */
+  public ObjectIdentityWrapper( Object o )
+  {
+    object = o;
+  }
+
+  /**
+     Uses <code>System.identityHashCode(Object)</code> to compute a
+     hash code for the object wrapped by this
+     <code>ObjectIdentityWrapper</code>.
+
+     @see java.lang.System#identityHashCode(java.lang.Object)
+     @see java.util.Hashtable
+     @see java.lang.Object#hashCode()
+  */
+  public int hashCode()
+  {
+    return System.identityHashCode( object );
+  }
+
+  /**
+     Uses the <code>==</code> operator to test for equality between
+     the object wrapped by this <code>ObjectIdentityWrapper</code> and
+     the object wrapped by the <code>ObjectIdentityWrapper</code> o.
+     Returns false if o is not a <code>ObjectIdentityWrapper</code>.
+
+     @see java.util.Hashtable
+     @see java.lang.Object#equals()
+  */
+  public boolean equals( Object o )
+  {
+    if( o instanceof ObjectIdentityWrapper )
+      return object == ((ObjectIdentityWrapper)o).object;
+    else
+      return false;
+  }
+
+  public String toString()
+  {
+    return "ObjectIdentityWrapper< " + object + ", " + hashCode() + " >";
+  }
+
+  /**
+     The <code>Object</code> wrapped by this
+     <code>ObjectIdentityWrapper</code>.
+  */
+  public Object object;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/PlatformHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/PlatformHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/PlatformHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/PlatformHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,131 @@
+/* PlatformHelper.java -- Isolate OS-specific IO helper methods and variables
+   Copyright (C) 1998, 2002, 2006 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 gnu.java.io;
+
+import java.util.StringTokenizer;
+
+/**
+ * We had many changes in File.java, URLStreamHandler.java etc. to handle
+ * path representations on different platforms (Windows/Unix-family).
+ * Finally we'd like to collect all these ad hoc codes into this utility class.
+ *       --Gansha
+ */
+public class PlatformHelper
+{
+  public static final boolean isWindows = System.getProperty("os.name").indexOf("Windows") >= 0;
+  public static final String separator = System.getProperty("file.separator");
+  public static final char separatorChar = separator.charAt(0);
+  public static final String pathSeparator = System.getProperty("path.separator");
+  public static final char pathSeparatorChar = pathSeparator.charAt(0);
+
+  /**
+   * On most platforms 260 is equal or greater than a max path value, 
+   * so we can set the initial buffer size of StringBuffer to half of this value
+   * to improve performance.
+   */
+  public static final int INITIAL_MAX_PATH = 260/2;
+
+  /**
+   * This routine checks the input param "path" whether it begins with root path
+   * prefix.
+   * if not, return 0;
+   * if yes, return the len of root path prefix;
+   *   --for Unix-family platform, root path begins with "/" and len is 1
+   *   --for Windows platform, root path begins with "drive:\\" and len is 3
+   */
+  public static final int beginWithRootPathPrefix(String path)
+  {
+    if (path.startsWith("/") || path.startsWith("\\"))
+      return 1;
+
+    if (!isWindows)
+      return 0;
+
+    if (path.length() > 2
+        && Character.isLetter(path.charAt(0))
+        && path.charAt(1) == ':'
+        && (path.charAt(2) == '/' || path.charAt(2) == '\\'))
+      return 3;
+
+    return 0;
+  }
+
+  /**
+   * This routine checks the input param "path" whether it's root directory.
+   *  --for Unix-family platform, root directory is "/"
+   *  --for Windows platform, root directory is "\\" or "drive:\\".
+   */
+  public static final boolean isRootDirectory(String path)
+  {
+    int len = path.length();
+    return len > 0 && beginWithRootPathPrefix(path) == len;
+  }
+
+  /**
+   * This routine checks whether input param "path" ends with separator
+   */
+  public static final boolean endWithSeparator(String path)
+  {
+    if (path.endsWith("\\") || path.endsWith("/"))
+      return true;
+
+    return false;
+  }
+
+  /**
+   * This routine removes from input param "path" the tail separator if it exists, 
+   * and return the remain part.
+   */
+  public static final String removeTailSeparator(String path)
+  {
+    if (endWithSeparator(path) && !isRootDirectory(path))
+      return path.substring(0, path.length() - 1);
+
+    return path;
+  }
+
+  /**
+   * This routine returns last index of separator in input param "path", 
+   * and return it.
+   */
+  public static final int lastIndexOfSeparator(String path)
+  {
+    return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/io/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.io package.
+   Copyright (C) 2005 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.io</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ArrayHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ArrayHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ArrayHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ArrayHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,78 @@
+/* ArrayHelper.java -- Helper methods for handling array operations
+   Copyright (C) 1998, 2002 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 gnu.java.lang;
+
+/**
+ * ArrayHelper helps you do things with arrays.
+ *
+ * @author John Keiser
+ */
+public class ArrayHelper
+{
+  /**
+   * Counterpart to java.util.Collection.contains.
+   *
+   * @param array the array to search
+   * @param searchFor the object to locate
+   * @return true if some array element <code>equals(searchFor)</code>
+   */
+  public static boolean contains(Object[] array, Object searchFor)
+  {
+    return indexOf(array, searchFor) != -1;
+  }
+
+  /**
+   * Counterpart to java.util.Collection.indexOf.
+   *
+   * @param array the array to search
+   * @param searchFor the object to locate
+   * @return the index of the first equal object, or -1
+   */
+  public static int indexOf(Object[] array, Object searchFor)
+  {
+    for (int i = 0; i < array.length; i++)
+      {
+        if(array[i].equals(searchFor))
+          {
+            return i;
+          }
+      }
+    return -1;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/CharData.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/CharData.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/CharData.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/CharData.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1705 @@
+/* gnu/java/lang/CharData -- Database for java.lang.Character Unicode info
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   *** This file is generated by scripts/unicode-muncher.pl ***
+
+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 gnu.java.lang;
+
+/**
+ * This contains the info about the unicode characters, that
+ * java.lang.Character needs.  It is generated automatically from
+ * <code>../doc/unicode/UnicodeData-4.0.0.txt</code> and
+ * <code>../doc/unicode/SpecialCasing-4.0.0.txt</code>, by some
+ * perl scripts. These Unicode definition files can be found on the
+ * <a href="http://www.unicode.org">http://www.unicode.org</a> website.
+ * JDK 1.5 uses Unicode version 4.0.0.
+ *
+ * The data is stored as string constants, but Character will convert these
+ * Strings to their respective <code>char[]</code> components.  The fields
+ * are stored in arrays of 17 elements each, one element per Unicode plane.
+ * <code>BLOCKS</code> stores the offset of a block of 2<sup>SHIFT</sup>
+ * characters within <code>DATA</code>.  The DATA field, in turn, stores
+ * information about each character in the low order bits, and an offset
+ * into the attribute tables <code>UPPER</code>, <code>LOWER</code>,
+ * <code>NUM_VALUE</code>, and <code>DIRECTION</code>.  Notice that the
+ * attribute tables are much smaller than 0xffff entries; as many characters
+ * in Unicode share common attributes.  Numbers that are too large to fit
+ * into NUM_VALUE as 16 bit chars are stored in LARGENUMS and a number N is
+ * stored in NUM_VALUE such that (-N - 3) is the offset into LARGENUMS for 
+ * the particular character. The DIRECTION table also contains a field for
+ * detecting characters with multi-character uppercase expansions.
+ * Next, there is a listing for <code>TITLE</code> exceptions (most characters
+ * just have the same title case as upper case).  Finally, there are two
+ * tables for multi-character capitalization, <code>UPPER_SPECIAL</code>
+ * which lists the characters which are special cased, and
+ * <code>UPPER_EXPAND</code>, which lists their expansion.
+ *
+ * @author scripts/unicode-muncher.pl (written by Jochen Hoenicke,
+ *         Eric Blake)
+ * @see Character
+ * @see String
+ */
+public interface CharData
+{
+  /**
+   * The Unicode definition file that was parsed to build this database.
+   */
+  String SOURCE = "../doc/unicode/UnicodeData-4.0.0.txt";
+
+  /**
+   * The character shift amount to look up the block offset. In other words,
+   * <code>(char) (BLOCKS.value[ch >> SHIFT[p]] + ch)</code> is the index 
+   * where <code>ch</code> is described in <code>DATA</code> if <code>ch</code>
+   * is in Unicode plane <code>p</code>.  Note that <code>p</code> is simply
+   * the integer division of ch and 0x10000.
+   */
+  int[] SHIFT
+    = new int[] {4, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8};
+
+  /**
+   * The mapping of character blocks to their location in <code>DATA</code>.
+   * Each entry has been adjusted so that the 16-bit sum with the desired
+   * character gives the actual index into <code>DATA</code>.
+   */
+   String[] BLOCKS = new String[]{
+    "\017\0275\00744Z\uff90\uff9d\uff93\013"
+    + "\uffb5\013\004\034\025\027\007\ufff7\u00ad\u010d\uffc7"
+    + "\uffb7\uff7b\u0111\u0111\u00b7\u0101\uffdc\uff4a\uff37\ufef3\uff17"
+    + "\uff07\ufef5\uff79\u00dc2\u0141\005\uffe7\u013d\u0130\u0137"
+    + "\u0163\u0163\u0112\u0145\u0166\u0156\u0146\u0136\uff81\u0191\u0106"
+    + "\ufe84\u01ca\ufd3a\u01ba\ufd4b\u01aa\ufe74\ufd37\u014e\u01b3\ufcbb"
+    + "\ufcab\ufccc\ufcbc\u0173\ufcb7\ufca7\ufca8\ufc87\ufc77\ufc67\u0113"
+    + "\ufc47\ufc37\ufc42\ufc17\ufe0c\ufdfc\ufcd3\ufcc4\ufcbd\ufe0a\ufdfb"
+    + "\ufdf4\ufed5\ufec3\ufd17\ufd15\u008a\u007f\u00b5\ufdb1\u00dc\ufd6e"
+    + "\u00f9\u00cb\uffe3k\u00f9\ufd0f\ufcff\ufcef\ufcdf\ufccf\011"
+    + "\u00abi\ufffbX\ufc6f\ufd36\uffd6\ufbcc\ufbbc\ufbac\ufc0f"
+    + "\ufbff\uff70\ufff9\ufb5c\ufb4c\ufb3c\ufb2c\ufb1c\ufb0c\ufafc\ufaec"
+    + "\ufadc\ufacc\ufabc\ufaac\ufa9c\ufa8c\ufa7c\ufa6c\ufa5c\ufa4c\ufa3c"
+    + "\ufa2c\ufee1\ufb03\ufaf3\ufef3\ufcd4\uff0b\uff13\uf9ab\ufb8a\uf7fa"
+    + "\ufa69\ufbe5\ufb6e\uf90e\ufea9\ufeaf\ufb79\uf77a\uf9e9\uf8c7\ufdfc"
+    + "\uf760\ufb82\ufe3f\uf6e4\uf980\uf969\uf70e\ufbc6\uf764\ufda9\ufddd"
+    + "\ufa0a\uf67a\uf8e9\ufb48\uf68d\uf5ec\ufd91\uf6c3\uf7c4\uf75b\uf7af"
+    + "\uf75b\uf93b\ufade\ufb5b\ufd17\uf704\uf801\uf7e9\ufba4\ufcd7\uf72f"
+    + "\ufc91\uf6ac\ufb4b\uf781\uf769\ufc77\ufb71\uf99a\ufc11\uf62c\ufacb"
+    + "\uf701\uf6e9\ufa8f\ufbf7\uf95e\ufb91\uf5ac\ufbd4\uf3eb\uf673\uf7da"
+    + "\ufb87\uf832\uf53c\uf527\uf612\uf603\uf5f3\ufa8f\ufa9d\ufa29\uf4bc"
+    + "\uf4ac\uf2c7\uf6f4\uf678\ufab9\ufab9\uf9bf\uf43c\uf42c\ufa89\uf30a"
+    + "\uf6c8\uf6c4\uf4ca\uf4c3\uf89b\uf57d\uf967\uf4cd\uf4c6\uf4b9\uf264"
+    + "\uf34c\uf33c\uf32c\uf413\uf403\uf502\uf969\uf8b7\uf959\uf2bc\uf2ac"
+    + "\uf29c\uf28c\uf927\uf917\uf911\uf343\uf333\uf773\uf313\uf303\uf2f3"
+    + "\uf2e3\uf2d3\uf6ac\uf2b3\uf2a3\uf293\uf283\uf663\uf263\uf253\uf243"
+    + "\uf233\uf7f1\uf20b\uf203\uf1f3\uf1e3\uef2b\uef1b\uf1b3\uf1a3\ueeeb"
+    + "\uf183\uf163\ueec3\ueeb3\uf13b\uf123\uf123\uf103\uee63\uf0f3\uf0e3"
+    + "\uf0cb\uf4ab\uf2c3\uf3d9\uef9c\uef8c\uf073\uf063\uf053\uf043\uf033"
+    + "\uf5f6\uf012\uf003\ueff3\uefe3\uefd3\uefc3\uefb3\uefa3\uef93\uef83"
+    + "\uef73\uef63\uef53\uef43\uef33\uef23\uef13\uef03\ueef3\ueee3\ueed3"
+    + "\ueec3\ueeb3\ueea3\uee93\uee83\uee73\uee63\uee53\uee43\uee33\uee23"
+    + "\uee13\uee03\uedf3\uede3\uedd3\uedc3\ueb2d\uf374\uf176\uf156\ued73"
+    + "\ued63\ued53\ued43\uf279\uf307\ued05\uf2f7\uecf3\uf2e7\uecd3\uf2d7"
+    + "\ueca5\uf2c7\uec93\uec83\uec73\uf297\uee4c\uf292\ueb56\uf291\uf291"
+    + "\ueb26\uebf3\uebe3\uefda\uebc3\uebb3\uf173\ueb93\ueb83\uf201\uea6c"
+    + "\uea5c\uea4c\uea3c\uea2c\ueb13\ueee9\uf132\uec73\ue9f0\ueac3\uee98"
+    + "\uf076\ue99c\ue98c\ue97c\ue96c\ue95c\ue94c\uf0e4\uf0d4\ue91c\ue90c"
+    + "\ue8fc\ue8ec\ue8dc\ue8cc\ue8bc\ue8ac\ue89c\ue88c\ue87c\ue86c\ue85c"
+    + "\ue84c\ue83c\ue82c\ue81c\ue80c\ue7fc\ue7ec\ue7dc\ue7cc\ue7bc\ue7ac"
+    + "\ue79c\ue78c\ue77c\ue76c\ue75c\ue74c\ue73c\ue72c\ue71c\ue70c\ue6fc"
+    + "\ue6ec\ue6dc\ue6cc\ue6bc\ue6ac\ue69c\ue68c\ue67c\ue66c\ue65c\ue64c"
+    + "\ue63c\ue62c\ue6d0\ue6c0\ue6b4\ue6b0\ue6a0\ue690\uee5e\ue5ac\ue59c"
+    + "\ue58c\ue57c\ue56c\ue55c\ue54c\ue53c\ue52c\ue317\ue307\ue2f7\ue2e7"
+    + "\ue2d7\ue2c7\ue2b7\ue2a7\ue297\ue358\ue277\ue267\ue257\ue247\ue237"
+    + "\ue6e8\uecce\uecce\uecae\uec9e\uec9e\uec9e\uec6e\uec8e\uec8e\uec7e"
+    + "\uec6e\uec6e\ue483\uec5e\uec5e\ue165\uec4e\uec4e\ue07b\uec4d\ue053"
+    + "\udff6\ue71b\uec1d\uec1d\ue28c\uec0d\uec0b\ue25c\uebfb\ue607\ue22c"
+    + "\ue2bf\ue9a1\uea8e\ue889\uec17\ue56b\uec07\uec07\uec07\uea12\uebf7"
+    + "\ue914\ue906\ue8ef\ue8e4\ue8e0\ue967\ueb1b\ueb16\ue8d2\ueacf\uea9a"
+    + "\ue8b9\uea9c\ue8d2\ue8f5\uea66\uea63\uea30\ue87c\uea2e\uea1c\ueaa6"
+    + "\ue7b4\uea90\uea8b\uea81\uea71\uea61\ue10d\ue744\ue114\ue734\ue100"
+    + "\ue704\uea29\udf3c\udf2c\ue6c4\ue6b4\ue9d3\udeec\ue9af\udecc\ue9b1"
+    + "\ue99d\ue989\ue989\ue921\ue9aa\ue9a0\ue9a0\ue996\ue582\ue5c4\ue5b4"
+    + "\ue5a4\ue594\ue584\ue574\ue564\ue554\ue544\ue534\ue524\ue7ee\ue502"
+    + "\ue4f4\ue4e4\ue4dc\ue4c4\udea9\ue4a4\ue494\ue484\ue474\ue465\ue77c"
+    + "\ue444\ue768\ue758\udc6c\udc5c\udc4c\udc3c\udc2c\udd98\ue3b4\udd99"
+    + "\ue394\udd4a\ue744\udd61\udd5b\udd51\ue654\ue324\ue63b\udb5c\ue50b"
+    + "\ue6c4\ue2e4\ue2c4\ue2b4\ue2a4\ue294\ue284\ue274\ue264\ue254\ue244"
+    + "\ue234\ue224\ue214\ue204\ue1f4\ue1e4\ue1d4\ue1d4\ue1c4\ue1b4\ue1a4"
+    + "\ue194\ue184\ue174\ue164\ue16e\ue166\ue36c\ue1de\ue1af\ue37b\ue14f"
+    + "\ue0f0\ue0da\ue331\ue13d\ue149\ue094\ue147\ue2bd\ue0d9\ue28c\ue27c"
+    + "\ue081\ue25c\ue24c\ue03d\ue217\ue04c\ue2ec\ud80c\ud7fc\ud7ec\ud7dc"
+    + "\ud7cc\ud7bc\ud7ac\ud79c\ud78c\ud77c\ud76c\ud75c\ud74c\ud73c\ud72c"
+    + "\ud71c\ud70c\ud6fc\ud6ec\ud6dc\ud6cc\ud6bc\ud6ac\ud69c\ud68c\ud67c"
+    + "\ud66c\ud65c\ud64c\ud63c\ud62c\ud61c\ud60c\ud5fc\ud5ec\ud5dc\ud5cc"
+    + "\ud5bc\ud5ac\ud59c\ud58c\ud57c\ud56c\ud55c\ud54c\ud53c\ud52c\ud51c"
+    + "\ud50c\ud4fc\ud4ec\ud4dc\ud4cc\ud4bc\ud4ac\udc44\ud627\udc24\udc14"
+    + "\udc04\udbf4\udbe4\udf06\udbc4\udbb4\udba4\udb94\udb84\udb74\udb64"
+    + "\udb54\udb44\udb34\udb24\udb14\udb04\ude24\ud33c\uddfe\udeb4\udeb2"
+    + "\ud433\ude56\ud3d2\ud3c3\ud3b3\ud3a3\ud393\ud7bc\ud362\ud363\ud353"
+    + "\ud343\ud333\ud71b\ud706\ud303\ud6d9\ud2e2\ud2d3\ud2c3\ud2b3\ud2a3"
+    + "\ud283\ud2e7\ud273\ud833\ud15c\ud14c\ud13c\ud223\udbc1\udbb4\udc30"
+    + "\udb91\udc00\udc82\udb61\udb55\udbd0\udb31\udb21\udb24\udb65\udaf1"
+    + "\udae1\udb45\udac1\udab1\udaa1\uda91\uda81\uda71\uda61\udaba\uda41"
+    + "\uda31\uda21\uda11\uda01\ud9f3\ud9e1\ud9d2\ud013\ud003\ucff3\ucfe3"
+    + "\ucfd3\ucfc3\ucfb3\ucfa3\ucf93\ucf83\ucf73\ucf63\ucf53\ucf43\ucf33"
+    + "\ucf23\ucf13\ucf03\ucef3\ucee3\uced3\ucec3\uceb3\ucea3\uce93\uce83"
+    + "\uce73\uce63\uce53\uce43\uce33\uce23\uce13\uce03\ucdf3\ucde3\ucdd3"
+    + "\ucdc3\ucdb3\ucda3\ucd93\ucd83\ucd73\ucd63\ucd53\ucd43\ucd33\ucd23"
+    + "\ucd13\ucd03\uccf3\ucce3\uccd3\uccc3\uccb3\ucca3\ucc93\ucc83\ucc73"
+    + "\ucc63\ucc53\ucc43\ucc33\ucc23\ucc13\ucc03\ucbf3\ucbe3\ucbd3\ucbc3"
+    + "\ucbb3\ucba3\ucb93\ucb83\ucb73\ucb63\ucb53\ucb43\ucb33\ucb23\ucb13"
+    + "\ucb03\ucaf3\ucae3\ucad3\ucac3\ucab3\ucaa3\uca93\uca83\uca73\uca63"
+    + "\uca53\uca43\uca33\uca23\uca13\uca03\uc9f3\uc9e3\uc9d3\uc9c3\uc9b3"
+    + "\uc9a3\uc993\uc983\uc973\uc963\uc953\uc943\uc933\uc923\uc913\uc903"
+    + "\uc8f3\uc8e3\uc8d3\uc8c3\uc8b3\uc8a3\uc893\uc883\uc873\uc863\uc853"
+    + "\uc843\uc833\uc823\uc813\uc803\uc7f3\uc7e3\uc7d3\uc7c3\uc7b3\uc7a3"
+    + "\uc793\uc783\uc773\uc763\uc753\uc743\uc733\uc723\uc713\uc703\uc6f3"
+    + "\uc6e3\uc6d3\uc6c3\uc6b3\uc6a3\uc693\uc683\uc673\uc663\uc653\uc643"
+    + "\uc633\uc623\uc613\uc603\uc5f3\uc5e3\uc5d3\uc5c3\uc5b3\uc5a3\uc593"
+    + "\uc583\uc573\uc563\uc553\uc543\uc533\uc523\uc513\uc503\uc4f3\uc4e3"
+    + "\uc4d3\uc4c3\uc4b3\uc4a3\uc493\uc483\uc473\uc463\uc453\uc443\uc433"
+    + "\uc423\uc413\uc403\uc3f3\uc3e3\uc3d3\uc3c3\uc3b3\uc3a3\uc393\uc383"
+    + "\uc373\uc363\uc353\uc343\uc333\uc323\uc313\uc303\uc2f3\uc2e3\uc2d3"
+    + "\uc2c3\uc2b3\uc2a3\uc293\uc283\uc273\uc263\uc253\uc243\uc233\uc223"
+    + "\uc213\uc203\uc1f3\uc1e3\uc1d3\uc1c3\uc1b3\uc1a3\uc193\uc183\uc173"
+    + "\uc163\uc153\uc143\uc133\uc123\uc113\uc103\uc0f3\uc0e3\uc0d3\uc0c3"
+    + "\uc0b3\uc0a3\uc093\uc083\uc073\uc063\uc053\uc043\uc033\uc023\uc013"
+    + "\uc003\ubff3\ubfe3\ubfd3\ubfc3\ubfb3\ubfa3\ubf93\ubf83\ubf73\ubf63"
+    + "\ubf53\ubf43\ubf33\ubf23\ubf13\ubf03\ubef3\ubee3\ubed3\ubec3\ubeb3"
+    + "\ubea3\ube93\ube83\ube73\ube63\ube53\ube43\ube33\ube23\ube13\ube03"
+    + "\ubdf3\ubde3\ubdd3\ubdc3\ubdb3\ubda3\ubd93\ubd83\ubd73\ubd63\ubd53"
+    + "\ubd43\ubd33\ubd23\ubd13\ubd03\ubcf3\ubce3\ubcd3\ubcc3\ubcb3\ubca3"
+    + "\ubc93\ubc83\ubc73\ubc63\ubc53\ubc43\ubc33\ubc23\ubc13\ubc03\ubbf3"
+    + "\ubbe3\ubbd3\ubbc3\ubbb3\ubba3\ubb93\ubb83\ubb73\ubb63\ubb53\ubb43"
+    + "\ubb33\ubb23\ubb13\ubb03\ubaf3\ubae3\ubad3\ubac3\ubab3\ubaa3\uba93"
+    + "\uba83\uba73\uba63\uba53\uba43\uba33\uba23\uba13\uba03\ub9f3\ub9e3"
+    + "\ub9d3\ub9c3\ub9b3\ub9a3\ub993\ub983\ub973\ub963\ub953\ub943\ub933"
+    + "\ub923\ub913\ub903\ub8f3\ub8e3\ub8d3\ub8c3\ub8b3\ub8a3\ub893\ub883"
+    + "\ub873\ub863\ub853\ub843\ub833\ub823\ub813\ub803\ub7f3\ub7e3\ub7d3"
+    + "\ub7c3\ub7b3\ub7a3\ub793\ub783\ub773\ub763\ub753\ub743\ub733\ub723"
+    + "\ub713\ub703\ub6f3\ub6e3\ub6d3\ub6c3\ub6b3\ub6a3\ub693\ub683\ub673"
+    + "\ubc35\ubd04\ubcf4\ubce4\ubcd4\ub613\ub603\ub5f3\ub5e3\ub5d3\ub5c3"
+    + "\ub5b3\ub5a3\ub593\ub583\ub573\ub563\ub553\ub543\ub533\ub523\ub513"
+    + "\ub503\ub4f3\ub4e3\ub4d3\ub4c3\ub4b3\ub4a3\ub493\ub483\ub473\ub463"
+    + "\ub453\ub443\ub433\ub423\ub413\ub403\ub3f3\ub3e3\ub3d3\ub3c3\ub3b3"
+    + "\ub3a3\ub393\ub383\ub373\ub363\ub353\ub343\ub333\ub323\ub313\ub303"
+    + "\ub2f3\ub2e3\ub2d3\ub2c3\ub2b3\ub2a3\ub293\ub283\ub273\ub263\ub253"
+    + "\ub243\ub233\ub223\ub213\ub203\ub1f3\ub1e3\ub1d3\ub1c3\ub1b3\ub1a3"
+    + "\ub193\ub183\ub173\ub163\ub153\ub143\ub133\ub123\ub113\ub103\ub0f3"
+    + "\ub0e3\ub0d3\ub0c3\ub0b3\ub0a3\ub093\ub083\ub073\ub063\ub053\ub043"
+    + "\ub033\ub023\ub013\ub003\uaff3\uafe3\uafd3\uafc3\uafb3\uafa3\uaf93"
+    + "\uaf83\uaf73\uaf63\uaf53\uaf43\uaf33\uaf23\uaf13\uaf03\uaef3\uaee3"
+    + "\uaed3\uaec3\uaeb3\uaea3\uae93\uae83\uae73\uae63\uae53\uae43\uae33"
+    + "\uae23\uae13\uae03\uadf3\uade3\uadd3\uadc3\uadb3\uada3\uad93\uad83"
+    + "\uad73\uad63\uad53\uad43\uad33\uad23\uad13\uad03\uacf3\uace3\uacd3"
+    + "\uacc3\uacb3\uaca3\uac93\uac83\uac73\uac63\uac53\uac43\uac33\uac23"
+    + "\uac13\uac03\uabf3\uabe3\uabd3\uabc3\uabb3\uaba3\uab93\uab83\uab73"
+    + "\uab63\uab53\uab43\uab33\uab23\uab13\uab03\uaaf3\uaae3\uaad3\uaac3"
+    + "\uaab3\uaaa3\uaa93\uaa83\uaa73\uaa63\uaa53\uaa43\uaa33\uaa23\uaa13"
+    + "\uaa03\ua9f3\ua9e3\ua9d3\ua9c3\ua9b3\ua9a3\ua993\ua983\ua973\ua963"
+    + "\ua953\ua943\ua933\ua923\ua913\ua903\ua8f3\ua8e3\ua8d3\ua8c3\ua8b3"
+    + "\ua8a3\ua893\ua883\ua873\ua863\ua853\ua843\ua833\ua823\ua813\ua803"
+    + "\ua7f3\ua7e3\ua7d3\ua7c3\ua7b3\ua7a3\ua793\ua783\ua773\ua763\ua753"
+    + "\ua743\ua733\ua723\ua713\ua703\ua6f3\ua6e3\ua6d3\ua6c3\ua6b3\ua6a3"
+    + "\ua693\ua683\ua673\ua663\ua653\ua643\ua633\ua623\ua613\ua603\ua5f3"
+    + "\ua5e3\ua5d3\ua5c3\ua5b3\ua5a3\ua593\ua583\ua573\ua563\ua553\ua543"
+    + "\ua533\ua523\ua513\ua503\ua4f3\ua4e3\ua4d3\ua4c3\ua4b3\ua4a3\ua493"
+    + "\ua483\ua473\ua463\ua453\ua443\ua433\ua423\ua413\ua403\ua3f3\ua3e3"
+    + "\ua3d3\ua3c3\ua3b3\ua3a3\ua393\ua383\ua373\ua363\ua353\ua343\ua333"
+    + "\ua323\ua313\ua303\ua2f3\ua2e3\ua2d3\ua2c3\ua2b3\ua2a3\ua293\ua283"
+    + "\ua273\ua263\ua253\ua243\ua233\ua223\ua213\ua203\ua1f3\ua1e3\ua1d3"
+    + "\ua1c3\ua1b3\ua1a3\ua193\ua183\ua173\ua163\ua153\ua143\ua133\ua123"
+    + "\ua113\ua103\ua0f3\ua0e3\ua0d3\ua0c3\ua0b3\ua0a3\ua093\ua083\ua073"
+    + "\ua063\ua053\ua043\ua033\ua023\ua013\ua003\u9ff3\u9fe3\u9fd3\u9fc3"
+    + "\u9fb3\u9fa3\u9f93\u9f83\u9f73\u9f63\u9f53\u9f43\u9f33\u9f23\u9f13"
+    + "\u9f03\u9ef3\u9ee3\u9ed3\u9ec3\u9eb3\u9ea3\u9e93\u9e83\u9e73\u9e63"
+    + "\u9e53\u9e43\u9e33\u9e23\u9e13\u9e03\u9df3\u9de3\u9dd3\u9dc3\u9db3"
+    + "\u9da3\u9d93\u9d83\u9d73\u9d63\u9d53\u9d43\u9d33\u9d23\u9d13\u9d03"
+    + "\u9cf3\u9ce3\u9cd3\u9cc3\u9cb3\u9ca3\u9c93\u9c83\u9c73\u9c63\u9c53"
+    + "\u9c43\u9c33\u9c23\u9c13\u9c03\u9bf3\u9be3\u9bd3\u9bc3\u9bb3\u9ba3"
+    + "\u9b93\u9b83\u9b73\u9b63\u9b53\u9b43\u9b33\u9b23\u9b13\u9b03\u9af3"
+    + "\u9ae3\u9ad3\u9ac3\u9ab3\u9aa3\u9a93\u9a83\u9a73\u9a63\u9a53\u9a43"
+    + "\u9a33\u9a23\u9a13\u9a03\u99f3\u99e3\u99d3\u99c3\u99b3\u99a3\u9993"
+    + "\u9983\u9973\u9963\u9953\u9943\u9933\u9923\u9913\u9903\u98f3\u98e3"
+    + "\u98d3\u98c3\u98b3\u98a3\u9893\u9883\u9873\u9863\u9853\u9843\u9833"
+    + "\u9823\u9813\u9803\u97f3\u97e3\u97d3\u97c3\u97b3\u97a3\u9793\u9783"
+    + "\u9773\u9763\u9753\u9743\u9733\u9723\u9713\u9703\u96f3\u96e3\u96d3"
+    + "\u96c3\u96b3\u96a3\u9693\u9683\u9673\u9663\u9653\u9643\u9633\u9623"
+    + "\u9613\u9603\u95f3\u95e3\u95d3\u95c3\u95b3\u95a3\u9593\u9583\u9573"
+    + "\u9563\u9553\u9543\u9533\u9523\u9513\u9503\u94f3\u94e3\u94d3\u94c3"
+    + "\u94b3\u94a3\u9493\u9483\u9473\u9463\u9453\u9443\u9433\u9423\u9413"
+    + "\u9403\u93f3\u93e3\u93d3\u93c3\u93b3\u93a3\u9393\u9383\u9373\u9363"
+    + "\u9353\u9343\u9333\u9323\u9313\u9303\u92f3\u92e3\u92d3\u92c3\u92b3"
+    + "\u92a3\u9293\u9283\u9273\u9263\u9253\u9243\u9233\u9223\u9213\u9203"
+    + "\u91f3\u91e3\u91d3\u91c3\u91b3\u91a3\u9193\u9183\u9173\u9163\u9153"
+    + "\u9143\u9133\u9123\u9113\u9103\u90f3\u90e3\u90d3\u90c3\u90b3\u90a3"
+    + "\u9093\u9083\u9073\u9063\u9053\u9043\u9033\u9023\u9013\u9003\u8ff3"
+    + "\u8fe3\u8fd3\u8fc3\u8fb3\u8fa3\u8f93\u8f83\u8f73\u8f63\u8f53\u8f43"
+    + "\u8f33\u8f23\u8f13\u8f03\u8ef3\u8ee3\u8ed3\u8ec3\u8eb3\u8ea3\u8e93"
+    + "\u8e83\u8e73\u8e63\u8e53\u8e43\u8e33\u8e23\u8e13\u8e03\u8df3\u8de3"
+    + "\u8dd3\u8dc3\u8db3\u8da3\u8d93\u8d83\u8d73\u8d63\u8d53\u8d43\u8d33"
+    + "\u8d23\u8d13\u8d03\u8cf3\u8ce3\u8cd3\u8cc3\u8cb3\u8ca3\u8c93\u8c83"
+    + "\u8c73\u8c63\u8c53\u8c43\u8c33\u8c23\u8c13\u8c03\u8bf3\u8be3\u8bd3"
+    + "\u8bc3\u8bb3\u8ba3\u8b93\u8b83\u8b73\u8b63\u8b53\u8b43\u8b33\u8b23"
+    + "\u8b13\u8b03\u8af3\u8ae3\u8ad3\u8ac3\u8ab3\u8aa3\u8a93\u8a83\u8a73"
+    + "\u8a63\u8a53\u8a43\u8a33\u8a23\u8a13\u8a03\u89f3\u89e3\u89d3\u89c3"
+    + "\u89b3\u89a3\u8993\u8983\u8973\u8963\u8953\u8943\u8933\u8923\u8913"
+    + "\u8903\u88f3\u88e3\u88d3\u88c3\u88b3\u88a3\u8893\u8883\u8873\u8863"
+    + "\u8853\u8843\u8833\u8823\u8813\u8803\u87f3\u87e3\u87d3\u87c3\u87b3"
+    + "\u87a3\u8793\u8783\u8773\u8763\u8753\u8743\u8733\u8723\u8713\u8703"
+    + "\u86f3\u86e3\u86d3\u86c3\u86b3\u86a3\u8693\u8683\u8673\u8663\u8653"
+    + "\u8643\u8633\u8623\u8613\u8603\u85f3\u85e3\u85d3\u85c3\u85b3\u85a3"
+    + "\u8593\u8583\u8573\u8563\u8553\u8543\u8533\u8523\u8513\u8503\u84f3"
+    + "\u84e3\u84d3\u84c3\u84b3\u84a3\u8493\u8483\u8473\u8463\u8453\u8443"
+    + "\u8433\u8423\u8413\u8403\u83f3\u83e3\u83d3\u83c3\u83b3\u83a3\u8393"
+    + "\u8383\u8373\u8363\u8353\u8343\u8333\u8323\u8313\u8303\u82f3\u82e3"
+    + "\u82d3\u82c3\u82b3\u82a3\u8293\u8283\u8273\u8263\u8253\u8243\u8233"
+    + "\u8223\u8213\u8203\u81f3\u81e3\u81d3\u81c3\u81b3\u81a3\u8193\u8183"
+    + "\u8173\u8163\u8153\u8143\u8133\u8123\u8113\u8103\u80f3\u80e3\u80d3"
+    + "\u80c3\u80b3\u80a3\u8093\u8083\u8073\u8063\u8053\u8043\u8033\u8023"
+    + "\u8013\u8003\u7ff3\u7fe3\u7fd3\u7fc3\u7fb3\u7fa3\u7f93\u7f83\u7f73"
+    + "\u7f63\u7f53\u7f43\u7f33\u7f23\u7f13\u7f03\u7ef3\u7ee3\u7ed3\u7ec3"
+    + "\u7eb3\u7ea3\u7e93\u7e83\u7e73\u7e63\u7e53\u7e43\u7e33\u7e23\u7e13"
+    + "\u7e03\u7df3\u7de3\u7dd3\u7dc3\u7db3\u7da3\u7d93\u7d83\u7d73\u7d63"
+    + "\u7d53\u7d43\u7d33\u7d23\u7d13\u7d03\u7cf3\u7ce3\u7cd3\u7cc3\u7cb3"
+    + "\u7ca3\u7c93\u7c83\u7c73\u7c63\u7c53\u7c43\u7c33\u7c23\u7c13\u7c03"
+    + "\u7bf3\u7be3\u7bd3\u7bc3\u7bb3\u7ba3\u7b93\u7b83\u7b73\u7b63\u7b53"
+    + "\u7b43\u7b33\u7b23\u7b13\u7b03\u7af3\u7ae3\u7ad3\u7ac3\u7ab3\u7aa3"
+    + "\u7a93\u7a83\u7a73\u7a63\u7a53\u7a43\u7a33\u7a23\u7a13\u7a03\u79f3"
+    + "\u79e3\u79d3\u79c3\u79b3\u79a3\u7993\u7983\u7973\u7963\u7953\u7943"
+    + "\u7933\u7923\u7913\u7903\u78f3\u78e3\u78d3\u78c3\u78b3\u78a3\u7893"
+    + "\u7883\u7873\u7863\u7853\u7843\u7833\u7823\u7813\u7803\u77f3\u77e3"
+    + "\u77d3\u77c3\u77b3\u77a3\u7793\u7783\u7773\u7763\u7753\u7743\u7733"
+    + "\u7723\u7713\u7703\u76f3\u76e3\u76d3\u76c3\u76b3\u76a3\u7693\u7683"
+    + "\u7673\u7663\u7653\u7643\u7633\u7623\u7613\u7603\u75f3\u75e3\u75d3"
+    + "\u75c3\u75b3\u75a3\u7593\u7583\u7573\u7563\u7553\u7543\u7533\u7523"
+    + "\u7513\u7503\u74f3\u74e3\u74d3\u74c3\u74b3\u74a3\u7493\u7483\u7473"
+    + "\u7463\u7453\u7443\u7433\u7423\u7413\u7403\u73f3\u73e3\u73d3\u73c3"
+    + "\u73b3\u73a3\u7393\u7383\u7373\u7363\u7353\u7343\u7333\u7323\u7313"
+    + "\u7303\u72f3\u72e3\u72d3\u72c3\u72b3\u72a3\u7293\u7283\u7273\u7263"
+    + "\u7253\u7243\u7233\u7223\u7213\u7203\u71f3\u71e3\u71d3\u71c3\u71b3"
+    + "\u71a3\u7193\u7183\u7173\u7163\u7153\u7143\u7133\u7123\u7113\u7103"
+    + "\u70f3\u70e3\u70d3\u70c3\u70b3\u70a3\u7093\u7083\u7073\u7063\u7053"
+    + "\u7043\u7033\u7023\u7013\u7003\u6ff3\u6fe3\u6fd3\u6fc3\u6fb3\u6fa3"
+    + "\u6f93\u6f83\u6f73\u6f63\u6f53\u6f43\u6f33\u6f23\u6f13\u6f03\u6ef3"
+    + "\u6ee3\u6ed3\u6ec3\u6eb3\u6ea3\u6e93\u6e83\u6e73\u6e63\u6e53\u6e43"
+    + "\u6e33\u6e23\u6e13\u6e03\u6df3\u6de3\u6dd3\u6dc3\u6db3\u6da3\u6d93"
+    + "\u6d83\u6d73\u6d63\u6d53\u6d43\u6d33\u6d23\u6d13\u6d03\u6cf3\u6ce3"
+    + "\u6cd3\u6cc3\u6cb3\u6ca3\u6c93\u6c83\u6c73\u6c63\u6c53\u6c43\u6c33"
+    + "\u6c23\u6c13\u6c03\u6bf3\u6be3\u6bd3\u6bc3\u6bb3\u6ba3\u6b93\u6b83"
+    + "\u6b73\u6b63\u6b53\u6b43\u6b33\u6b23\u6b13\u6b03\u6af3\u6ae3\u6ad3"
+    + "\u6ac3\u6ab3\u6aa3\u6a93\u6a83\u6a73\u6a63\u6a53\u6a43\u6a33\u6a23"
+    + "\u6a13\u6a03\u69f3\u69e3\u69d3\u69c3\u69b3\u69a3\u6993\u6983\u6973"
+    + "\u6963\u6953\u6943\u6933\u6923\u6913\u6903\u68f3\u68e3\u68d3\u68c3"
+    + "\u68b3\u68a3\u6893\u6883\u6873\u6863\u6853\u6843\u6833\u6823\u6813"
+    + "\u6803\u67f3\u67e3\u67d3\u67c3\u67b3\u67a3\u6793\u6783\u6773\u6763"
+    + "\u6753\u6743\u6733\u6723\u6713\u6703\u66f3\u66e3\u66d3\u66c3\u66b3"
+    + "\u66a3\u6693\u6683\u6673\u6663\u6653\u6643\u6633\u6623\u6613\u6603"
+    + "\u65f3\u65e3\u65d3\u65c3\u65b3\u65a3\u6593\u6583\u6573\u6563\u6553"
+    + "\u6543\u6533\u6523\u6513\u6503\u64f3\u64e3\u64d3\u64c3\u64b3\u64a3"
+    + "\u6493\u6483\u6a45\u636c\u635c\u634c\u633c\u632c\u6413\u6403\u63f3"
+    + "\u63e3\u63d3\u63c3\u63b3\u63a3\u6393\u6383\u6373\u6363\u6353\u6343"
+    + "\u6333\u6323\u6313\u6303\u62f3\u62e3\u62d3\u62c3\u62b3\u62a3\u6293"
+    + "\u6283\u6273\u6263\u6253\u6243\u6233\u6223\u6213\u6203\u61f3\u61e3"
+    + "\u61d3\u61c3\u61b3\u61a3\u6193\u6183\u6173\u6163\u6153\u6143\u6133"
+    + "\u6123\u6113\u6103\u60f3\u60e3\u60d3\u60c3\u60b3\u60a3\u6093\u6083"
+    + "\u6073\u6063\u6053\u6043\u6033\u6023\u6013\u6003\u5ff3\u5fe3\u5fd3"
+    + "\u5fc3\u5fb3\u5fa3\u6379\u6634\u6624\u6614\u6933\u5e4c\u5e3c\u5e2c"
+    + "\u5e1c\u5e0c\u5dfc\u5dec\u5ddc\u5dcc\u5dbc\u5dac\u5d9c\u5d8c\u5d7c"
+    + "\u5d6c\u5d5c\u5d4c\u5d3c\u5d2c\u5d1c\u5d0c\u5cfc\u5cec\u5cdc\u5ccc"
+    + "\u5cbc\u5cac\u5c9c\u5c8c\u5c7c\u5c6c\u5c5c\u5c4c\u5c3c\u5c2c\u5c1c"
+    + "\u5c0c\u5bfc\u5bec\u5bdc\u5bcc\u5bbc\u5bac\u5b9c\u5b8c\u5b7c\u5b6c"
+    + "\u5b5c\u5b4c\u5b3c\u5b2c\u5b1c\u5b0c\u5afc\u5aec\u5adc\u5acc\u5abc"
+    + "\u5aac\u5a9c\u5a8c\u5a7c\u5a6c\u5a5c\u5a4c\u5a3c\u5a2c\u5a1c\u5a0c"
+    + "\u59fc\u59ec\u59dc\u59cc\u59bc\u59ac\u599c\u598c\u597c\u596c\u595c"
+    + "\u594c\u593c\u592c\u591c\u590c\u58fc\u58ec\u58dc\u58cc\u58bc\u58ac"
+    + "\u589c\u588c\u587c\u586c\u585c\u584c\u583c\u582c\u581c\u580c\u57fc"
+    + "\u57ec\u57dc\u57cc\u57bc\u57ac\u579c\u578c\u577c\u576c\u575c\u574c"
+    + "\u573c\u572c\u5813\u5803\u57f3\u57e3\u57d3\u57c3\u57b3\u57a3\u5793"
+    + "\u5783\u5773\u5763\u5753\u5743\u5733\u5723\u5713\u5703\u56f3\u56e3"
+    + "\u56d3\u56c3\u56b3\u56a3\u5693\u5683\u5673\u5663\u5653\u5643\u5633"
+    + "\u5623\u5613\u5603\u55f3\u55e3\u55d3\u55c3\u55b3\u55a3\u5593\u5583"
+    + "\u5573\u5563\u5553\u5543\u5533\u5523\u5513\u5503\u54f3\u54e3\u54d3"
+    + "\u54c3\u54b3\u54a3\u5493\u5483\u5473\u5463\u5453\u5443\u5433\u5423"
+    + "\u5413\u5403\u53f3\u53e3\u53d3\u53c3\u53b3\u53a3\u5393\u5383\u5373"
+    + "\u5363\u5353\u5343\u5333\u5323\u5313\u5303\u52f3\u52e3\u52d3\u52c3"
+    + "\u52b3\u52a3\u5293\u5283\u5273\u5263\u5253\u5243\u5233\u5223\u5213"
+    + "\u5203\u51f3\u51e3\u51d3\u51c3\u51b3\u51a3\u5193\u5183\u5173\u5163"
+    + "\u5153\u5143\u5133\u5123\u5113\u5103\u50f3\u50e3\u50d3\u50c3\u50b3"
+    + "\u50a3\u5093\u5083\u5073\u5063\u5053\u5043\u5033\u5023\u5013\u5003"
+    + "\u4ff3\u4fe3\u4fd3\u4fc3\u4fb3\u4fa3\u4f93\u4f83\u4f73\u4f63\u4f53"
+    + "\u4f43\u4f33\u4f23\u4f13\u4f03\u4ef3\u4ee3\u4ed3\u4ec3\u4eb3\u4ea3"
+    + "\u4e93\u4e83\u4e73\u4e63\u4e53\u4e43\u4e33\u4e23\u4e13\u4e03\u4df3"
+    + "\u4de3\u4dd3\u4dc3\u4db3\u4da3\u4d93\u4d83\u4d73\u4d63\u4d53\u4d43"
+    + "\u4d33\u4d23\u4d13\u4d03\u4cf3\u4ce3\u4cd3\u4cc3\u4cb3\u4ca3\u4c93"
+    + "\u4c83\u4c73\u4c63\u4c53\u4c43\u4c33\u4c23\u4c13\u4c03\u4bf3\u4be3"
+    + "\u4bd3\u4bc3\u4bb3\u4ba3\u4b93\u4b83\u4b73\u4b63\u4b53\u4b43\u4b33"
+    + "\u4b23\u4b13\u4b03\u4af3\u4ae3\u4ad3\u4ac3\u4ab3\u4aa3\u4a93\u4a83"
+    + "\u4a73\u4a63\u4a53\u4a43\u4a33\u4a23\u4a13\u4a03\u49f3\u49e3\u49d3"
+    + "\u49c3\u49b3\u49a3\u4993\u4983\u4973\u4963\u4953\u4943\u4933\u4923"
+    + "\u4913\u4903\u48f3\u48e3\u48d3\u48c3\u48b3\u48a3\u4893\u4883\u4873"
+    + "\u4863\u4853\u4843\u4833\u4823\u4813\u4803\u47f3\u47e3\u47d3\u47c3"
+    + "\u47b3\u47a3\u4793\u4783\u4773\u4763\u4753\u4743\u4733\u4723\u4713"
+    + "\u4703\u46f3\u46e3\u46d3\u46c3\u46b3\u46a3\u4693\u4683\u4673\u4663"
+    + "\u4653\u4643\u4633\u4623\u4613\u4603\u45f3\u45e3\u45d3\u45c3\u45b3"
+    + "\u45a3\u4593\u4583\u4573\u4563\u4553\u4543\u4533\u4523\u4513\u4503"
+    + "\u44f3\u44e3\u44d3\u44c3\u44b3\u44a3\u4493\u4483\u4473\u4463\u4453"
+    + "\u4443\u4433\u4423\u4413\u4403\u43f3\u43e3\u43d3\u43c3\u43b3\u43a3"
+    + "\u4393\u4383\u4373\u4363\u4353\u4343\u4333\u4323\u4313\u4303\u42f3"
+    + "\u42e3\u42d3\u42c3\u42b3\u42a3\u4293\u4283\u4273\u4263\u4253\u4243"
+    + "\u4233\u4223\u4213\u4203\u41f3\u41e3\u41d3\u41c3\u41b3\u41a3\u4193"
+    + "\u4183\u4173\u4163\u4153\u4143\u4133\u4123\u4113\u4103\u40f3\u40e3"
+    + "\u40d3\u40c3\u40b3\u40a3\u4093\u4083\u4073\u4063\u4053\u4043\u4033"
+    + "\u4023\u4013\u4003\u3ff3\u3fe3\u3fd3\u3fc3\u3fb3\u3fa3\u3f93\u3f83"
+    + "\u3f73\u3f63\u3f53\u3f43\u3f33\u3f23\u3f13\u3f03\u3ef3\u3ee3\u3ed3"
+    + "\u3ec3\u3eb3\u3ea3\u3e93\u3e83\u3e73\u3e63\u3e53\u3e43\u3e33\u3e23"
+    + "\u3e13\u3e03\u3df3\u3de3\u3dd3\u3dc3\u3db3\u3da3\u3d93\u3d83\u3d73"
+    + "\u3d63\u3d53\u3d43\u3d33\u3d23\u3d13\u3d03\u3cf3\u3ce3\u3cd3\u3cc3"
+    + "\u3cb3\u3ca3\u3c93\u3c83\u3c73\u3c63\u3c53\u3c43\u3c33\u3c23\u3c13"
+    + "\u3c03\u3bf3\u3be3\u3bd3\u3bc3\u3bb3\u3ba3\u3b93\u3b83\u3b73\u3b63"
+    + "\u3b53\u3b43\u3b33\u3b23\u3b13\u3b03\u3af3\u3ae3\u3ad3\u3ac3\u3ab3"
+    + "\u3aa3\u3a93\u3a83\u3a73\u3a63\u3a53\u3a43\u3a33\u3a23\u3a13\u3a03"
+    + "\u39f3\u39e3\u39d3\u39c3\u39b3\u39a3\u3993\u3983\u3973\u3963\u3953"
+    + "\u3943\u3933\u3923\u3913\u3903\u38f3\u38e3\u38d3\u38c3\u38b3\u38a3"
+    + "\u3893\u3883\u3873\u3863\u3853\u3843\u3833\u3823\u3813\u3803\u37f3"
+    + "\u37e3\u37d3\u37c3\u37b3\u37a3\u3793\u3783\u3773\u3763\u3753\u3743"
+    + "\u3733\u3723\u3713\u3703\u36f3\u36e3\u36d3\u36c3\u36b3\u36a3\u3693"
+    + "\u3683\u3673\u3663\u3653\u3643\u3633\u3623\u3613\u3603\u35f3\u35e3"
+    + "\u35d3\u35c3\u35b3\u35a3\u3593\u3583\u3573\u3563\u3553\u3543\u3533"
+    + "\u3523\u3513\u3503\u34f3\u34e3\u34d3\u34c3\u34b3\u34a3\u3493\u3483"
+    + "\u3473\u3463\u3453\u3443\u3433\u3423\u3413\u3403\u33f3\u33e3\u33d3"
+    + "\u33c3\u33b3\u33a3\u3393\u3383\u3373\u3363\u3353\u3343\u3333\u3323"
+    + "\u3313\u3303\u32f3\u32e3\u32d3\u32c3\u32b3\u32a3\u3293\u3283\u3273"
+    + "\u3263\u3253\u3243\u3233\u3223\u3213\u3203\u31f3\u31e3\u31d3\u31c3"
+    + "\u31b3\u31a3\u3193\u3183\u3173\u3163\u3153\u3143\u3133\u3123\u3113"
+    + "\u3103\u30f3\u30e3\u30d3\u30c3\u30b3\u30a3\u3093\u3083\u3073\u3063"
+    + "\u3053\u3043\u3033\u3023\u3013\u3003\u2ff3\u2fe3\u2fd3\u2fc3\u2fb3"
+    + "\u2fa3\u2f93\u2f83\u2f73\u2f63\u2f53\u2f43\u2f33\u2f23\u2f13\u2f03"
+    + "\u2ef3\u2ee3\u2ed3\u2ec3\u2eb3\u2ea3\u2e93\u2e83\u2e73\u2e63\u2e53"
+    + "\u2e43\u2e33\u2e23\u2e13\u2e03\u2df3\u2de3\u2dd3\u2dc3\u2db3\u2da3"
+    + "\u2d93\u2d83\u2d73\u2d63\u2d53\u2d43\u2d33\u2d23\u2d13\u2d03\u2cf3"
+    + "\u2ce3\u2cd3\u2cc3\u2cb3\u2ca3\u2c93\u2c83\u3247\u2b6c\u2b5c\u2b4c"
+    + "\u2b3c\u2b2c\u36e2\u36d2\u36c2\u36b2\u36a2\u3692\u3682\u3672\u3662"
+    + "\u3652\u3642\u3632\u3622\u3612\u3602\u35f2\u35e2\u35d2\u35c2\u35b2"
+    + "\u35a2\u3592\u3582\u3572\u3562\u3552\u3542\u3532\u3522\u3512\u3502"
+    + "\u34f2\u34e2\u34d2\u34c2\u34b2\u34a2\u3492\u3482\u3472\u3462\u3452"
+    + "\u3442\u3432\u3422\u3412\u3402\u33f2\u33e2\u33d2\u33c2\u33b2\u33a2"
+    + "\u3392\u3382\u3372\u3362\u3352\u3342\u3332\u3322\u3312\u3302\u32f2"
+    + "\u32e2\u32d2\u32c2\u32b2\u32a2\u3292\u3282\u3272\u3262\u3252\u3242"
+    + "\u3232\u3222\u3212\u3202\u31f2\u31e2\u31d2\u31c2\u31b2\u31a2\u3192"
+    + "\u3182\u3172\u3162\u3152\u3142\u3132\u3122\u3112\u3102\u30f2\u30e2"
+    + "\u30d2\u30c2\u30b2\u30a2\u3092\u3082\u3072\u3062\u3052\u3042\u3032"
+    + "\u3022\u3012\u3002\u2ff2\u2fe2\u2fd2\u2fc2\u2fb2\u2fa2\u2f92\u2f82"
+    + "\u2f72\u2f62\u2f52\u2f42\u2f32\u2f22\u2f12\u2f02\u2ef2\u2ef2\u2ee2"
+    + "\u2ed2\u2ec2\u2eb2\u2ea2\u2e92\u2e82\u2e72\u2e62\u2e52\u2e42\u2e32"
+    + "\u2e22\u2e12\u2e02\u2df2\u2de2\u2dd2\u2dc2\u2db2\u2da2\u2d92\u2d82"
+    + "\u2d72\u2d62\u2d52\u2d42\u2d32\u2d22\u2d12\u2d02\u2cf2\u2ce2\u2cd2"
+    + "\u2cc2\u2cb2\u2ca2\u2c92\u2c82\u2c72\u2c62\u2c52\u2c42\u2c32\u2c22"
+    + "\u2c12\u2c02\u2bf2\u2be2\u2bd2\u2bc2\u2bb2\u2ba2\u2b92\u2b82\u2b72"
+    + "\u2b62\u2b52\u2b42\u2b32\u2b22\u2b12\u2b02\u2af2\u2ae2\u2ad2\u2ac2"
+    + "\u2ab2\u2aa2\u2a92\u2a82\u2a72\u2a62\u2a52\u2a42\u2a32\u2a22\u2a12"
+    + "\u2a02\u29f2\u29e2\u29d2\u29c2\u29b2\u29a2\u2992\u2982\u2972\u2962"
+    + "\u2952\u2942\u2932\u2922\u2912\u2902\u28f2\u28e2\u28d2\u28c2\u28b2"
+    + "\u28a2\u2892\u2882\u2872\u2862\u2852\u2842\u2832\u2822\u2812\u2802"
+    + "\u27f2\u27e2\u27d2\u27c2\u27b2\u27a2\u2792\u2782\u2772\u2762\u2752"
+    + "\u2742\u2732\u2722\u2712\u2702\u26f2\u26e2\u26d2\u26c2\u26b2\u26a2"
+    + "\u2692\u2682\u2672\u2662\u2652\u2642\u2632\u2622\u2612\u2602\u25f2"
+    + "\u25e2\u25d2\u25c2\u25b2\u25a2\u2592\u2582\u2572\u2562\u2552\u2542"
+    + "\u2532\u2522\u2512\u2502\u24f2\u24e2\u24d2\u24c2\u24b2\u24a2\u2492"
+    + "\u2482\u2472\u2462\u2452\u2442\u2432\u2422\u2412\u2402\u23f2\u23e2"
+    + "\u23d2\u23c2\u23b2\u23a2\u2392\u2382\u2372\u2362\u2352\u2342\u2332"
+    + "\u2322\u2312\u2302\u22f2\u22e2\u22d2\u22c2\u22b2\u22a2\u2292\u2282"
+    + "\u2272\u2262\u2252\u2242\u2232\u2222\u2212\u2202\u21f2\u21e2\u21d2"
+    + "\u21c2\u21b2\u21a2\u2192\u2182\u2172\u2162\u2152\u2142\u2132\u2122"
+    + "\u2112\u2102\u20f2\u20e2\u20d2\u20c2\u20b2\u20a2\u2092\u2082\u2072"
+    + "\u2062\u2052\u2042\u2032\u2022\u2012\u2002\u1ff2\u1fe2\u1fd2\u1fc2"
+    + "\u1fb2\u1fa2\u1f92\u1f82\u1f72\u1f62\u1f52\u1f42\u1f32\u1f22\u1f12"
+    + "\u1f02\u1ef2\u1ee2\u1ed2\u1ec2\u1eb2\u1ea2\u1e92\u1e82\u1e72\u1e62"
+    + "\u1e52\u1e42\u1e32\u1e22\u1e12\u1e02\u1df2\u1de2\u1dd2\u1dc2\u1db2"
+    + "\u1da2\u1d92\u1d82\u1d72\u1d62\u1d52\u1d42\u1d32\u1d22\u1d12\u1d02"
+    + "\u1cf2\u1ce2\u1cd2\u1cc2\u1cb2\u1ca2\u1c92\u1c82\u1c72\u1c62\u1c52"
+    + "\u1c42\u1c32\u1c22\u1c12\u1c02\u1bf2\u1be2\u1bd2\u1bc2\u1bb2\u1ba2"
+    + "\u1b92\u1b82\u1b72\u1b62\u1b52\u1b42\u1b32\u1b22\u1b12\u1b02\u1af2"
+    + "\u1ae2\u1ad2\u1ac2\u1ab2\u1aa2\u1a92\u1a82\u1a72\u1a62\u1a52\u1a42"
+    + "\u1a32\u1a22\u1a12\u1a02\u19f2\u19e2\u19d2\u19c2\u19b2\u19a2\u1992"
+    + "\u1982\u1972\u1962\u1952\u1942\u1932\u1922\u1912\u1902\u18f2\u18e2"
+    + "\u18d2\u18c2\u18b2\u18a2\u1892\u1882\u1872\u1862\u1852\u1842\u1832"
+    + "\u1822\u1812\u1802\u17f2\u17e2\u17d2\u17c2\u17b2\u17a2\u1792\u1782"
+    + "\u1772\u1762\u1752\u1742\u1732\u1722\u1712\u1702\u16f2\u16e2\u16d2"
+    + "\u16c2\u16b2\u16a2\u1692\u1682\u1672\u1662\u1652\u1642\u1632\u1622"
+    + "\u1612\u1602\u0b13\u0b03\u0af3\u0ae3\u0ad3\u0ac3\u0ab3\u0aa3\u0a93"
+    + "\u0a83\u0a73\u0a63\u0a53\u0a43\u0a33\u0a23\u0a13\u0a03\u0dd8\u09e3"
+    + "\u09d3\u09c3\u0d9b\u08ac\u089c\u088c\u087c\u086c\u085c\u084c\u083c"
+    + "\u082c\u1402\u0b35\u13f2\u13ec\u0b14\u083f\u082f\u081f\u080f\u07ff"
+    + "\u07ef\u0b82\u075c\u07bc\u07af\u079f\u078f\u077f\u076f\u075f\u074f"
+    + "\u073f\u072f\u071f\u070f\u06ff\u06ef\u06df\u06cf\u06bf\u06af\u069f"
+    + "\u068f\u067f\u066f\u0661\u05dc\u063f\u062f\u061f\u060f\u05fd\u05ef"
+    + "\u05df\u096c\u054c\u053c\u09a9\u0666\u050c\u0818\u10fc\u10f8\u0e1e"
+    + "\u10e8\u08b3\u050f\u04ff\u04ef\u04df\u04cf\u04bf\u04af\u087c\u0795"
+    + "\u0127\u0154\u0154\u017a\u1008\u0859\u08ad\u0493\u0485\u0473\u0453"
+    + "\u01c3\u038b\u0f88\u0333",
+
+    "\000\uffff?\004\004\u00fd\u00bd}=\ufffd\uffbd"
+    + "\uff7d\uff7d\ufef2\uff2d\ufe7d\ufc7f\ufc6f\ufe6d\ufd7d\ufd3d\ufcfd"
+    + "\ufcbd\ufc7d\ufc3d\ufbfd\ufbbd\ufb7d\ufb3d\ufafd\ufabd\ufa7d\ufb2d"
+    + "\uf9fd\uf9bd\uf97d\uf93d\uf8fd\uf8bd\uf87d\uf83d\uf7fd\uf7bd\uf77d"
+    + "\uf73d\uf6fd\uf6bd\uf67d\uf63d\uf5fd\uf5bd\uf57d\uf53d\uf4fd\uf4bd"
+    + "\uf47d\uf43d\uf3fd\uf3bd\uf37d\uf33d\uf2fd\uf2bd\uf27d\uf23d\uf1fd"
+    + "\uf1bd\uf17d\uf13d\uf0fd\uf0bd\uf07d\uf03d\ueffd\uefbd\uef7d\uef3d"
+    + "\ueefd\ueebd\uee7d\uee3d\uedfd\uedbd\ued7d\ued3d\uecfd\uecbd\uec7d"
+    + "\uec3d\uebfd\uebbd\ueb7d\ueb3d\ueafd\ueabd\uea7d\uea3d\ue9fd\ue9bd"
+    + "\ue97d\ue93d\ue8fd\ue8bd\ue87d\ue83d\ue7fd\ue7bd\ue77d\ue73d\ue6fd"
+    + "\ue6bd\ue67d\ue63d\ue5fd\ue5bd\ue57d\ue53d\ue4fd\ue4bd\ue47d\ue43d"
+    + "\ue3fd\ue3bd\ue37d\ue33d\ue2fd\ue2bd\ue27d\ue23d\ue1fd\ue1bd\ue17d"
+    + "\ue13d\ue0fd\ue0bd\ue07d\ue03d\udffd\udfbd\udf7d\udf3d\udefd\udebd"
+    + "\ude7d\ude3d\uddfd\uddbd\udd7d\udd3d\udcfd\udcbd\udc7d\udc3d\udbfd"
+    + "\udbbd\udb7d\udb3d\udafd\udabd\uda7d\uda3d\ud9fd\ud9bd\ud97d\ud93d"
+    + "\ud8fd\ud8bd\ud87d\ud83d\ud7fd\ud7bd\ud77d\ud73d\ud6fd\ud6bd\ud67d"
+    + "\ud63d\ud5fd\ud5bd\ud57d\ud53d\ud4fd\ud4bd\ud47d\ud43d\ud3fd\ud3bd"
+    + "\ud37d\ud33d\ud2fd\ud2bd\ud27d\ud23d\ud1fd\ud1bd\ud17d\ud13d\ud0fd"
+    + "\ud0bd\ud07d\ud03d\ucffd\ucfbd\ucf7d\ucf3d\ucefd\ucebd\uce7d\uce3d"
+    + "\ucdfd\ucdbd\ucd7d\ucd3d\uccfd\uccbd\ucc7d\ucc3d\ucbfd\ucbbd\ucb7d"
+    + "\ucb3d\ucafd\ucabd\uca7d\uca3d\uc9fd\uc9bd\uc97d\uc93d\uc8fd\uc8bd"
+    + "\uc87d\uc83d\uc7fd\uc7bd\uc77d\uc73d\uc6fd\uc6bd\uc67d\uc63d\uc5fd"
+    + "\uc5bd\uc57d\uc53d\uc4fd\uc4bd\uc47d\uc43d\uc3fd\uc3bd\uc37d\uc33d"
+    + "\uc2fd\uc2bd\uc27d\uc23d\uc1fd\uc1bd\uc17d\uc13d\uc0fd\uc0bd\uc07d"
+    + "\uc03d\ubffd\ubfbd\ubf7d\ubf3d\ubefd\ubebd\ube7d\ube3d\ubdfd\ubdbd"
+    + "\ubd7d\ubd3d\ubcfd\ubcbd\ubc7d\ubc3d\ubbfd\ubbbd\ubb7d\ubb3d\ubafd"
+    + "\ubabd\uba7d\uba3d\ub9fd\ub9bd\ub97d\ub93d\ub8fd\ub8bd\ub87d\ub83d"
+    + "\ub7fd\ub7bd\ub77d\ub73d\ub6fd\ub6bd\ub67d\ub63d\ub5fd\ub5bd\ub57d"
+    + "\ub53d\ub4fd\ub4bd\ub47d\ub43d\ub3fd\ub3bd\ub37d\ub33d\ub2fd\ub2bd"
+    + "\ub27d\ub23d\ub1fd\ub1bd\ub17d\ub13d\ub0fd\ub0bd\ub07d\ub03d\uaffd"
+    + "\uafbd\uaf7d\uaf3d\uaefd\uaebd\uae7d\uae3d\uadfd\uadbd\uad7d\uad3d"
+    + "\uacfd\uacbd\uac7d\uac3d\uabfd\uabbd\uab7d\uab3d\uaafd\uaabd\uaa7d"
+    + "\uaa3d\ua9fd\ua9bd\ua97d\ua93d\ua8fd\ua8bd\ua87d\ua83d\ua7fd\ua7bd"
+    + "\ua77d\ua73d\ua6fd\ua6bd\ua67d\ua63d\ua5fd\ua5bd\ua57d\ua53d\ua4fd"
+    + "\ua4bd\ua47d\ua43d\ua3fd\ua3bd\ua37d\ua33d\ua2fd\ua2bd\ua27d\ua23d"
+    + "\ua1fd\ua1bd\ua17d\ua13d\ua0fd\ua0bd\ua07d\ua03d\u9ffd\u9fbd\u9f7d"
+    + "\u9f3d\u9efd\u9ebd\u9e7d\u9e3d\u9dfd\u9dbd\u9d7d\u9d3d\u9cfd\u9cbd"
+    + "\u9c7d\u9c3d\u9bfd\u9bbd\u9b7d\u9b3d\u9afd\u9abd\u9a7d\u9a3d\u99fd"
+    + "\u99bd\u997d\u993d\u98fd\u98bd\u987d\u983d\u97fd\u97bd\u977d\u973d"
+    + "\u96fd\u96bd\u967d\u963d\u95fd\u95bd\u957d\u953d\u94fd\u94bd\u947d"
+    + "\u943d\u93fd\u93bd\u937d\u933d\u92fd\u92bd\u927d\u923d\u91fd\u91bd"
+    + "\u917d\u913d\u90fd\u90bd\u907d\u903d\u8ffd\u8fbd\u8f7d\u8f3d\u8efd"
+    + "\u8ebd\u8e7d\u8e3d\u8dfd\u8dbd\u8d7d\u8d3d\u8cfd\u8cbd\u8c7d\u8c3d"
+    + "\u8bfd\u8bbd\u8b7d\u8b3d\u8afd\u8abd\u8a7d\u8a3d\u89fd\u89bd\u897d"
+    + "\u893d\u88fd\u88bd\u887d\u883d\u87fd\u87bd\u877d\u873d\u86fd\u86bd"
+    + "\u867d\u863d\u85fd\u85bd\u857d\u853d\u84fd\u84bd\u847d\u843d\u83fd"
+    + "\u83bd\u837d\u833d\u82fd\u82bd\u827d\u823d\u81fd\u81bd\u817d\u813d"
+    + "\u80fd\u80bd\u807d\u803d\u7ffd\u7fbd\u7f7d\u7f3d\u7efd\u7ebd\u7e7d"
+    + "\u7e3d\u7dfd\u7dbd\u7d7d\u7d3d\u7cfd\u7cbd\u7c7d\u7c3d\u7bfd\u7bbd"
+    + "\u7b7d\u7b3d\u7afd\u7abd\u7a7d\u7a3d\u79fd\u79bd\u797d\u793d\u78fd"
+    + "\u78bd\u787d\u783d\u77fd\u77bd\u777d\u773d\u76fd\u76bd\u767d\u763d"
+    + "\u75fd\u75bd\u757d\u753d\u74fd\u74bd\u747d\u743d\u73fd\u73bd\u737d"
+    + "\u733d\u72fd\u72bd\u727d\u723d\u71fd\u71bd\u717d\u713d\u70fd\u70bd"
+    + "\u707d\u703d\u6ffd\u6fbd\u6f7d\u6f3d\u6efd\u6ebd\u6e7d\u6e3d\u6dfd"
+    + "\u6dbd\u6d7d\u6d3d\u6cfd\u6cbd\u6c7d\u6c3d\u6bfd\u6bbd\u6b7d\u6b3d"
+    + "\u6afd\u6abd\u6a7d\u6a3d\u69fd\u69bd\u697d\u693d\u68fd\u68bd\u687d"
+    + "\u683d\u67fd\u67bd\u677d\u673d\u66fd\u66bd\u667d\u663d\u65fd\u65bd"
+    + "\u657d\u653d\u64fd\u64bd\u647d\u643d\u63fd\u63bd\u637d\u633d\u62fd"
+    + "\u62bd\u627d\u623d\u61fd\u61bd\u617d\u613d\u60fd\u60bd\u607d\u603d"
+    + "\u5ffd\u5fbd\u5f7d\u5f3d\u5efd\u5ebd\u5e7d\u5e3d\u5dfd\u5dbd\u5d7d"
+    + "\u5d3d\u5cfd\u5cbd\u5c7d\u5c3d\u5bfd\u5bbd\u5b7d\u5b3d\u5afd\u5abd"
+    + "\u5a7d\u5a3d\u59fd\u59bd\u597d\u593d\u58fd\u58bd\u587d\u583d\u57fd"
+    + "\u57bd\u577d\u573d\u56fd\u56bd\u567d\u563d\u55fd\u55bd\u557d\u553d"
+    + "\u54fd\u54bd\u547d\u543d\u53fd\u53bd\u537d\u533d\u52fd\u52bd\u527d"
+    + "\u523d\u51fd\u51bd\u517d\u513d\u50fd\u50bd\u507d\u503d\u4ffd\u4fbd"
+    + "\u4f7d\u4f3d\u4efd\u4ebd\u4e7d\u4e3d\u4dfd\u4dbd\u4d7d\u4d3d\u4cfd"
+    + "\u4cbd\u4c7d\u4c3d\u4bfd\u4bbd\u4b7d\u4b3d\u4afd\u4abd\u4a7d\u4a3d"
+    + "\u49fd\u49bd\u497d\u493d\u48fd\u48bd\u487d\u483d\u47fd\u47bd\u477d"
+    + "\u473d\u46fd\u46bd\u467d\u463d\u45fd\u45bd\u457d\u453d\u44fd\u44bd"
+    + "\u447d\u443d\u43fd\u43bd\u437d\u433d\u42fd\u42bd\u427d\u423d\u41fd"
+    + "\u41bd\u417d\u413d\u40fd\u40bd\u407d\u403d\u3ffd\u3fbd\u3f7d\u3f3d"
+    + "\u3efd\u3ebd\u3e7d\u3e3d\u3dfd\u3dbd\u3d7d\u3d3d\u3cfd\u3cbd\u3c7d"
+    + "\u3c3d\u3bfd\u3bbd\u3b7d\u3b3d\u3afd\u3abd\u3a7d\u3a3d\u39fd\u39bd"
+    + "\u397d\u393d\u38fd\u38bd\u387d\u383d\u37fd\u37bd\u377d\u373d\u36fd"
+    + "\u36bd\u367d\u363d\u35fd\u35bd\u357d\u353d\u34fd\u34bd\u347d\u343d"
+    + "\u33fd\u33bd\u337d\u333d\u32fd\u32bd\u327d\u31d0\u3190\u3150\u311a"
+    + "\u30a6\u2ffb\u2ff8\u3032\u303d\u2ffd\u2fbd\u2f7d\u306d\u3056\u2ebd"
+    + "\u2e7d\u3034\u306a\u30a3\u2f64\u3060\u2fa5\u2ec8\u2e94\u2e2c\u2df8"
+    + "\u2df8\u2d16\u2cdc\u2ca2\u2c68\u2de0\u2a3d\u29fd\u29bd\u297d\u293d"
+    + "\u28fd\u28bd\u287d\u283d\u27fd\u27bd\u277d\u273d\u26fd\u26bd\u267d"
+    + "\u263d\u25fd\u25bd\u257d\u253d\u24fd\u24bd\u247d\u243d\u23fd\u23bd"
+    + "\u237d\u233d\u22fd\u22bd\u227d\u223d\u21fd\u21bd\u217d\u213d\u20fd"
+    + "\u20bd\u207d\u203d\u1ffd\u1fbd\u1f7d\u1f3d\u1efd\u1ebd\u1e7d\u1e3d"
+    + "\u1dfd\u1dbd\u1d7d\u1d3d\u1cfd\u1cbd\u1c7d\u1c3d\u1bfd\u1bbd\u1b7d"
+    + "\u1b3d\u1afd\u1abd\u1a7d\u1a3d\u19fd\u19bd\u197d\u193d\u18fd\u18bd"
+    + "\u187d\u183d\u17fd\u17bd\u177d\u173d\u16fd\u16bd\u167d\u163d\u15fd"
+    + "\u15bd\u157d\u153d\u14fd\u14bd\u147d\u143d\u13fd\u13bd\u137d\u133d"
+    + "\u12fd\u12bd\u127d\u123d\u11fd\u11bd\u117d\u113d\u10fd\u10bd\u107d"
+    + "\u103d\u0ffd\u0fbd\u0f7d\u0f3d\u0efd\u0ebd\u0e7d\u0e3d\u0dfd\u0dbd"
+    + "\u0d7d\u0d3d\u0cfd\u0cbd\u0c7d\u0c3d\u0bfd\u0bbd\u0b7d\u0b3d\u0afd"
+    + "\u0abd\u0a7d\u0a3d\u09fd\u09bd\u097d\u093d\u08fd\u08bd\u087d\u083d"
+    + "\u07fd\u07bd\u077d\u073d\u06fd\u06bd\u067d\u063d\u05fd\u05bd\u057d"
+    + "\u053d\u04fd\u04bd\u047d\u043d\u03fd\u03bd\u037d\u033d\u02fd\u02bd"
+    + "\u027d",
+
+    "\000\uff80\uff00\ufe80\ufe00\ufd80\ufd00\ufc80\ufc00\ufb80\ufb00"
+    + "\ufa80\ufa00\uf980\uf900\uf880\uf800\uf780\uf700\uf680\uf600\uf580"
+    + "\uf500\uf480\uf400\uf380\uf300\uf280\uf200\uf180\uf100\uf080\uf000"
+    + "\uef80\uef00\uee80\uee00\ued80\ued00\uec80\uec00\ueb80\ueb00\uea80"
+    + "\uea00\ue980\ue900\ue880\ue800\ue780\ue700\ue680\ue600\ue580\ue500"
+    + "\ue480\ue400\ue380\ue300\ue280\ue200\ue180\ue100\ue080\ue000\udf80"
+    + "\udf00\ude80\ude00\udd80\udd00\udc80\udc00\udb80\udb00\uda80\uda00"
+    + "\ud980\ud900\ud880\ud800\ud780\ud700\ud680\ud600\ud580\ud500\ud480"
+    + "\ud400\ud380\ud300\ud280\ud200\ud180\ud100\ud080\ud000\ucf80\ucf00"
+    + "\uce80\uce00\ucd80\ucd00\ucc80\ucc00\ucb80\ucb00\uca80\uca00\uc980"
+    + "\uc900\uc880\uc800\uc780\uc700\uc680\uc600\uc580\uc500\uc480\uc400"
+    + "\uc380\uc300\uc280\uc200\uc180\uc100\uc080\uc000\ubf80\ubf00\ube80"
+    + "\ube00\ubd80\ubd00\ubc80\ubc00\ubb80\ubb00\uba80\uba00\ub980\ub900"
+    + "\ub880\ub800\ub780\ub700\ub680\ub600\ub580\ub500\ub480\ub400\ub380"
+    + "\ub300\ub280\ub200\ub180\ub100\ub080\ub000\uaf80\uaf00\uae80\uae00"
+    + "\uad80\uad00\uac80\uac00\uab80\uab00\uaa80\uaa00\ua980\ua900\ua880"
+    + "\ua800\ua780\ua700\ua680\ua600\ua580\ua500\ua480\ua400\ua380\ua300"
+    + "\ua280\ua200\ua180\ua100\ua080\ua000\u9f80\u9f00\u9e80\u9e00\u9d80"
+    + "\u9d00\u9c80\u9c00\u9b80\u9b00\u9a80\u9a00\u9980\u9900\u9880\u9800"
+    + "\u9780\u9700\u9680\u9600\u9580\u9500\u9480\u9400\u9380\u9300\u9280"
+    + "\u9200\u9180\u9100\u9080\u9000\u8f80\u8f00\u8e80\u8e00\u8d80\u8d00"
+    + "\u8c80\u8c00\u8b80\u8b00\u8a80\u8a00\u8980\u8900\u8880\u8800\u8780"
+    + "\u8700\u8680\u8600\u8580\u8500\u8480\u8400\u8380\u8300\u8280\u8200"
+    + "\u8180\u8100\u8080\u8000\u7f80\u7f00\u7e80\u7e00\u7d80\u7d00\u7c80"
+    + "\u7c00\u7b80\u7b00\u7a80\u7a00\u7980\u7900\u7880\u7800\u7780\u7700"
+    + "\u7680\u7600\u7580\u7500\u7480\u7400\u7380\u7300\u7280\u7200\u7180"
+    + "\u7100\u7080\u7000\u6f80\u6f00\u6e80\u6e00\u6d80\u6d00\u6c80\u6c00"
+    + "\u6b80\u6b00\u6a80\u6a00\u6980\u6900\u6880\u6800\u6780\u6700\u6680"
+    + "\u6600\u6580\u6500\u6480\u6400\u6380\u6300\u6280\u6200\u6180\u6100"
+    + "\u6080\u6000\u5f80\u5f00\u5e80\u5e00\u5d80\u5d00\u5c80\u5c00\u5b80"
+    + "\u5b00\u5a80\u5a00\u59a9\u5980\u5900\u5880\u5800\u5780\u5700\u5680"
+    + "\u5600\u5580\u5500\u5480\u5400\u5380\u5300\u5280\u5200\u5180\u5100"
+    + "\u5080\u5000\u4f80\u4f00\u4e80\u4e00\u4d80\u4d00\u4c80\u4c00\u4b80"
+    + "\u4b00\u4a80\u4a00\u4980\u4900\u4880\u4800\u4780\u4700\u4680\u4600"
+    + "\u4580\u4500\u4480\u4400\u4380\u4300\u4280\u4200\u4180\u4100\u4080"
+    + "\u4000\u3f80\u3f00\u3e80\u3e00\u3d80\u3d00\u3c80\u3c00\u3b80\u3b00"
+    + "\u3a80\u3a00\u3980\u3900\u3880\u3800\u3780\u3700\u3680\u3600\u3580"
+    + "\u3500\u3480\u3400\u3380\u3300\u3280\u3200\u3180\u3100\u3080\u3000"
+    + "\u2f80\u2f00\u2e80\u2e00\u2d80\u2d00\u2c80\u2c00\u2b80\u2b00\u2a80"
+    + "\u2a00\u2980\u2900\u2880\u2800\u2780\u2700\u2680\u2600\u2580\u2500"
+    + "\u2480\u2400\u2380\u2300\u2280\u2200\u2180\u2100\u2080\u2000\u1f80"
+    + "\u1f00\u1e80\u1e00\u1d80\u1d00\u1c80\u1c00\u1b80\u1b00\u1a80\u1a00"
+    + "\u1980\u1900\u1880\u1800\u1780\u1700\u1680\u1600\u1580\u1500\u1480"
+    + "\u1400\u1380\u1300\u1280\u1200\u1180\u1100\u1080\u1000\u0f80\u0f00"
+    + "\u0e80\u0e00\u0d80\u0d00\u0c80\u0c00\u0b80\u0b00\u0a80\u0a00\u0980"
+    + "\u0900\u0800\u0780\u0700\u0680\u0662\u0600\u0580\u0500\u0480\u0400"
+    + "\u0380\u0300\u0280\u0200\u0180\u0100",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "\u00ff\000\uff00\ufe90\ufe80\ufe00\ufd80\ufd00\ufc80\ufc00\ufb80"
+    + "\ufb00\ufa80\ufa00\uf980\uf900\uf880\uf800\uf780\uf700\uf680\uf600"
+    + "\uf580\uf500\uf480\uf400\uf380\uf300\uf280\uf200\uf180\uf100\uf080"
+    + "\uf000\uef80\uef00\uee80\uee00\ued80\ued00\uec80\uec00\ueb80\ueb00"
+    + "\uea80\uea00\ue980\ue900\ue880\ue800\ue780\ue700\ue680\ue600\ue580"
+    + "\ue500\ue480\ue400\ue380\ue300\ue280\ue200\ue180\ue100\ue080\ue000"
+    + "\udf80\udf00\ude80\ude00\udd80\udd00\udc80\udc00\udb80\udb00\uda80"
+    + "\uda00\ud980\ud900\ud880\ud800\ud780\ud700\ud680\ud600\ud580\ud500"
+    + "\ud480\ud400\ud380\ud300\ud280\ud200\ud180\ud100\ud080\ud000\ucf80"
+    + "\ucf00\uce80\uce00\ucd80\ucd00\ucc80\ucc00\ucb80\ucb00\uca80\uca00"
+    + "\uc980\uc900\uc880\uc800\uc780\uc700\uc680\uc600\uc580\uc500\uc480"
+    + "\uc400\uc380\uc300\uc280\uc200\uc180\uc100\uc080\uc000\ubf80\ubf00"
+    + "\ube80\ube00\ubd80\ubd00\ubc80\ubc00\ubb80\ubb00\uba80\uba00\ub980"
+    + "\ub900\ub880\ub800\ub780\ub700\ub680\ub600\ub580\ub500\ub480\ub400"
+    + "\ub380\ub300\ub280\ub200\ub180\ub100\ub080\ub000\uaf80\uaf00\uae80"
+    + "\uae00\uad80\uad00\uac80\uac00\uab80\uab00\uaa80\uaa00\ua980\ua900"
+    + "\ua880\ua800\ua780\ua700\ua680\ua600\ua580\ua500\ua480\ua400\ua380"
+    + "\ua300\ua280\ua200\ua180\ua100\ua080\ua000\u9f80\u9f00\u9e80\u9e00"
+    + "\u9d80\u9d00\u9c80\u9c00\u9b80\u9b00\u9a80\u9a00\u9980\u9900\u9880"
+    + "\u9800\u9780\u9700\u9680\u9600\u9580\u9500\u9480\u9400\u9380\u9300"
+    + "\u9280\u9200\u9180\u9100\u9080\u9000\u8f80\u8f00\u8e80\u8e00\u8d80"
+    + "\u8d00\u8c80\u8c00\u8b80\u8b00\u8a80\u8a00\u8980\u8900\u8880\u8800"
+    + "\u8780\u8700\u8680\u8600\u8580\u8500\u8480\u8400\u8380\u8300\u8280"
+    + "\u8200\u8180\u8100\u8080\u8000\u7f80\u7f00\u7e80\u7e00\u7d80\u7d00"
+    + "\u7c80\u7c00\u7b80\u7b00\u7a80\u7a00\u7980\u7900\u7880\u7800\u7780"
+    + "\u7700\u7680\u7600\u7580\u7500\u7480\u7400\u7380\u7300\u7280\u7200"
+    + "\u7180\u7100\u7080\u7000\u6f80\u6f00\u6e80\u6e00\u6d80\u6d00\u6c80"
+    + "\u6c00\u6b80\u6b00\u6a80\u6a00\u6980\u6900\u6880\u6800\u6780\u6700"
+    + "\u6680\u6600\u6580\u6500\u6480\u6400\u6380\u6300\u6280\u6200\u6180"
+    + "\u6100\u6080\u6000\u5f80\u5f00\u5e80\u5e00\u5d80\u5d00\u5c80\u5c00"
+    + "\u5b80\u5b00\u5a80\u5a00\u5980\u5900\u5880\u5800\u5780\u5700\u5680"
+    + "\u5600\u5580\u5500\u5480\u5400\u5380\u5300\u5280\u5200\u5180\u5100"
+    + "\u5080\u5000\u4f80\u4f00\u4e80\u4e00\u4d80\u4d00\u4c80\u4c00\u4b80"
+    + "\u4b00\u4a80\u4a00\u4980\u4900\u4880\u4800\u4780\u4700\u4680\u4600"
+    + "\u4580\u4500\u4480\u4400\u4380\u4300\u4280\u4200\u4180\u4100\u4080"
+    + "\u4000\u3f80\u3f00\u3e80\u3e00\u3d80\u3d00\u3c80\u3c00\u3b80\u3b00"
+    + "\u3a80\u3a00\u3980\u3900\u3880\u3800\u3780\u3700\u3680\u3600\u3580"
+    + "\u3500\u3480\u3400\u3380\u3300\u3280\u3200\u3180\u3100\u3080\u3000"
+    + "\u2f80\u2f00\u2e80\u2e00\u2d80\u2d00\u2c80\u2c00\u2b80\u2b00\u2a80"
+    + "\u2a00\u2980\u2900\u2880\u2800\u2780\u2700\u2680\u2600\u2580\u2500"
+    + "\u2480\u2400\u2380\u2300\u2280\u2200\u2180\u2100\u2080\u2000\u1f80"
+    + "\u1f00\u1e80\u1e00\u1d80\u1d00\u1c80\u1c00\u1b80\u1b00\u1a80\u1a00"
+    + "\u1980\u1900\u1880\u1800\u1780\u1700\u1680\u1600\u1580\u1500\u1480"
+    + "\u1400\u1380\u1300\u1280\u1200\u1180\u1100\u1080\u1000\u0f80\u0f00"
+    + "\u0e80\u0e00\u0d80\u0d00\u0c80\u0c00\u0b80\u0b00\u0a80\u0a00\u0980"
+    + "\u0900\u0880\u0800\u0780\u0700\u0680\u0600\u0580\u0500\u0480\u0400"
+    + "\u0380\u0300\u0280\u0200\u0180\u0100",
+
+    "",
+
+    ""};
+
+  /**
+   * The array containing the numeric values that are too large to be stored as
+   * chars in NUM_VALUE.  NUM_VALUE in this case will contain a negative integer
+   * N such that LARGENUMS[-N - 3] contains the correct numeric value.
+   */
+  int[] LARGENUMS
+    = new int[] {40000, 50000, 60000, 70000, 80000, 90000};
+
+  /**
+   * Information about each character.  The low order 5 bits form the
+   * character type, the next bit is a flag for non-breaking spaces, and the
+   * next bit is a flag for mirrored directionality.  The high order 9 bits
+   * form the offset into the attribute tables.  Note that this limits the
+   * number of unique character attributes to 512, which is not a problem
+   * as of Unicode version 4.0.0, but may soon become one.
+   */
+   String[] DATA = new String[]{
+    "\u2282\u2302\u2382\u2402\u2482\u2502\u2582\u2602\u2682\u2702\u2782"
+    + "\u0455\u0c99\u04d6\u0c99\017\017\017\017\017\017\017"
+    + "\017\017\u008f\u010f\u008f\u018f\u010f\017\017\017\017"
+    + "\017\u010f\017\017\017\017\017\017\017\017\017"
+    + "\017\017\017\017\017\017\017\u010f\u010f\u010f\u008f"
+    + "\u0709\u0789\u0809\u0889\u0909\u0989\u0a09\u0a89\u0b09\u0b89\u0598"
+    + "\u0298\u0c59\u0c99\u0c59\u0298\u0298\u0c99\u0298\u1a97\u3f80\u3f80"
+    + "\u0298\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u020c\u0298\u0298"
+    + "\u0318\u039a\u0318\u0298\u0298\u0455\u04d6\u0298\u0519\u0598\u0614"
+    + "\u0598\u0698\u2a9c\u0519\u2b0b\u2b8b\u1a1b\u2c02\u289c\u0298\u1a1b"
+    + "\u2c8b\u2902\u2d5e\u2d8b\u2d8b\u2d8b\u0298\u0d01\u0d81\u0e01\u0e81"
+    + "\u0f01\u0f81\u1001\u1081\u1101\u1181\u1201\u1281\u1301\u1381\u1401"
+    + "\u1481\u1501\u1581\u1601\u1681\u1701\u1781\u1801\u1881\u1901\u1981"
+    + "\u0455\u0298\u04d6\u1a1b\u1a97\u0298\u0298\u0298\u0c99\u0455\u04d6"
+    + "\u0298\u0298\u0298\u0298\u0298\u0298\u0298\u0298\u0298\u858d\u860e"
+    + "\u8690\u8710\u8790\u8810\u8890\u82ac\u282c\u0298\u039a\u039a\u039a"
+    + "\u039a\u289c\u289c\u1a1b\u289c\u2902\u29dd\u0c99\u2a10\u289c\u1a1b"
+    + "\u1b02\u1b82\u1c02\u1c82\u1d02\u1d82\u1e02\u1e82\u1f02\u1f82\u2002"
+    + "\u2082\u2102\u2182\u2202\u4a82\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01"
+    + "\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u0c99"
+    + "\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e82\u3c01\u3c83\u3d02"
+    + "\u3001\u3082\u3e01\u3e81\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
+    + "\u3082\u3201\u3001\u3082\u3001\u3082\u3001\u3082\u3282\u4a82\u2f02"
+    + "\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02"
+    + "\u2f02\u2f02\u2f02\u2f02\u0c99\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02"
+    + "\u2f02\u2f82\u3f01\u2902\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
+    + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3d82\u3001"
+    + "\u3082\u539c\u4786\u4786\u4786\u4786\u3f80\u5407\u5407\u3001\u3082"
+    + "\u3001\u3082\u3001\u3082\u3f80\u3f80\u3001\u3082\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u4786\u6008\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05"
+    + "\u3f80\u3b05\u3f80\u3f80\u3b05\u3b05\u3f80\u3b05\u3f80\u3f80\u3b05"
+    + "\u3f80\u3f80\u2e82\u7e02\u2e82\u3f80\u2e82\u4a82\u8181\u8181\u8201"
+    + "\u8201\u7f03\u1a1b\u1a1b\u3f80\u4786\u4786\u6008\u3f80\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3b05\u3f80\u3b05"
+    + "\u3b05\u3b05\u3b05\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3f80\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80"
+    + "\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u5518\u5518\u3b05\u3b05\u3b05\u3b05\u3c01\u3c83"
+    + "\u3d02\u3c01\u3c83\u3d02\u3c01\u3c83\u3d02\u3001\u3082\u3001\u3082"
+    + "\u2902\u2902\u2902\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3b05\u3b05\u3b05\u3b05\u3f80\u3b05\u3f80\u3b05\u3b05\u3f80"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u4786\u3b05\u6008\u6008"
+    + "\u4786\u4786\u4786\u3f80\u3f80\u3f80\u6008\u6008\u3f80\u3f80\u6008"
+    + "\u6008\u4786\u3f80\u3f80\u3101\u3182\u3001\u3082\u3001\u3082\u3001"
+    + "\u3082\u2902\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u2e82"
+    + "\u2e82\u2e82\u2e82\u2e82\u7882\u3f80\u3f80\u3f80\u3f80\u1a1b\u1a1b"
+    + "\u3f80\u3f80\u3f80\u3f80\u4684\u3f80\u3f80\u3f80\u0298\u3f80\u5481"
+    + "\u5481\u5481\u5481\u5481\u5481\u5481\u5481\u5481\u5481\u5481\u5481"
+    + "\u5481\u5481\u5481\u5481\u3f80\u3f80\u4684\u5518\u5518\u5518\u5518"
+    + "\u5518\u5518\u539c\u539c\u539c\u539c\u539c\u4786\u4786\u539c\u539c"
+    + "\u539c\u539c\u539c\u539c\u4786\u539c\u539c\u539c\u539c\u539c\u539c"
+    + "\u3f80\u3f80\u539c\u3b05\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u4d82\u4e02\u4e81"
+    + "\u4e81\u4e81\u4f02\u4f82\u2902\u3001\u3082\u3001\u3082\u3001\u3082"
+    + "\u3001\u3082\u3001\u3082\u2e82\u3001\u3082\u3001\u3082\u3001\u3082"
+    + "\u3981\u3001\u3082\u3981\u2902\u2902\u3001\u3082\u3981\u3001\u4502"
+    + "\u2902\u2902\u4502\u2902\u2902\u2902\u2902\u4502\u2902\u4582\u4582"
+    + "\u2902\u2902\u2902\u2902\u4402\u2902\u2902\u4482\u2902\u2902\u2902"
+    + "\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u4002\u4082\u2902\u4102"
+    + "\u4102\u2902\u4182\u2902\u4202\u2902\u2902\u2902\u2902\u3301\u3001"
+    + "\u3082\u3001\u3082\u3381\u3001\u3082\u3401\u3401\u3001\u3082\u2902"
+    + "\u3481\u3501\u3581\u3001\u3082\u3401\u3601\u3682\u3701\u3781\u3001"
+    + "\u3082\u2902\u2902\u3701\u3801\u3882\u3901\u3082\u3a01\u3a01\u3001"
+    + "\u3082\u3001\u3082\u3a81\u3001\u3082\u2902\u3b05\u3001\u3082\u2902"
+    + "\u3b82\u4786\u4786\u4786\u4786\u4786\u4806\u4786\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u3f80\u4786\u4786\u4786\u5698"
+    + "\u4786\u4786\u5698\u4786\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u6008\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05"
+    + "\u3f80\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80\u3b05\u3b05\u3f80"
+    + "\u3b05\u3f80\u3b05\u3b05\u3f80\u3b05\u3b05\u3f80\u3b05\u3b05\u3f80"
+    + "\u3f80\u4786\u3f80\u6008\u6008\u6008\u3f80\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3f80\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80"
+    + "\u3f80\u6008\u6008\u5518\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u5f90\u5f90"
+    + "\u5f90\u289c\u289c\u3f80\u3f80\u3f80\u0298\u0298\u6089\u6109\u6189"
+    + "\u6209\u6289\u6309\u6389\u6409\u6489\u6509\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u4786\u3b05\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3f80\u3f80\u3f80\u3b05\u3b05\u3f80\u3f80\u3f80\u3b05\u3b05\u3b05"
+    + "\u3f80\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80"
+    + "\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80\u5582\u5582\u5582\u5582\u5582"
+    + "\u5582\u5582\u5582\u5582\u5582\u5582\u5582\u5582\u5582\u5582\u5582"
+    + "\u2e82\u3f80\u5518\u5614\u3f80\u3f80\u3f80\u3f80\u3f80\u4786\u4786"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u5885\u5885"
+    + "\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885"
+    + "\u5885\u5885\u5885\u6b95\u6c16\u4102\u2902\u2902\u4282\u2902\u2902"
+    + "\u2902\u2902\u4302\u4382\u2902\u2902\u2902\u2902\u2902\u4382\u5790"
+    + "\u5790\u5790\u5790\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u0598\u5818\u289c\u289c\u4e81\u289c\u289c\u289c\u289c\u4e81\u289c"
+    + "\u289c\u2902\u4e81\u4e81\u4e81\u2902\u2902\u4602\u2902\u2902\u2902"
+    + "\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u2902"
+    + "\u2902\u2902\u4684\u4684\u4684\u4684\u4684\u4684\u4684\u4684\u4684"
+    + "\u4684\u4684\u4684\u4684\u4684\u4684\u4684\u4704\u4704\u4684\u4684"
+    + "\u4684\u4684\u4684\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b"
+    + "\u1a1b\u4684\u1a1b\u5614\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u4684\u4684\u1a1b\u1a1b\u1a1b\u1a1b\u4704\u4704"
+    + "\u4704\u4704\u4704\u4704\u4704\u4704\u4704\u4704\u4684\u4684\u1a1b"
+    + "\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b"
+    + "\u1a1b\u1a1b\u1a1b\u1a1b\u2e82\u7e02\u2e82\u3f80\u2e82\u4a82\u8001"
+    + "\u8001\u8001\u8001\u7f03\u1a1b\u1a1b\u1a1b\u289c\uac8a\uad0a\uad8a"
+    + "\uae0a\uae8a\uaf0a\uaf8a\ub00a\ub08a\u4786\u4786\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u3f80\u4786\u4786\u4786\u4786\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u3f80\u539c"
+    + "\u539c\u658b\u660b\u668b\u670b\u539c\u539c\u539c\u539c\u539c\u539c"
+    + "\u539c\u539c\u539c\u539c\u539c\u289c\u0c99\u289c\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u3f80\u289c\u3f80"
+    + "\u289c\u289c\u289c\u289c\u3f80\u289c\u289c\u289c\u289c\u3f80\u3f80"
+    + "\u289c\u289c\u289c\u289c\u289c\u539c\u289c\u289c\u289c\u289c\u289c"
+    + "\u0c99\u0c99\u0c99\u0c99\u0c99\u6b95\u6c16\u0298\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u3f80\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u289c\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0455"
+    + "\u04d6\u738b\u740b\u748b\u750b\u758b\u760b\u768b\u770b\u778b\uab8b"
+    + "\u738b\u740b\u748b\u750b\u758b\u760b\u4786\u4786\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u3f80\u3f80\u3f80\u3f80\u3f80\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786"
+    + "\u6008\u6008\u3f80\u3f80\u3f80\u6008\u6008\u6008\u3f80\u6008\u6008"
+    + "\u6008\u4786\u3f80\u3f80\u4786\u6008\u6008\u3f80\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u3b05\u3b05\u3b05\u3f80"
+    + "\u3b05\u3f80\u3b05\u3f80\u3f80\u3b05\u3b05\u3f80\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3f80\u3b05\u3b05\u3f80\u6008\u4786\u4786\u4786\u4786"
+    + "\u3f80\u3f80\u6008\u6008\u3f80\u3f80\u6008\u6008\u4786\u3f80\u3f80"
+    + "\u5002\u5082\u5102\u2902\u5181\u5202\u0c99\u3001\u3082\u5281\u3001"
+    + "\u3082\u3f80\u3f80\u3f80\u3f80\u1a1b\u1a1b\u4881\u0298\u4901\u4901"
+    + "\u4901\u3f80\u4981\u3f80\u4a01\u4a01\u2e01\u2e01\u3f80\u2e01\u2e01"
+    + "\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u4b02\u4b82\u4b82\u4b82"
+    + "\u2f02\u2f02\u4c02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02"
+    + "\u2f02\u4c82\u4d02\u4d02\u3f80\u4786\u4786\u6008\u3f80\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05\u3b05"
+    + "\u3b05\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3f80\u3b05\u3f80\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80"
+    + "\u4786\u3b05\u6008\u6008\u4786\u6008\u6008\u6008\u6008\u6008\u6008"
+    + "\u4786\u4786\u4786\u3f80\u3f80\u3f80\u3f80\u5301\u5301\u5301\u5301"
+    + "\u5301\u5301\u5301\u5301\u5301\u5301\u5301\u5301\u5301\u5301\u5301"
+    + "\u5301\u5082\u5082\u5082\u5082\u5082\u5082\u5082\u5082\u5082\u5082"
+    + "\u5082\u5082\u5082\u5082\u5082\u5082\u4e81\u3001\u3082\u3001\u3082"
+    + "\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u6089\u6109\u6189\u6209\u6289\u6309"
+    + "\u6389\u6409\u6489\u6509\u6b0b\u6b0b\u6b0b\u6b0b\u6b0b\u6b0b\u539c"
+    + "\u4786\u539c\u4786\u539c\u4786\u6b95\u6c16\u6b95\u6c16\u6008\u6008"
+    + "\u4786\u4786\u4786\u3f80\u4786\u3f80\u6008\u6008\u6008\u6008\u6008"
+    + "\u6008\u6008\u6008\u4786\u6008\u6008\u4786\u4786\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u6008\u6008\u6008\u6008\u4786\u3f80\u3f80\u5518"
+    + "\u5518\u5518\u5518\u5518\u5518\u5518\u5518\u6109\u6189\u6209\u6289"
+    + "\u6309\u6389\u6409\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786"
+    + "\u4786\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u2e82\u2e82\u2e82\u2e82\u2e82\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u5705\u4786\u5705\u5705\u3f80\u5705\u5705\u3f80\u5705\u5705"
+    + "\u5705\u5705\u5705\u5705\u5705\u5705\u5705\u5705\u5705\u5705\u5705"
+    + "\u5705\u5705\u5705\u3f80\u3f80\u3f80\u3f80\u3f80\u6008\u6008\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3b05\u3f80\u3b05\u3b05\u3f80"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u4786\u3b05\u6008\u4786"
+    + "\u4786\u4786\u4786\u4786\u3f80\u4786\u4786\u6008\u3f80\u6008\u6008"
+    + "\u4786\u3f80\u3f80\u0298\u0298\u0318\u039a\u0318\u0298\u0298\u0455"
+    + "\u04d6\u0298\u0519\u0598\u0614\u0598\u0698\u5705\u5705\u5705\u5698"
+    + "\u5698\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u6008\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u2d8b"
+    + "\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b"
+    + "\u738b\u5989\u5a09\u5a89\u5b09\u5b89\u5c09\u5c89\u5d09\u5d89\u5e09"
+    + "\u0318\u5e98\u5e98\u5818\u5885\u5885\u5885\u5885\u5818\u5885\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u5790\u5407\u4786\u5407\u5407"
+    + "\u5407\u4786\u4786\u4786\u4786\u4786\u4786\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u5818\u3f80\u3f80\u3f80\u5818\u5818\u5818\u5818\u5818\u5818"
+    + "\u5818\u5818\u5818\u5818\u5818\u5818\u5818\u5818\u3f80\u5f90\u5904"
+    + "\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u3f80"
+    + "\u3f80\u5885\u5885\u5885\u5885\u5885\u3f80\u5885\u5885\u5885\u5885"
+    + "\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u6109"
+    + "\u6189\u6209\u6289\u6309\u6389\u6409\u6489\u6509\u688b\u6c8b\u6d0b"
+    + "\u6d8b\u6e0b\u6e8b\u6f0b\u6f8b\u700b\u690b\u708b\u3f80\u3f80\u3f80"
+    + "\u0709\u0789\u0809\u0889\u0909\u0989\u0a09\u0a89\u0b09\u0b89\u5885"
+    + "\u5885\u5885\u5f1c\u5f1c\u5885\u4786\u5885\u5885\u5885\u5885\u5885"
+    + "\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u3f80"
+    + "\u3f80\u5f90\u5f90\u5f90\u5f90\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u5f90\u5f90\u5f90\u5f90\u5f90\u5f90\u4786\u4786\u4786\u4786\u4786"
+    + "\u5904\u5904\u4786\u4786\u289c\u4786\u4786\u4786\u4786\u5885\u5885"
+    + "\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\u5885\uc51a"
+    + "\u289c\u3f80\u3f80\u4786\u5885\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u04d6\u0298\u0455"
+    + "\u04d6\u0298\u1a97\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3f80\u3f80\u3f80\u3f80\u6008\u6008\u3f80\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3f80\u3f80\u3f80\u3f80\u4786\u4786\u6008\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u6b95\u6c16"
+    + "\u3f80\u3f80\u3f80\u020c\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u1a97\u4684\u4684\u4684\u3b05\u3b05\u3b05\u4684\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3f80\u3f80\u4786\u3b05\u6008\u6008\u6008\u6008"
+    + "\u6008\u3f80\u6a06\u6008\u6008\u3f80\u6008\u6008\u4786\u4786\u3f80"
+    + "\u3f80\u3f80\u3f80\u4786\u4786\u3f80\u3f80\u4786\u4786\u4786\u3f80"
+    + "\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u4786"
+    + "\u4786\u1a1b\u1a1b\u4684\u4684\u3b05\u4786\u4786\u4786\u4786\u3f80"
+    + "\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3f80\u3f80\u5518\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05\u4786\u4786"
+    + "\u5518\u5518\u6089\u6109\u6189\u6209\u6289\u6309\u6389\u6409\u6489"
+    + "\u6509\u5518\u5518\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05\u4786\u4786"
+    + "\u3f80\u3f80\u6089\u6109\u6189\u6209\u6289\u6309\u6389\u6409\u6489"
+    + "\u6509\u3f80\u3f80\u3b05\u3b05\u3f80\u3f80\u3b05\u3b05\u039a\u039a"
+    + "\u658b\u660b\u668b\u670b\u678b\u680b\u539c\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u4786\u4786\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3b05\u4786\u3b05\u3b05\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u3f80\u3f80\u3f80\u3f80\u039a"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u4684\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u5518\u4786\u4786\u3b05"
+    + "\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80\u3f80\u6089\u6109\u6189\u6209"
+    + "\u6289\u6309\u6389\u6409\u6489\u6509\u5518\u5518\u5518\u5518\u5518"
+    + "\u5518\u688b\u690b\u698b\u289c\u289c\u289c\u289c\u289c\u289c\u039a"
+    + "\u289c\u3f80\u3f80\u3f80\u3f80\u3f80\u4786\u6008\u6008\u6008\u6008"
+    + "\u3f80\u4786\u4786\u4786\u3f80\u4786\u4786\u4786\u4786\u3f80\u3f80"
+    + "\u3b05\u3b05\u3b05\u3b05\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80"
+    + "\u3f80\u4786\u3b05\u6008\u6a06\u6008\u4786\u4786\u4786\u3f80\u3f80"
+    + "\u6008\u6008\u6008\u3f80\u6008\u6008\u6008\u4786\u3f80\u3f80\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80\u3f80\u4786\u3f80"
+    + "\u3f80\u3f80\u3f80\u6008\u6008\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u5518\u5518\u5518\u710a\u718a"
+    + "\u3b05\u4786\u3b05\u3b05\u4786\u4786\u4786\u4786\u4786\u4786\u3f80"
+    + "\u4786\u4786\u3b05\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80"
+    + "\u4684\u3f80\u4786\u4786\u4786\u4786\u4786\u4786\u3f80\u3f80\u3b05"
+    + "\u539c\u539c\u539c\u5518\u5518\u5518\u5518\u5518\u5518\u5518\u5518"
+    + "\u6ab8\u5518\u5518\u5518\u4786\u6008\u4786\u3f80\u3f80\u3f80\u4786"
+    + "\u4786\u6008\u4786\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u6008\u6008\u4786\u4786\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u4e81\u4e81\u289c\u4e81\u2902\u3b05\u3b05\u3b05"
+    + "\u3b05\u2902\u289c\u289c\u3f80\u2902\u4e81\u4e81\u4e81\u4e81\u4e81"
+    + "\u4e81\u4e81\u4e81\u4e81\u4e81\u4e81\u4e81\u4e81\u4e81\u4e81\u4e81"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3b05"
+    + "\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u720a"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05\u4786\u4786\u4786\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3b05\u3b05"
+    + "\u4786\u4786\u4786\u5518\u5518\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3b05\u3b05\u4786\u4786\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3b05\u3f80\u4786"
+    + "\u4786\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3b05\u3b05\u3b05\u3b05\u7290\u7290\u6008\u4786\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u6008\u6008\u6008\u6008\u4786\u4786"
+    + "\u7808\u7808\u7808\u3f80\u3f80\u3f80\u3f80\u4786\u4786\u4786\u4786"
+    + "\u5518\u5518\u5518\u4684\u5518\u5518\u5518\u039a\u3b05\u4786\u3f80"
+    + "\u3f80\ua90b\ua98b\uaa0b\uaa8b\uab0b\u738b\u740b\u748b\u750b\u758b"
+    + "\u760b\u768b\u770b\u778b\uab8b\u730b\u738b\u740b\u748b\u750b\u758b"
+    + "\u760b\u768b\u770b\u778b\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u0298"
+    + "\u0298\u0298\u0298\u0298\u0298\u5614\u0298\u0298\u0298\u0298\u4786"
+    + "\u4786\u4786\u020c\u3f80\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05\u3b05"
+    + "\u3b05\u3b05\u4786\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u4e81\u4e81"
+    + "\u4e81\u2902\u289c\u4e81\u289c\u289c\u289c\u4e81\u4e81\u4e81\u4e81"
+    + "\u4e81\u289c\u289c\u0c99\u289c\u0c99\u289c\u289c\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
+    + "\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99"
+    + "\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c99\u0c99\u0455\u04d6\u0c99\u0c99\u0c99\u0455\u04d6\u0455\u04d6"
+    + "\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0c99"
+    + "\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99"
+    + "\u0c59\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99"
+    + "\u0c99\u0c99\u0c99\u0c59\u0c99\u0c59\u0c99\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c59\u0c59\u0c99\u0c59\u0c99\u0c59\u0c59\u0c59\u0c99\u0c99"
+    + "\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c99\u0c99"
+    + "\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c59\u0c99\u0c99\u0c59"
+    + "\u0c59\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c99"
+    + "\u0c59\u0c99\u0c99\u0c59\u0c99\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99"
+    + "\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c59"
+    + "\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99"
+    + "\u0c99\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c99"
+    + "\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c99\u0c99\u0c99"
+    + "\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99"
+    + "\u0c99\u0c99\u289c\u289c\u289c\u289c\u289c\u0c99\u0c99\u289c\u289c"
+    + "\u289c\u289c\u4e81\u289c\u8c81\u289c\u4e81\u289c\u8d01\u8d81\u4e81"
+    + "\u4e81\u2a9c\u2902\u4684\u4684\u2902\u2902\u2902\u2902\u2902\u2902"
+    + "\u2902\u2902\u2902\u2902\u3f80\u3f80\u3f80\u3f80\u7902\u7902\u7902"
+    + "\u7902\u7902\u7902\u7902\u7902\u7981\u7981\u7981\u7981\u7981\u7981"
+    + "\u7981\u7981\u7902\u7902\u7902\u7902\u7902\u7902\u3f80\u3f80\u7981"
+    + "\u7981\u7981\u7981\u7981\u7981\u3f80\u3f80\u2e82\u7902\u4a82\u7902"
+    + "\u4a82\u7902\u4a82\u7902\u3f80\u7981\u3f80\u7981\u3f80\u7981\u3f80"
+    + "\u7981\u7a02\u7a02\u7a82\u7a82\u7a82\u7a82\u7b02\u7b02\u7b82\u7b82"
+    + "\u7c02\u7c02\u7c82\u7c82\u3f80\u3f80\u7d02\u7d02\u7d02\u7d02\u7d02"
+    + "\u7d02\u7d02\u7d02\u7d83\u7d83\u7d83\u7d83\u7d83\u7d83\u7d83\u7d83"
+    + "\u7902\u7902\u2e82\u7e02\u2e82\u3f80\u2e82\u4a82\u7981\u7981\u7e81"
+    + "\u7e81\u7f03\u1a1b\u7f82\u1a1b\u7902\u7902\u4a82\u4a82\u3f80\u3f80"
+    + "\u2e82\u4a82\u7981\u7981\u8081\u8081\u3f80\u1a1b\u1a1b\u1a1b\u7902"
+    + "\u7902\u4a82\u4a82\u2e82\u5102\u2e82\u4a82\u7981\u7981\u8101\u8101"
+    + "\u5281\u1a1b\u1a1b\u1a1b\u020c\u020c\u020c\u020c\u020c\u020c\u020c"
+    + "\u82ac\u020c\u020c\u020c\u830c\u5f90\u5f90\u7290\u8390\u5614\u8434"
+    + "\u5614\u5614\u5614\u5614\u0298\u0298\u849d\u851e\u6b95\u849d\u849d"
+    + "\u851e\u6b95\u849d\u0598\u0298\u0598\u3f80\u0298\u0598\u0298\u0298"
+    + "\u5614\u6b95\u6c16\u6b95\u6c16\u6b95\u6c16\u0318\u0318\u0318\u0318"
+    + "\u0318\u0298\u0298\u0298\u0298\u29dd\u2d5e\u0298\u0298\u0298\u0298"
+    + "\u1a97\u890b\u2902\u3f80\u3f80\u898b\u8a0b\u8a8b\u8b0b\u8b8b\u8c0b"
+    + "\u0519\u0519\u0c99\u0455\u04d6\u2902\u890b\u2c8b\u2b0b\u2b8b\u898b"
+    + "\u8a0b\u8a8b\u8b0b\u8b8b\u8c0b\u0519\u0519\u0c99\u0455\u04d6\u3f80"
+    + "\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a"
+    + "\u039a\u039a\u039a\u039a\u039a\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u4786\u4786\u4786"
+    + "\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u4786\u5407"
+    + "\u5407\u5407\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99"
+    + "\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59"
+    + "\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59"
+    + "\u0c59\u0c99\u0c99\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c99\u0c99\u0c99"
+    + "\u0c99\u0c59\u0c59\u0c59\u0c59\u0c99\u0c59\u0519\u0519\u0c99\u0c59"
+    + "\u0c59\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c99\u0c59\u0c99"
+    + "\u0c59\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
+    + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c59\u0c59\u0c99"
+    + "\u0c99\u0455\u04d6\u0455\u04d6\u0c59\u0c99\u0c99\u0c99\u0c99\u4e81"
+    + "\u2902\u2902\u2902\u2902\u289c\u0c99\u3f80\u3f80\u3f80\u3f80\u8e0a"
+    + "\u8e8a\u8f0a\u8f8a\u900a\u908a\u910a\u918a\u920a\u928a\u930a\u938a"
+    + "\u940a\u948a\u950a\u958a\u960a\u968a\u970a\u978a\u980a\u988a\u990a"
+    + "\u998a\u9a0a\u9a8a\u9b0a\u9b8a\u9c0a\u9c8a\u9d0a\u9d8a\u9e0a\u9e8a"
+    + "\u9f0a\u9f8a\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u0c99\u289c\u289c\u0c99\u289c\u289c\u0c99\u289c"
+    + "\u289c\u289c\u289c\u289c\u289c\u289c\u0c99\u289c\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u289c\u0c59\u0c59\u0c59\u0c59\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u289c\u0455\u04d6\u289c\u289c\u289c\u289c\u289c"
+    + "\u289c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c"
+    + "\u539c\u539c\u539c\u539c\u539c\u539c\u289c\u289c\u3f80\u539c\ubc8b"
+    + "\ubd0b\ubd8b\ube0b\ube8b\ubf0b\ubf8b\uc00b\uc08b\uc10b\uc18b\uc20b"
+    + "\uc28b\uc30b\uc38b\u768b\u770b\u778b\uab8b\u289c\u3f80\u3f80\u3f80"
+    + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
+    + "\u289c\u289c\u289c\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\ua18b\ua20b\ua28b\ua30b"
+    + "\ua38b\ua40b\ua48b\ua50b\u2c8b\u2b0b\u2b8b\u898b\u8a0b\u8a8b\u8b0b"
+    + "\u8b8b\u8c0b\ua00b\ua08b\ua10b\ua18b\ua20b\ua28b\ua30b\ua38b\ua40b"
+    + "\ua48b\ua50b\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c"
+    + "\u539c\u539c\u539c\u289c\u289c\u289c\u289c\u539c\u539c\u539c\u539c"
+    + "\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c\u539c"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80"
+    + "\u3f80\u658b\u660b\u668b\u670b\ub28b\ub30b\ub38b\ub40b\ub48b\u688b"
+    + "\u539c\u539c\u539c\u539c\u539c\u539c\ua59c\ua59c\ua59c\ua59c\ua59c"
+    + "\ua59c\ua59c\ua59c\ua59c\ua59c\ua59c\ua59c\ua59c\ua59c\ua59c\ua59c"
+    + "\ua61c\ua61c\ua61c\ua61c\ua61c\ua61c\ua61c\ua61c\ua61c\ua61c\ua61c"
+    + "\ua61c\ua61c\ua61c\ua61c\ua61c\u890b\ua68b\ua70b\ua78b\ua80b\ua88b"
+    + "\u5614\u4684\u4684\u4684\u4684\u4684\u289c\u289c\ub10a\ub18a\ub20a"
+    + "\u4684\u3b05\u0298\u289c\u289c\u289c\u3f80\u3f80\u3f80\u289c\u3f80"
+    + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u3f80\u0c99\u0c99\u0c59"
+    + "\u0c59\u0c59\u0c59\u0455\u04d6\u0455\u04d6\u0455\u04d6\u3f80\u3f80"
+    + "\u3f80\u3f80\u020c\u0298\u0298\u0298\u289c\u4684\u3b05\uac0a\u0455"
+    + "\u04d6\u0455\u04d6\u0455\u04d6\u0455\u04d6\u289c\u289c\u0455\u04d6"
+    + "\u0455\u04d6\u0455\u04d6\u0455\u04d6\u5614\u6b95\u6c16\u6c16\u289c"
+    + "\ub50b\ub58b\ub60b\ub68b\ub70b\ub78b\ub80b\ub88b\ub90b\ub98b\uba0b"
+    + "\uba8b\ubb0b\ubb8b\ubc0b\uc413\uc413\uc413\uc413\uc413\uc413\uc413"
+    + "\uc413\uc413\uc413\uc413\uc413\uc413\uc413\uc413\uc413\uc492\uc492"
+    + "\uc492\uc492\uc492\uc492\uc492\uc492\uc492\uc492\uc492\uc492\uc492"
+    + "\uc492\uc492\uc492\u2e82\u2e82\u2e82\u4a82\u4a82\u2e82\u2e82\u3f80"
+    + "\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u3f80\u5705\u5705\u5705"
+    + "\u5705\u5705\u5705\u5705\u5705\u5705\u0519\u5705\u5705\u5705\u5705"
+    + "\u5705\u5705\u5705\u3f80\u5705\u5705\u5705\u5705\u5705\u3f80\u5705"
+    + "\u3f80\u0298\u5614\u5614\u1a97\u1a97\u6b95\u6c16\u6b95\u6c16\u6b95"
+    + "\u6c16\u6b95\u6c16\u6b95\u6c16\u6b95\u6c16\u0298\u0298\u6b95\u6c16"
+    + "\u0298\u0298\u0298\u0298\u1a97\u1a97\u1a97\u0298\u0298\u0519\u0614"
+    + "\u0c99\u0c99\u0c99\u3f80\u0298\u039a\u0318\u0298\u3f80\u3f80\u3f80"
+    + "\u3f80\u2282\u2302\u2382\u2402\u2482\u2502\u2582\u2602\u2682\u2702"
+    + "\u2782\u0455\u0c99\u04d6\u0c99\u0455\u039a\u039a\u0c99\u1a1b\u289c"
+    + "\u039a\u039a\u3f80\u289c\u0c99\u0c99\u0c99\u0c99\u289c\u289c\u3f80",
+
+    "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\u0080\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\u0080\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\u0080\005\005\u0080\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\u0080\u0080\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u1981\u1981\u1981\u1981\u1981"
+    + "\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981"
+    + "\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981"
+    + "\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981\u1981"
+    + "\u1981\u1981\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02"
+    + "\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02\u1a02"
+    + "\u1a02\u1a02\u1a02\u1a02\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\u0080\u0080\u0080\u0080\u0080\u0118\u0198\u021c\u0080"
+    + "\u0080\u0080\u0080\u028b\u030b\u038b\u040b\u048b\u050b\u058b\u060b"
+    + "\u068b\u070b\u078b\u080b\u088b\u090b\u098b\u0a0b\u0a8b\u0b0b\u0b8b"
+    + "\u0c0b\u0c8b\u0d0b\u0d8b\u0e0b\u0e8b\u0f0b\u0f8b\u100b\u108b\u110b"
+    + "\u118b\u120b\u128b\u130b\u138b\u140b\u148b\u150b\u158b\u160b\u168b"
+    + "\u170b\u178b\u180b\u188b\u0080\u0080\u0080\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u2008\u2008\u2086\u2086\u2086\u021c\u021c\u021c\u2008\u2008\u2008"
+    + "\u2008\u2008\u2008\u2110\u2110\u2110\u2110\u2110\u2110\u2110\u2110"
+    + "\u2086\u2086\u2086\u2086\u2086\u021c\u021c\u2086\u2086\u2086\u2086"
+    + "\u2086\u2086\u2086\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u2086\u2086\u2086\u2086\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u0080"
+    + "\u0080\u0080\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c\u021c"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\005\005\005\005\005\005\005\005\005\005"
+    + "\u190a\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\u0080\u028b\u048b"
+    + "\u070b\u090b\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\u0080\u0118\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\u0080\u0080"
+    + "\u1a89\u1b09\u1b89\u1c09\u1c89\u1d09\u1d89\u1e09\u1e89\u1f09\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u1f85"
+    + "\u1f85\u1f85\u1f85\u1f85\u1f85\u0080\u0080\u1f85\u0080\u1f85\u1f85"
+    + "\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85"
+    + "\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85"
+    + "\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85"
+    + "\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u1f85\u0080\u1f85"
+    + "\u1f85\u0080\u0080\u0080\u1f85\u0080\u0080\u1f85\u219c\u219c\u219c"
+    + "\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c"
+    + "\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c"
+    + "\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c"
+    + "\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c"
+    + "\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c\u219c"
+    + "\u219c\u219c\u219c\u219c\u219c\u219c\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u2201\u2319\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2319\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2319\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u0080\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u0080\u0080\u0080\u0080\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u0080\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u0080\u2201\u0080\u0080\u0080\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u0080\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2201\u0080\u2201\u2201\u0080\u0080\u2201\u0080\u0080\u2201"
+    + "\u2201\u0080\u0080\u2201\u2201\u2201\u2201\u0080\u2201\u2201\u2201"
+    + "\u2201\u2201\u2201\u2201\u2201\u2282\u2282\u2282\u2282\u0080\u2282"
+    + "\u0080\u2282\u2282\u2282\u2282\u2201\u2201\u0080\u2201\u2201\u2201"
+    + "\u2201\u0080\u0080\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u2201"
+    + "\u0080\u2201\u2201\u2201\u2201\u2201\u2201\u2201\u0080\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282\u2282"
+    + "\u2282\u2282\u2201\u2201\u0080\u2201\u2201\u2201\u2201\u0080\u2282"
+    + "\u2282\u2282\u2319\u2282\u2282\u2282\u2282\u2282\u2282\u0080\u0080"
+    + "\u0080\u0080\u2389\u2409\u2489\u2509\u2589\u2609\u2689\u2709\u2789"
+    + "\u2809\u2389\u2409\u2489\u2509\u2589\u2609\u2689\u2709\u2789\u2809"
+    + "\u2389\u2409\u2489\u2509\u2589\u2609\u2689\u2709\u2789\u2809\u2389"
+    + "\u2409\u2489\u2509\u2589\u2609\u2689\u2709\u2789\u2809\u2389\u2409"
+    + "\u2489\u2509\u2589\u2609\u2689\u2709\u2789\u2809",
+
+    "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\005\005\005\005"
+    + "\005\005\005\005\005\005\005\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080\u0080"
+    + "\u0080\u0080\u0080",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106\u0106"
+    + "\u0106\u0106\u0106\u0106\u0106\u0106\u0106\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\u0090\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090"
+    + "\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090\u0090",
+
+    "",
+
+    ""};
+
+  /**
+   * This is the attribute table for computing the numeric value of a
+   * character.  The value is -1 if Unicode does not define a value, -2
+   * if the value is not a positive integer, otherwise it is the value.
+   * Note that this is a signed value, but stored as an unsigned char
+   * since this is a String literal.
+   */
+   String[] NUM_VALUE = new String[]{
+   "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\000\001\002\003\004\005\006\007"
+    + "\010\011\uffff\uffff\012\013\014\015\016\017\020"
+    + "\021\022\023\024\025\026\027\030\031\032\033"
+    + "\034\035\036\037 !\"#\uffff\uffff\012"
+    + "\013\014\015\016\017\020\021\022\023\024\025"
+    + "\026\027\030\031\032\033\034\035\036\037 "
+    + "!\"#\uffff\uffff\uffff\uffff\uffff\uffff\002\003"
+    + "\uffff\001\uffff\ufffe\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\000\001\002\003\004\005\006\007"
+    + "\010\011\uffff\uffff\uffff\uffff\000\001\002\003\004"
+    + "\005\006\007\010\011\001\002\003\004\uffff\020"
+    + "\012d\u03e8\uffff\uffff\ufffe\uffff\uffff\024\036("
+    + "2<FPZ\u2710\021\022\023\uffff\000"
+    + "\001\002\003\004\005\006\007\010\011\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\000"
+    + "\004\005\006\007\010\011\uffff\uffff\uffff\001\002"
+    + "\003\004\005\006\007\010\011\012\013\0142"
+    + "d\u01f4\u03e8\001\002\003\004\005\006\007\010"
+    + "\011\012\013\0142d\u01f4\u03e8\u03e8\u1388\u2710"
+    + "\uffff\012\013\014\015\016\017\020\021\022\023"
+    + "\024\uffff\uffff\013\014\015\016\017\020\021\022"
+    + "\023\024\012\000\001\002\003\004\005\006\007"
+    + "\010\011\012\024\036\005\006\007\010\011\025"
+    + "\026\027\030\031\032\033\034\035\036\037 "
+    + "!\"#$%&'()*+"
+    + ",-./012\uffff\uffff\uffff",
+
+   "\uffff\uffff\uffff\uffff\uffff\001\002\003\004\005\006"
+    + "\007\010\011\012\024\036(2<FP"
+    + "Zd\u00c8\u012c\u0190\u01f4\u0258\u02bc\u0320\u0384\u03e8"
+    + "\u07d0\u0bb8\u0fa0\u1388\u1770\u1b58\u1f40\u2328\u2710\u4e20\u7530"
+    + "\ufffd\ufffc\ufffb\ufffa\ufff9\ufff8\uffff\uffff\uffff\000\001"
+    + "\002\003\004\005\006\007\010\011\uffff\uffff\uffff"
+    + "\uffff\uffff\uffff\uffff\uffff\000\001\002\003\004\005"
+    + "\006\007\010\011",
+
+   "\uffff\uffff",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+   "\uffff\uffff\uffff",
+
+    "",
+
+    ""};
+
+  /**
+   * This is the attribute table for computing the single-character uppercase
+   * representation of a character.  The value is the signed difference
+   * between the character and its uppercase version.  Note that this is
+   * stored as an unsigned char since this is a String literal.  When
+   * capitalizing a String, you must first check if a multi-character uppercase
+   * sequence exists before using this character.
+   */
+  String[] UPPER = new String[]{
+   "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\uffe0"
+    + "\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0"
+    + "\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0\uffe0"
+    + "\uffe0\uffe0\uffe0\000\000\000\000\000\000\000\000"
+    + "\u02e7\000\000\000\000\000\uffe0y\000\uffff\000"
+    + "\uff18\000\ufed4\000\000\000\000\000\000\000a"
+    + "\000\000\000\u0082\000\000\000\000\0008\000"
+    + "\uffff\ufffe\uffb1\000\000\000\000\uff2e\uff32\uff33\uff36"
+    + "\uff35\uff31\uff2f\uff2d\uff2b\uff2a\uff26\uff27\uff25\000\000"
+    + "\000T\000\000\000\000\000\uffda\uffdb\uffe1\uffc0"
+    + "\uffc1\uffc2\uffc7\000\uffd1\uffca\uffaa\uffb0\007\000\uffa0"
+    + "\000\000\000\000\000\000\uffd0\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\uffc5"
+    + "\010\000JVd\u0080p~\010\000\011"
+    + "\000\000\ue3db\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\ufff0\ufff0\ufff0\ufff0\ufff0\ufff0\ufff0\ufff0"
+    + "\ufff0\ufff0\ufff0\ufff0\ufff0\ufff0\ufff0\ufff0\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\uffe6\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000",
+
+   "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\uffd8\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000",
+
+   "\000\000",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+   "\000\000\000",
+
+    "",
+
+    ""};
+
+  /**
+   * This is the attribute table for computing the lowercase representation
+   * of a character.  The value is the signed difference between the
+   * character and its lowercase version.  Note that this is stored as an
+   * unsigned char since this is a String literal.
+   */
+   String[] LOWER = new String[]{
+   "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000       "
+    + "           "
+    + "        \000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000 \000\000\000\001\000\uff39"
+    + "\000\uff87\000\u00d2\u00ce\u00cdO\u00ca\u00cb\u00cf\000"
+    + "\u00d3\u00d1\u00d5\000\u00d6\u00da\u00d9\u00db\000\000\002"
+    + "\001\000\000\uff9f\uffc8\uff7e\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000&%@?\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\uffc4\000"
+    + "\ufff9P\000\0000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\ufff8\000\000\000\000\000\000\000\ufff8\000"
+    + "\uffb6\ufff7\000\uffaa\uff9c\uff90\uff80\uff82\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\ue2a3\udf41\udfba\020\020"
+    + "\020\020\020\020\020\020\020\020\020\020\020"
+    + "\020\020\020\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\032\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000",
+
+   "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000(\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000",
+
+   "\000\000",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+   "\000\000\000",
+
+    "",
+
+    ""};
+
+  /**
+   * This is the attribute table for computing the directionality class
+   * of a character, as well as a marker of characters with a multi-character
+   * capitalization.  The direction is taken by performing a signed shift
+   * right by 2 (where a result of -1 means an unknown direction, such as
+   * for undefined characters). The lower 2 bits form a count of the
+   * additional characters that will be added to a String when performing
+   * multi-character uppercase expansion. This count is also used, along with
+   * the offset in UPPER_SPECIAL, to determine how much of UPPER_EXPAND to use
+   * when performing the case conversion. Note that this information is stored
+   * as an unsigned char since this is a String literal.
+   */
+  String[] DIRECTION = new String[]{
+   "$,(004\024\02444\024"
+    + "\034\024\020\014\014\014\014\014\014\014\014"
+    + "\014\01444\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\00044\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\0344\00044\024\014\014"
+    + "\000\01444\000\001\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\ufffc\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\0004"
+    + "  \000\000\000\000\002\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000 \000\000\0004\004\004\010"
+    + "\010\010\010\030\030\030\030\030\030\030\030"
+    + "\030\030\030\010$\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\00044\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\0004"
+    + "444444444 \000"
+    + "\000\000\000\000\000\000\000\000\001\001\001"
+    + "\000\001\000\000\000\000\000\0000$\004"
+    + "4440(8 at H<D\014"
+    + "\014\014\014\014\014\014\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\014\014\014\014\014\014\014\014\014\014"
+    + "\014\000\00044444444"
+    + "444\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\0004"
+    + "44444444444"
+    + "44444444444"
+    + "4444444\000\000\010",
+
+   "\000\ufffc\0004\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\000\000\000"
+    + "\000\000\000\000\000\000\000\000\004\000 "
+    + "$4\000\000\000\014\014\014\014\014\014"
+    + "\014\014\014\014",
+
+   "\000\ufffc",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+    "",
+
+   "\ufffc$ ",
+
+    "",
+
+    ""};
+
+  /**
+   * This is the listing of titlecase special cases (all other characters
+   * can use <code>UPPER</code> to determine their titlecase).  The listing
+   * is a sorted sequence of character pairs; converting the first character
+   * of the pair to titlecase produces the second character.
+   */
+  String TITLE
+    = "\u01c4\u01c5\u01c5\u01c5\u01c6\u01c5\u01c7\u01c8\u01c8\u01c8\u01c9"
+    + "\u01c8\u01ca\u01cb\u01cb\u01cb\u01cc\u01cb\u01f1\u01f2\u01f2\u01f2"
+    + "\u01f3\u01f2";
+
+  /**
+   * This is a listing of characters with multi-character uppercase sequences.
+   * A character appears in this list exactly when it has a non-zero entry
+   * in the low-order 2-bit field of DIRECTION.  The listing is a sorted
+   * sequence of pairs (hence a binary search on the even elements is an
+   * efficient way to lookup a character). The first element of a pair is the
+   * character with the expansion, and the second is the index into
+   * UPPER_EXPAND where the expansion begins. Use the 2-bit field of
+   * DIRECTION to determine where the expansion ends.
+   */
+  String UPPER_SPECIAL
+    = "\u00df\000\u0149\002\u01f0\004\u0390\006\u03b0\011"
+    + "\u0587\014\u1e96\016\u1e97\020\u1e98\022\u1e99\024"
+    + "\u1e9a\026\u1f50\030\u1f52\032\u1f54\035\u1f56 "
+    + "\u1f80#\u1f81%\u1f82'\u1f83)\u1f84+"
+    + "\u1f85-\u1f86/\u1f871\u1f883\u1f895"
+    + "\u1f8a7\u1f8b9\u1f8c;\u1f8d=\u1f8e?"
+    + "\u1f8fA\u1f90C\u1f91E\u1f92G\u1f93I"
+    + "\u1f94K\u1f95M\u1f96O\u1f97Q\u1f98S"
+    + "\u1f99U\u1f9aW\u1f9bY\u1f9c[\u1f9d]"
+    + "\u1f9e_\u1f9fa\u1fa0c\u1fa1e\u1fa2g"
+    + "\u1fa3i\u1fa4k\u1fa5m\u1fa6o\u1fa7q"
+    + "\u1fa8s\u1fa9u\u1faaw\u1faby\u1fac{"
+    + "\u1fad}\u1fae\u007f\u1faf\u0081\u1fb2\u0083\u1fb3\u0085"
+    + "\u1fb4\u0087\u1fb6\u0089\u1fb7\u008b\u1fbc\u008e\u1fc2\u0090"
+    + "\u1fc3\u0092\u1fc4\u0094\u1fc6\u0096\u1fc7\u0098\u1fcc\u009b"
+    + "\u1fd2\u009d\u1fd3\u00a0\u1fd6\u00a3\u1fd7\u00a5\u1fe2\u00a8"
+    + "\u1fe3\u00ab\u1fe4\u00ae\u1fe6\u00b0\u1fe7\u00b2\u1ff2\u00b5"
+    + "\u1ff3\u00b7\u1ff4\u00b9\u1ff6\u00bb\u1ff7\u00bd\u1ffc\u00c0"
+    + "\ufb00\u00c2\ufb01\u00c4\ufb02\u00c6\ufb03\u00c8\ufb04\u00cb"
+    + "\ufb05\u00ce\ufb06\u00d0\ufb13\u00d2\ufb14\u00d4\ufb15\u00d6"
+    + "\ufb16\u00d8\ufb17\u00da";
+
+  /**
+   * This is the listing of special case multi-character uppercase sequences.
+   * Characters listed in UPPER_SPECIAL index into this table to find their
+   * uppercase expansion. Remember that you must also perform special-casing
+   * on two single-character sequences in the Turkish locale, which are not
+   * covered here in CharData.
+   */
+  String UPPER_EXPAND
+    = "SS\u02bcNJ\u030c\u0399\u0308\u0301\u03a5\u0308"
+    + "\u0301\u0535\u0552H\u0331T\u0308W\u030aY\u030a"
+    + "A\u02be\u03a5\u0313\u03a5\u0313\u0300\u03a5\u0313\u0301\u03a5"
+    + "\u0313\u0342\u1f08\u0399\u1f09\u0399\u1f0a\u0399\u1f0b\u0399\u1f0c"
+    + "\u0399\u1f0d\u0399\u1f0e\u0399\u1f0f\u0399\u1f08\u0399\u1f09\u0399"
+    + "\u1f0a\u0399\u1f0b\u0399\u1f0c\u0399\u1f0d\u0399\u1f0e\u0399\u1f0f"
+    + "\u0399\u1f28\u0399\u1f29\u0399\u1f2a\u0399\u1f2b\u0399\u1f2c\u0399"
+    + "\u1f2d\u0399\u1f2e\u0399\u1f2f\u0399\u1f28\u0399\u1f29\u0399\u1f2a"
+    + "\u0399\u1f2b\u0399\u1f2c\u0399\u1f2d\u0399\u1f2e\u0399\u1f2f\u0399"
+    + "\u1f68\u0399\u1f69\u0399\u1f6a\u0399\u1f6b\u0399\u1f6c\u0399\u1f6d"
+    + "\u0399\u1f6e\u0399\u1f6f\u0399\u1f68\u0399\u1f69\u0399\u1f6a\u0399"
+    + "\u1f6b\u0399\u1f6c\u0399\u1f6d\u0399\u1f6e\u0399\u1f6f\u0399\u1fba"
+    + "\u0399\u0391\u0399\u0386\u0399\u0391\u0342\u0391\u0342\u0399\u0391"
+    + "\u0399\u1fca\u0399\u0397\u0399\u0389\u0399\u0397\u0342\u0397\u0342"
+    + "\u0399\u0397\u0399\u0399\u0308\u0300\u0399\u0308\u0301\u0399\u0342"
+    + "\u0399\u0308\u0342\u03a5\u0308\u0300\u03a5\u0308\u0301\u03a1\u0313"
+    + "\u03a5\u0342\u03a5\u0308\u0342\u1ffa\u0399\u03a9\u0399\u038f\u0399"
+    + "\u03a9\u0342\u03a9\u0342\u0399\u03a9\u0399FFFI"
+    + "FLFFIFFLSTS"
+    + "T\u0544\u0546\u0544\u0535\u0544\u053b\u054e\u0546\u0544\u053d";
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ClassHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ClassHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ClassHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/ClassHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,205 @@
+/* ClassHelper.java -- Utility methods to augment java.lang.Class
+   Copyright (C) 1998, 2002 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 gnu.java.lang;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * ClassHelper has various methods that ought to have been in Class.
+ *
+ * @author John Keiser
+ * @author Eric Blake (ebb9 at email.byu.edu)
+ */
+public class ClassHelper
+{
+  /**
+   * Strip the package part from the class name.
+   *
+   * @param clazz the class to get the truncated name from
+   * @return the truncated class name
+   */
+  public static String getTruncatedClassName(Class clazz)
+  {
+    return getTruncatedName(clazz.getName());
+  }
+
+  /**
+   * Strip the package part from the class name, or the class part from
+   * the method or field name.
+   *
+   * @param name the name to truncate
+   * @return the truncated name
+   */
+  public static String getTruncatedName(String name)
+  {
+    int lastInd = name.lastIndexOf('.');
+    if (lastInd == -1)
+      return name;
+    return name.substring(lastInd + 1);
+  }
+
+  /**
+   * Return the name of the class as written by the user.
+   * This is used by the various reflection toString methods.
+   * It differs from {@link Class#getName()} in that it prints
+   * arrays with trailing "[]"s.  Note that it does not treat
+   * member classes specially, so a dollar sign may still appear
+   * in the result.  This is intentional.
+   * @param klass the class
+   * @return a pretty form of the class' name
+   */
+  public static String getUserName(Class klass)
+  {
+    int arrayCount = 0;
+    while (klass.isArray())
+      {
+        ++arrayCount;
+        klass = klass.getComponentType();
+      }
+    String name = klass.getName();
+    if (arrayCount == 0)
+      return name;
+    StringBuilder b = new StringBuilder(name.length() + 2 * arrayCount);
+    b.append(name);
+    for (int i = 0; i < arrayCount; ++i)
+      b.append("[]");
+    return b.toString();
+  }
+
+  /** Cache of methods found in getAllMethods(). */
+  private static Map allMethods = new HashMap();
+
+  /**
+   * Get all the methods, public, private and otherwise, from the class,
+   * getting them from the most recent class to find them. This may not
+   * be quite the correct approach, as this includes methods that are not
+   * inherited or accessible from clazz, so beware.
+   *
+   * @param clazz the class to start at
+   * @return all methods declared or inherited in clazz
+   */
+  public static Method[] getAllMethods(Class clazz)
+  {
+    Method[] retval = (Method[]) allMethods.get(clazz);
+    if (retval == null)
+      {
+        Set methods = new HashSet();
+        Class c = clazz;
+        while (c != null)
+          {
+            Method[] currentMethods = c.getDeclaredMethods();
+          loop:
+            for (int i = 0; i < currentMethods.length; i++)
+              {
+                Method current = currentMethods[i];
+                int size = methods.size();
+                Iterator iter = methods.iterator();
+                while (--size >= 0)
+                  {
+                    Method override = (Method) iter.next();
+                    if (current.getName().equals(override.getName())
+                        && Arrays.equals(current.getParameterTypes(),
+                                         override.getParameterTypes())
+                        && current.getReturnType() == override.getReturnType())
+                      continue loop;
+                  }
+                methods.add(current);
+              }
+            c = c.getSuperclass();
+          }
+        retval = new Method[methods.size()];
+        methods.toArray(retval);
+        allMethods.put(clazz, retval);
+      }
+    return retval;
+  }
+
+  /** Cache of fields found in getAllFields(). */
+  private static Map allFields = new HashMap();
+
+  /**
+   * Get all the fields, public, private and otherwise, from the class,
+   * getting them from the most recent class to find them. This may not
+   * be quite the correct approach, as this includes fields that are not
+   * inherited or accessible from clazz, so beware.
+   *
+   * @param clazz the class to start at
+   * @return all fields declared or inherited in clazz
+   */
+  public static Field[] getAllFields(Class clazz)
+  {
+    Field[] retval = (Field[]) allFields.get(clazz);
+    if (retval == null)
+      {
+        Set fields = new HashSet();
+        Class c = clazz;
+        while (c != null)
+          {
+            Field[] currentFields = c.getDeclaredFields();
+          loop:
+            for (int i = 0; i < currentFields.length; i++)
+              {
+                Field current = currentFields[i];
+                int size = fields.size();
+                Iterator iter = fields.iterator();
+                while (--size >= 0)
+                  {
+                    Field override = (Field) iter.next();
+                    if (current.getName().equals(override.getName())
+                        && current.getType() == override.getType())
+                      continue loop;
+                  }
+                fields.add(current);
+              }
+            c = c.getSuperclass();
+          }
+        retval = new Field[fields.size()];
+        fields.toArray(retval);
+        allFields.put(clazz, retval);
+      }
+    return retval;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/InstrumentationImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/InstrumentationImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/InstrumentationImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/InstrumentationImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,243 @@
+/* InstrumentationImpl.java -- GNU implementation of
+   java.lang.instrument.Instrumentation
+   Copyright (C) 2005  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 gnu.java.lang;
+
+import java.lang.instrument.Instrumentation;
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.ClassDefinition;
+import java.lang.instrument.UnmodifiableClassException;
+import java.lang.instrument.IllegalClassFormatException;
+
+import java.security.ProtectionDomain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * An Instrumentation object has transformers that will
+ * be called each time a class is defined or redefined.
+ * The object is given to a <code>premain</code> function
+ * that is called before the <code>main</code> function.
+ *
+ * @author Nicolas Geoffray (nicolas.geoffray at menlina.com)
+ * @since 1.5
+ */
+public final class InstrumentationImpl implements Instrumentation
+{
+
+  /* List of transformers */
+  /* FIXME[GENERICS]: Should be ClassFileTransformer list */
+  private ArrayList transformers = new ArrayList();
+
+  
+  private InstrumentationImpl()
+  {
+  }
+
+  /**
+   * Adds a <code>ClassFileTransformer</class> object
+   * to the instrumentation. Each time a class is defined
+   * or redefined, the <code>transform</code> method of the
+   * <code>transformer</code> object is called.
+   * 
+   * @param transformer the transformer to add
+   * @throws NullPointerException if transformer is null
+   */
+  public void addTransformer(ClassFileTransformer transformer)
+  {
+    if (transformer == null)
+      throw new NullPointerException();
+    synchronized(transformers)
+      {
+        transformers.add(transformer);
+      }
+  }
+  
+  /**
+   * Removes the given transformer from the set of transformers
+   * this Instrumentation object has.
+   * 
+   * @param transformer the transformer to remove
+   * @return true if the transformer was found and removed, false if
+   * the transformer was not found
+   * @throws NullPointerException if transformer is null
+   */
+  public boolean removeTransformer(ClassFileTransformer transformer)
+  {
+    if (transformer == null)
+      throw new NullPointerException();
+    
+    boolean result; 
+    synchronized (transformers)
+      {
+        result = transformers.remove(transformer);
+      }
+    return result;
+  }
+
+  /**
+   * Returns if the current JVM supports class redefinition
+   * 
+   * @return true if the current JVM supports class redefinition
+   */
+  public boolean isRedefineClassesSupported()
+  {
+    return VMInstrumentationImpl.isRedefineClassesSupported();
+  }
+    
+  /**
+   * Redefine classes present in the definitions array, with
+   * the corresponding class files.
+   *
+   * @param definitions an array of classes to redefine
+   * 
+   * @throws ClassNotFoundException if a class cannot be found 
+   * @throws UnmodifiableClassException if a class cannot be modified 
+   * @throws UnsupportedOperationException if the JVM does not support
+   * redefinition or the redefinition made unsupported changes
+   * @throws ClassFormatError if a class file is not valid
+   * @throws NoClassDefFoundError if a class name is not equal to the name
+   * in the class file specified
+   * @throws UnsupportedClassVersionError if the class file version numbers
+   * are unsupported
+   * @throws ClassCircularityError if circularity occured with the new
+   * classes
+   * @throws LinkageError if a linkage error occurs 
+   * @throws NullPointerException if the definitions array is null, or any
+   * of its element
+   *
+   * @see isRedefineClassesSupported()
+   * @see addTransformer(java.lang.instrument.ClassFileTransformer)
+   * @see ClassFileTransformer
+   */
+  public void redefineClasses(ClassDefinition[] definitions)
+                     throws ClassNotFoundException,
+                            UnmodifiableClassException
+  {
+    if (!isRedefineClassesSupported())
+      throw new UnsupportedOperationException();
+    
+    VMInstrumentationImpl.redefineClasses(this, definitions);
+  }
+
+
+  /**
+   * Get all the classes loaded by the JVM.
+   * 
+   * @return an array containing all the classes loaded by the JVM. The array
+   * is empty if no class is loaded.
+   */
+  public Class[] getAllLoadedClasses()
+  {
+    return VMInstrumentationImpl.getAllLoadedClasses();
+  }
+
+  /**
+   * Get all the classes loaded by a given class loader
+   * 
+   * @param loader the loader
+   * 
+   * @return an array containing all the classes loaded by the given loader.
+   * The array is empty if no class was loaded by the loader.
+   */
+  public Class[] getInitiatedClasses(ClassLoader loader)
+  {
+    return VMInstrumentationImpl.getInitiatedClasses(loader);
+  }
+
+  /**
+   * Get the size of an object.
+   * 
+   * @param objectToSize the object
+   * @return the size of the object
+   * @throws NullPointerException if objectToSize is null.
+   */
+  public long getObjectSize(Object objectToSize)
+  {
+    // We alleviate the VM work
+    if (objectToSize == null)
+      throw new NullPointerException();
+    return VMInstrumentationImpl.getObjectSize(objectToSize);
+  }
+
+  /**
+   * Called by the VM or redefineClasses to call each transformer
+   *
+   * @param loader the loader of the class
+   * @param className the name of the class with packages separated with "/"
+   * @param classBeingRedefined the class being redefined if it's the case,
+   * null otherwise
+   * @param protectionDomain the protection domain of the class being defined
+   * or redefined
+   * @param classfileBuffer the input byte buffer in class file format
+   * 
+   * @return the new class file
+   */
+  /* FIXME[GENERICS]: Should be Class<?> */
+  public byte[] callTransformers(ClassLoader loader, String className,
+				 Class classBeingRedefined, ProtectionDomain protectionDomain, 
+				 byte[] classfileBuffer)
+  {
+    byte[] newBuffer = null;
+    byte[] oldBuffer = classfileBuffer;
+    ClassFileTransformer current;
+    synchronized (transformers)
+      {
+        Iterator i = transformers.iterator();
+        while (i.hasNext())
+          {
+	    /* FIXME[GENERICS]: Remove cast */
+            current = (ClassFileTransformer) i.next();
+            try
+              {
+                newBuffer = current.transform(loader, className,
+                  classBeingRedefined, protectionDomain, oldBuffer);
+	      }
+	    catch (IllegalClassFormatException ignored)
+	      {
+                //IGNORED
+	      }
+            if (newBuffer != null)
+      	      oldBuffer = newBuffer;
+          }
+      }
+    return oldBuffer;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/MainThread.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/MainThread.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/MainThread.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/MainThread.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,83 @@
+/* MainThread.java --
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   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 gnu.java.lang;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * MainThread is a Thread which uses the main() method of some class.
+ *
+ * @author John Keiser
+ * @author Tom Tromey (tromey at redhat.com)
+ */
+public class MainThread
+{
+  // Private data.
+  String[] args;
+  Method mainMethod;
+
+  public MainThread(String classname, String[] args)
+    throws ClassNotFoundException, NoSuchMethodException
+  {
+    Class found = Class.forName(classname, true,
+				ClassLoader.getSystemClassLoader());
+    Class[] argTypes = new Class[1];
+    argTypes[0] = args.getClass();
+    mainMethod = found.getMethod("main", argTypes);
+    this.args = args;
+  }
+
+  public void run()
+  {
+    try
+      {
+	mainMethod.invoke(null,args);
+      }
+    catch(IllegalAccessException e)
+      {
+	// Ignore.
+      }
+    catch(InvocationTargetException e)
+      {
+	// Ignore.
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/BeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/BeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/BeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/BeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,84 @@
+/* BeanImpl.java - A common superclass for bean implementations.
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import java.lang.management.ManagementPermission;
+
+import javax.management.NotCompliantMBeanException;
+import javax.management.StandardMBean;
+
+/**
+ * A common superclass for bean implementations.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class BeanImpl
+  extends StandardMBean
+{
+ 
+  /**
+   * Constructs a new <code>BeanImpl</code>.
+   *
+   * @param iface the bean interface being implemented.
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  protected BeanImpl(Class iface)
+    throws NotCompliantMBeanException
+  {
+    super(iface);
+  }
+
+  protected void checkMonitorPermissions()
+  {
+    SecurityManager sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPermission(new ManagementPermission("monitor"));
+  }
+
+  protected void checkControlPermissions()
+  {
+    SecurityManager sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPermission(new ManagementPermission("control"));
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ClassLoadingMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,99 @@
+/* ClassLoadingMXBeanImpl.java - Implementation of a class loading bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import java.lang.management.ClassLoadingMXBean;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about the class loading 
+ * behaviour of the current invocation of the virtual
+ * machine.  Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getClassLoadingMXBean()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class ClassLoadingMXBeanImpl
+  extends BeanImpl
+  implements ClassLoadingMXBean
+{
+
+  /**
+   * Constructs a new <code>ClassLoadingMXBeanImpl</code>.
+   *
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public ClassLoadingMXBeanImpl()
+    throws NotCompliantMBeanException
+  {
+    super(ClassLoadingMXBean.class);
+  }
+
+  public int getLoadedClassCount()
+  {
+    return VMClassLoadingMXBeanImpl.getLoadedClassCount();
+  }
+
+  public long getTotalLoadedClassCount()
+  {
+    return getLoadedClassCount() + getUnloadedClassCount();
+  }
+
+  public long getUnloadedClassCount()
+  {
+    return VMClassLoadingMXBeanImpl.getUnloadedClassCount();
+  }
+
+  public boolean isVerbose()
+  {
+    return VMClassLoadingMXBeanImpl.isVerbose();
+  }
+
+  public void setVerbose(boolean verbose)
+  {
+    checkControlPermissions();
+    VMClassLoadingMXBeanImpl.setVerbose(verbose);
+  }
+
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/CompilationMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,105 @@
+/* CompilationMXBeanImpl.java - Implementation of a compilation bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import gnu.classpath.SystemProperties;
+
+import java.lang.management.CompilationMXBean;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about the JIT 
+ * compiler of the virtual machine, if one exists.
+ * Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getCompilationMXBean()},
+ * if this is the case.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class CompilationMXBeanImpl
+  extends BeanImpl
+  implements CompilationMXBean
+{
+
+  /**
+   * Constant for compiler name.
+   */
+  private static final String COMPILER_NAME = "gnu.java.compiler.name";
+
+  /**
+   * Constant for compilation time support.
+   */
+  private static final String COMPILATION_TIME_SUPPORT = 
+    "gnu.java.lang.management.CompilationTimeSupport";
+
+  /**
+   * Constructs a new <code>CompilationMXBeanImpl</code>.
+   *
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public CompilationMXBeanImpl()
+    throws NotCompliantMBeanException
+  {
+    super(CompilationMXBean.class);
+  }
+
+  public String getName()
+  {
+    return SystemProperties.getProperty(COMPILER_NAME);
+  }
+  
+  public boolean isCompilationTimeMonitoringSupported()
+  {
+    return SystemProperties.getProperty(COMPILATION_TIME_SUPPORT) != null;
+  }
+
+  public long getTotalCompilationTime()
+  {
+    if (isCompilationTimeMonitoringSupported())
+      return VMCompilationMXBeanImpl.getTotalCompilationTime();
+    else
+      throw new UnsupportedOperationException("Compilation time monitoring "
+					      + "is not supported");
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/GarbageCollectorMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,84 @@
+/* GarbageCollectorMXBeanImpl.java - Implementation of a GC bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import java.lang.management.GarbageCollectorMXBean;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about one of the garbage 
+ * collectors used by the current invocation of the
+ * virtual machine.  An instance of this bean for each garbage
+ * collector is obtained by calling
+ * {@link ManagementFactory#getGarbageCollectorMXBeans()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class GarbageCollectorMXBeanImpl
+  extends MemoryManagerMXBeanImpl
+  implements GarbageCollectorMXBean
+{
+
+  /**
+   * Constructs a new <code>GarbageCollectorMXBeanImpl</code>.
+   *
+   * @param name the name of the garbage collector this bean represents.
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public GarbageCollectorMXBeanImpl(String name)
+    throws NotCompliantMBeanException
+  {
+    super(name, GarbageCollectorMXBean.class);
+  }
+
+  public long getCollectionCount()
+  {
+    return VMGarbageCollectorMXBeanImpl.getCollectionCount(name);
+  }
+
+  public long getCollectionTime()
+  {
+    return VMGarbageCollectorMXBeanImpl.getCollectionTime(name);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,322 @@
+/* MemoryMXBeanImpl.java - Implementation of a memory bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryNotificationInfo;
+import java.lang.management.MemoryUsage;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.NotCompliantMBeanException;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+
+/**
+ * Provides access to information about the memory 
+ * management of the current invocation of the virtual
+ * machine.  Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getMemoryMXBean()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class MemoryMXBeanImpl
+  extends BeanImpl
+  implements MemoryMXBean, NotificationEmitter
+{
+
+  private List listeners;
+
+  private long notificationCount;
+
+  public static CompositeType notifType;
+
+  public static CompositeType usageType;
+
+  static
+  {
+    try
+      {
+	CompositeType usageType = 
+	  new CompositeType(MemoryUsage.class.getName(),
+			    "Describes the usage levels of a pool",
+			    new String[] { "init", "used",
+					   "committed", "max"
+			    },
+			    new String[] { "Initial level",
+					   "Used level",
+					   "Committed level",
+					   "Maximum level"
+			    },
+			    new OpenType[] {
+			      SimpleType.LONG, SimpleType.LONG,
+			      SimpleType.LONG, SimpleType.LONG
+			    });
+	CompositeType notifType =
+	  new CompositeType(MemoryNotificationInfo.class.getName(),
+			    "Provides the notification info on memory usage",
+			    new String[] { "poolName", "usage", "count" },
+			    new String[] { "Name of the memory pool",
+					   "Usage level of the memory pool",
+					   "Number of times the threshold " +
+					   "has been crossed"
+			    },
+			    new OpenType[] {
+			      SimpleType.STRING, usageType, SimpleType.LONG 
+			    });
+	  }
+	catch (OpenDataException e)
+	  {
+	    throw new IllegalStateException("Something went wrong in creating " +
+					    "the composite data types.", e);
+	  }
+  }
+
+  /**
+   * Constructs a new <code>MemoryMXBeanImpl</code>.
+   *
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public MemoryMXBeanImpl()
+    throws NotCompliantMBeanException
+  {
+    super(MemoryMXBean.class);
+    listeners = new ArrayList();
+    notificationCount = 0;
+  }
+
+  public void gc()
+  {
+    System.gc();
+  }
+
+  public MemoryUsage getHeapMemoryUsage()
+  {
+    return VMMemoryMXBeanImpl.getHeapMemoryUsage();
+  }
+
+  public MemoryUsage getNonHeapMemoryUsage()
+  {
+    return VMMemoryMXBeanImpl.getNonHeapMemoryUsage();
+  }
+
+  public int getObjectPendingFinalizationCount()
+  {
+    return VMMemoryMXBeanImpl.getObjectPendingFinalizationCount();
+  }
+
+  public boolean isVerbose()
+  {
+    return VMMemoryMXBeanImpl.isVerbose();
+  }
+
+  public void setVerbose(boolean verbose)
+  {
+    checkControlPermissions();
+    VMMemoryMXBeanImpl.setVerbose(verbose);
+  }
+
+  private class ListenerData
+  {
+    private NotificationListener listener;
+    private NotificationFilter filter;
+    private Object passback;
+
+    public ListenerData(NotificationListener listener,
+			NotificationFilter filter, Object passback)
+    {
+      this.listener = listener;
+      this.filter = filter;
+      this.passback = passback;
+    }
+    
+    public NotificationListener getListener()
+    {
+      return listener;
+    }
+
+    public NotificationFilter getFilter()
+    {
+      return filter;
+    }
+
+    public Object getPassback()
+    {
+      return passback;
+    }
+
+    public boolean equals(Object obj)
+    {
+      if (obj instanceof ListenerData)
+	{
+	  ListenerData data = (ListenerData) obj;
+	  return (data.getListener() == listener &&
+		  data.getFilter() == filter &&
+		  data.getPassback() == passback);
+	}
+      return false;
+    }
+
+  }
+
+  public void addNotificationListener(NotificationListener listener,
+				      NotificationFilter filter,
+				      Object passback)
+  {
+    if (listener == null)
+      throw new IllegalArgumentException("Null listener added to bean.");
+    listeners.add(new ListenerData(listener, filter, passback));
+  }
+
+  public MBeanNotificationInfo[] getNotificationInfo()
+  {
+    return new MBeanNotificationInfo[]
+      {
+	new MBeanNotificationInfo(new String[]
+	  {
+	    MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
+	    MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED
+	  },
+				  Notification.class.getName(), 
+				  "Memory Usage Notifications")
+      };
+  }
+
+  public void removeNotificationListener(NotificationListener listener)
+    throws ListenerNotFoundException
+  {
+    Iterator it = listeners.iterator();
+    boolean foundOne = false;
+    while (it.hasNext())
+      {
+	ListenerData data = (ListenerData) it.next();
+	if (data.getListener() == listener)
+	  {
+	    it.remove();
+	    foundOne = true;
+	  }
+      }
+    if (!foundOne)
+      throw new ListenerNotFoundException("The specified listener, " + listener +
+					  "is not registered with this bean.");
+  }
+
+  public void removeNotificationListener(NotificationListener listener,
+					 NotificationFilter filter,
+					 Object passback)
+    throws ListenerNotFoundException
+  {
+    if (!(listeners.remove(new ListenerData(listener, filter, passback))))
+      {
+	throw new ListenerNotFoundException("The specified listener, " + listener +
+					    " with filter " + filter + 
+					    "and passback " + passback + 
+					    ", is not registered with this bean.");
+      }
+  }
+
+  void fireNotification(String type, String poolName, long init, long used,
+			long committed, long max, long count)
+  {
+    Notification notif = new Notification(type, this, notificationCount);
+    MemoryUsage usage = new MemoryUsage(init, used, committed, max);
+    CompositeData data;
+    try
+      {
+	data = new CompositeDataSupport(notifType, 
+					new String[] {
+					  "poolName", "usage", "count"
+					},
+					new Object[] {
+					  poolName, usage, Long.valueOf(count)
+					});
+      }
+    catch (OpenDataException e)
+      {
+	throw new IllegalStateException("Something went wrong in creating " +
+					"the composite data instance.", e);
+      }
+    notif.setUserData(data);
+    Iterator it = listeners.iterator();
+    while (it.hasNext())
+      {
+	ListenerData ldata = (ListenerData) it.next();
+	NotificationFilter filter = ldata.getFilter();
+	if (filter == null || filter.isNotificationEnabled(notif))
+	  ldata.getListener().handleNotification(notif, ldata.getPassback());
+      }
+    ++notificationCount;
+  }
+
+  void fireThresholdExceededNotification(String poolName, long init,
+					 long used, long committed,
+					 long max, long count)
+  {
+    fireNotification(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
+		     poolName, init, used, committed, max, count);
+  }
+
+  void fireCollectionThresholdExceededNotification(String poolName,
+						   long init,
+						   long used,
+						   long committed,
+						   long max,
+						   long count)
+  {
+    fireNotification(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
+		     poolName, init, used, committed, max, count);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryManagerMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,112 @@
+/* MemoryManagerMXBeanImpl.java - Implementation of a memory manager bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import java.lang.management.MemoryManagerMXBean;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about one of the memory 
+ * managers used by the current invocation of the
+ * virtual machine.  An instance of this bean for each memory
+ * manager is obtained by calling
+ * {@link ManagementFactory#getMemoryPoolMXBeans()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class MemoryManagerMXBeanImpl
+  extends BeanImpl
+  implements MemoryManagerMXBean
+{
+
+  /**
+   * The name of the memory manager.
+   */
+  protected String name;
+
+  /**
+   * Constructs a new <code>MemoryManagerMXBeanImpl</code>.
+   *
+   * @param name the name of the manager this bean represents.
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public MemoryManagerMXBeanImpl(String name)
+    throws NotCompliantMBeanException
+  {
+    this(name, MemoryManagerMXBean.class);
+  }
+
+  /**
+   * Constructs a new <code>MemoryManagerMXBeanImpl</code>
+   * implementing the specified bean interface.
+   *
+   * @param name the name of the manager this bean represents.
+   * @param iface the bean interface being implemented.
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  protected MemoryManagerMXBeanImpl(String name, Class iface)
+    throws NotCompliantMBeanException
+  {
+    super(iface);
+    this.name = name;
+  }
+
+  public String[] getMemoryPoolNames()
+  {
+    return VMMemoryManagerMXBeanImpl.getMemoryPoolNames(name);
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public boolean isValid()
+  {
+    return VMMemoryManagerMXBeanImpl.isValid(name);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,225 @@
+/* MemoryPoolMXBeanImpl.java - Implementation of a memory pool bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import gnu.classpath.SystemProperties;
+
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about one of the memory 
+ * resources or pools used by the current invocation of the
+ * virtual machine.  An instance of this bean for each memory
+ * pool is obtained by calling
+ * {@link ManagementFactory#getMemoryPoolMXBeans()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class MemoryPoolMXBeanImpl
+  extends BeanImpl
+  implements MemoryPoolMXBean
+{
+
+  /**
+   * The name of the pool.
+   */
+  private String name;
+
+  /**
+   * Constant for collection usage threshold.
+   */
+  private static final String COLLECTION_USAGE_THRESHOLD = 
+    "gnu.java.lang.management.CollectionUsageThresholdSupport";
+
+  /**
+   * Constant for thread time support.
+   */
+  private static final String USAGE_THRESHOLD = 
+    "gnu.java.lang.management.UsageThresholdSupport";
+
+  /**
+   * Constructs a new <code>MemoryPoolMXBeanImpl</code>.
+   *
+   * @param name the name of the pool this bean represents.
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public MemoryPoolMXBeanImpl(String name)
+    throws NotCompliantMBeanException
+  {
+    super(MemoryPoolMXBean.class);
+    this.name = name;
+  }
+
+  public MemoryUsage getCollectionUsage()
+  {
+    return VMMemoryPoolMXBeanImpl.getCollectionUsage(name);
+  }
+
+  public long getCollectionUsageThreshold()
+  {
+    if (isCollectionUsageThresholdSupported())
+      return VMMemoryPoolMXBeanImpl.getCollectionUsageThreshold(name);
+    else
+      throw new UnsupportedOperationException("A collection usage "+
+					      "threshold is not supported.");
+  }
+
+  public long getCollectionUsageThresholdCount()
+  {
+    if (isCollectionUsageThresholdSupported())
+      return VMMemoryPoolMXBeanImpl.getCollectionUsageThresholdCount(name);
+    else
+      throw new UnsupportedOperationException("A collection usage "+
+					      "threshold is not supported.");
+  }
+
+  public String[] getMemoryManagerNames()
+  {
+    return VMMemoryPoolMXBeanImpl.getMemoryManagerNames(name);
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public MemoryUsage getPeakUsage()
+  {
+    if (isValid())
+      return VMMemoryPoolMXBeanImpl.getPeakUsage(name);
+    else
+      return null;
+  }
+
+  public String getType()
+  {
+    return VMMemoryPoolMXBeanImpl.getType(name);
+  }
+
+  public MemoryUsage getUsage()
+  {
+    if (isValid())
+      return VMMemoryPoolMXBeanImpl.getUsage(name);
+    else
+      return null;
+  }
+
+  public long getUsageThreshold()
+  {
+    if (isUsageThresholdSupported())
+      return VMMemoryPoolMXBeanImpl.getUsageThreshold(name);
+    else
+      throw new UnsupportedOperationException("A usage threshold " +
+					      "is not supported.");
+  }
+
+  public long getUsageThresholdCount()
+  {
+    if (isUsageThresholdSupported())
+      return VMMemoryPoolMXBeanImpl.getUsageThresholdCount(name);
+    else
+      throw new UnsupportedOperationException("A usage threshold " +
+					      "is not supported.");
+  }
+
+  public boolean isCollectionUsageThresholdExceeded()
+  {
+    return getCollectionUsage().getUsed() >= getCollectionUsageThreshold();
+  }
+
+  public boolean isCollectionUsageThresholdSupported()
+  {
+    return SystemProperties.getProperty(COLLECTION_USAGE_THRESHOLD) != null;
+  }
+
+  public boolean isUsageThresholdExceeded()
+  {
+    return getUsage().getUsed() >= getUsageThreshold();
+  }
+
+  public boolean isUsageThresholdSupported()
+  {
+    return SystemProperties.getProperty(USAGE_THRESHOLD) != null;
+  }
+
+  public boolean isValid()
+  {
+    return VMMemoryPoolMXBeanImpl.isValid(name);
+  }
+
+  public void resetPeakUsage()
+  {
+    checkControlPermissions();
+    VMMemoryPoolMXBeanImpl.resetPeakUsage(name);
+  }
+
+  public void setCollectionUsageThreshold(long threshold)
+  {
+    checkControlPermissions();
+    if (threshold < 0)
+      throw new IllegalArgumentException("Threshold of " + threshold +
+					 "is less than zero.");
+    if (isCollectionUsageThresholdSupported())
+      VMMemoryPoolMXBeanImpl.setCollectionUsageThreshold(name, threshold);
+    else
+      throw new UnsupportedOperationException("A collection usage "+
+					      "threshold is not supported.");
+  }
+
+  public void setUsageThreshold(long threshold)
+  {
+    checkControlPermissions();
+    if (threshold < 0)
+      throw new IllegalArgumentException("Threshold of " + threshold +
+					 "is less than zero.");
+    if (isUsageThresholdSupported())
+      VMMemoryPoolMXBeanImpl.setUsageThreshold(name, threshold);
+    else
+      throw new UnsupportedOperationException("A usage threshold " +
+					      "is not supported.");
+  }
+
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,90 @@
+/* OperatingSystemMXBeanImpl.java - Implementation of an operating system bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import java.lang.management.OperatingSystemMXBean;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about the underlying operating
+ * system.  
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class OperatingSystemMXBeanImpl
+  extends BeanImpl
+  implements OperatingSystemMXBean
+{
+
+  /**
+   * Constructs a new <code>OperatingSystemMXBeanImpl</code>.
+   *
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public OperatingSystemMXBeanImpl()
+    throws NotCompliantMBeanException
+  {
+    super(OperatingSystemMXBean.class);
+  }
+
+  public String getArch()
+  {
+    return System.getProperty("os.arch");
+  }
+
+  public int getAvailableProcessors()
+  {
+    return Runtime.getRuntime().availableProcessors();
+  }
+
+  public String getName()
+  {
+    return System.getProperty("os.name");
+  }
+
+  public String getVersion()
+  {
+    return System.getProperty("os.version");
+  }
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,197 @@
+/* RuntimeMXBeanImpl.java - Implementation of an runtime bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import gnu.classpath.SystemProperties;
+
+import java.lang.management.RuntimeMXBean;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about the virtual machine.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class RuntimeMXBeanImpl
+  extends BeanImpl
+  implements RuntimeMXBean
+{
+
+  private static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
+  private static final String JAVA_BOOT_CLASS_PATH = "java.boot.class.path";
+
+  private long startTime = -1;
+
+  private String bootClassPath = null;
+
+  private boolean bootClassPathSupported = true;
+
+  /**
+   * Constructs a new <code>RuntimeMXBeanImpl</code>.
+   *
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public RuntimeMXBeanImpl()
+    throws NotCompliantMBeanException
+  {
+    super(RuntimeMXBean.class);
+  }
+
+  public String getBootClassPath()
+  {
+    checkMonitorPermissions();
+    if (isBootClassPathSupported())
+      return bootClassPath;
+    else
+      throw
+	new UnsupportedOperationException("Retrieving the boot " +
+					  "classpath is not supported.");
+  }
+
+  public String getClassPath()
+  {
+    return System.getProperty("java.class.path");
+  }
+
+  public List getInputArguments()
+  {
+    checkMonitorPermissions();
+    return Arrays.asList(VMRuntimeMXBeanImpl.getInputArguments());
+  }
+
+  public String getLibraryPath()
+  {
+    return System.getProperty("java.library.path");
+  }
+
+  public String getManagementSpecVersion()
+  {
+    return "1.0";
+  }
+
+  public String getName()
+  {
+    return VMRuntimeMXBeanImpl.getName();
+  }
+
+  public String getSpecName()
+  {
+    return System.getProperty("java.vm.specification.name");
+  }
+
+  public String getSpecVendor()
+  {
+    return System.getProperty("java.vm.specification.vendor");
+  }
+
+  public String getSpecVersion()
+  {
+    return System.getProperty("java.vm.specification.version");
+  }
+
+  public long getStartTime()
+  {
+    if (startTime == -1)
+      startTime = VMRuntimeMXBeanImpl.getStartTime();
+    return startTime;
+  }
+
+  public Map getSystemProperties()
+  {
+    Map map = new HashMap();
+    Properties props = System.getProperties();
+    Iterator entries = props.entrySet().iterator();
+    while (entries.hasNext())
+      {
+	Map.Entry next = (Map.Entry) entries.next();
+	Object key = next.getKey();
+	Object value = next.getValue();
+	if (key instanceof String &&
+	    value instanceof String)
+	  map.put(key, value);
+      }
+    return map;
+  }
+  
+  public long getUptime()
+  {
+    return new Date().getTime() - getStartTime();
+  }
+
+  public String getVmName()
+  {
+    return System.getProperty("java.vm.name");
+  }
+
+  public String getVmVendor()
+  {
+    return System.getProperty("java.vm.vendor");
+  }
+
+  public String getVmVersion()
+  {
+    return System.getProperty("java.vm.version");
+  }
+
+  public boolean isBootClassPathSupported()
+  {
+    if (bootClassPath == null)
+      {
+	bootClassPath = SystemProperties.getProperty(JAVA_BOOT_CLASS_PATH);
+	if (bootClassPath == null)
+	  bootClassPath = SystemProperties.getProperty(SUN_BOOT_CLASS_PATH);
+	if (bootClassPath == null)
+	  bootClassPathSupported = false;
+      }
+    return bootClassPathSupported;
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/ThreadMXBeanImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,291 @@
+/* ThreadMXBeanImpl.java - Implementation of a thread bean
+   Copyright (C) 2006 Free Software Foundation
+
+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 gnu.java.lang.management;
+
+import gnu.classpath.SystemProperties;
+
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+import javax.management.NotCompliantMBeanException;
+
+/**
+ * Provides access to information about the threads 
+ * of the virtual machine.  An instance of this bean is
+ * obtained by calling
+ * {@link ManagementFactory#getThreadMXBean()}.
+ * See {@link java.lang.management.ThreadMXBean} for
+ * full documentation.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public final class ThreadMXBeanImpl
+  extends BeanImpl
+  implements ThreadMXBean
+{
+
+  /**
+   * Constant for current thread time support.
+   */
+  private static final String CURRENT_THREAD_TIME_SUPPORT = 
+    "gnu.java.lang.management.CurrentThreadTimeSupport";
+
+  /**
+   * Constant for thread time support.
+   */
+  private static final String THREAD_TIME_SUPPORT = 
+    "gnu.java.lang.management.ThreadTimeSupport";
+
+  /**
+   * Constant for thread contention support.
+   */
+  private static final String CONTENTION_SUPPORT = 
+    "gnu.java.lang.management.ThreadContentionSupport";
+
+  /**
+   * Constant for initial value of thread time support.
+   */
+  private static final String TIME_ENABLED = 
+    "gnu.java.lang.management.ThreadTimeInitallyEnabled";
+  
+  /**
+   * Flag to indicate whether time monitoring is enabled or not.
+   */
+  private boolean timeEnabled;
+
+  /**
+   * Flag to indicate whether contention monitoring is enabled or not.
+   */
+  private boolean contentionEnabled;
+
+  /**
+   * Default constructor to set up flag states.  The
+   * VM has to specify whether time monitoring is initially
+   * enabled or not.
+   *
+   * @throws NotCompliantMBeanException if this class doesn't implement
+   *                                    the interface or a method appears
+   *                                    in the interface that doesn't comply
+   *                                    with the naming conventions.
+   */
+  public ThreadMXBeanImpl()
+    throws NotCompliantMBeanException
+  {
+    super(ThreadMXBean.class);
+    timeEnabled = Boolean.parseBoolean(SystemProperties.getProperty(TIME_ENABLED));
+    contentionEnabled = false;
+  }
+
+  public long[] findMonitorDeadlockedThreads()
+  {
+    checkMonitorPermissions();
+    return VMThreadMXBeanImpl.findMonitorDeadlockedThreads();
+  }
+
+  public long[] getAllThreadIds()
+  {
+    checkMonitorPermissions();
+    return VMThreadMXBeanImpl.getAllThreadIds();
+  }
+
+  public long getCurrentThreadCpuTime()
+  {
+    if (!isCurrentThreadCpuTimeSupported())
+      throw new UnsupportedOperationException("Current thread CPU " +
+					      "time not supported.");
+    if (!timeEnabled)
+      return -1;
+    return VMThreadMXBeanImpl.getCurrentThreadCpuTime();
+  }
+
+  public long getCurrentThreadUserTime()
+  {
+    if (!isCurrentThreadCpuTimeSupported())
+      throw new UnsupportedOperationException("Current thread user " +
+					      "time not supported.");
+    if (!timeEnabled)
+      return -1;
+    return VMThreadMXBeanImpl.getCurrentThreadUserTime();
+  }
+
+  public int getDaemonThreadCount()
+  {
+    return VMThreadMXBeanImpl.getDaemonThreadCount();
+  }
+
+  public int getPeakThreadCount()
+  {
+    return VMThreadMXBeanImpl.getPeakThreadCount();
+  }
+
+  public int getThreadCount()
+  {
+    return VMThreadMXBeanImpl.getThreadCount();
+  }
+
+  public long getThreadCpuTime(long id)
+  {
+    if (!isThreadCpuTimeSupported())
+      throw new UnsupportedOperationException("Thread CPU time not " +
+					      "supported.");
+    if (id <= 0)
+      throw new IllegalArgumentException("Invalid thread id: " + id);
+    if (!timeEnabled)
+      return -1;
+    return VMThreadMXBeanImpl.getThreadCpuTime(id);
+  }
+
+  public ThreadInfo getThreadInfo(long id)
+  {
+    return getThreadInfo(id, 0);
+  }
+
+  public ThreadInfo[] getThreadInfo(long[] ids)
+  {
+    return getThreadInfo(ids, 0);
+  }
+
+  public ThreadInfo getThreadInfo(long id, int maxDepth)
+  {
+    checkMonitorPermissions();
+    if (id <= 0)
+      throw new IllegalArgumentException("Invalid thread id: " + id);
+    if (maxDepth < 0)
+      throw new IllegalArgumentException("Invalid depth: " + maxDepth);
+    return VMThreadMXBeanImpl.getThreadInfoForId(id, maxDepth);
+  }
+
+  public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth)
+  {
+    checkMonitorPermissions();
+    if (maxDepth < 0)
+      throw new IllegalArgumentException("Invalid depth: " + maxDepth);
+    ThreadInfo[] infos = new ThreadInfo[ids.length];
+    for (int a = 0; a < ids.length; ++a)
+      {
+	if (ids[a] <= 0)
+	  throw new IllegalArgumentException("Invalid thread id " + a +
+					     ": " + ids[a]);
+	infos[a] = VMThreadMXBeanImpl.getThreadInfoForId(ids[a], maxDepth);
+      }
+    return infos;
+  }
+
+  public long getThreadUserTime(long id)
+  {
+    if (!isThreadCpuTimeSupported())
+      throw new UnsupportedOperationException("Thread user time not " +
+					      "supported.");
+    if (id <= 0)
+      throw new IllegalArgumentException("Invalid thread id: " + id);
+    if (!timeEnabled)
+      return -1;
+    return VMThreadMXBeanImpl.getThreadUserTime(id);
+  }
+
+  public long getTotalStartedThreadCount()
+  {
+    return VMThreadMXBeanImpl.getTotalStartedThreadCount();
+  }
+
+  public boolean isCurrentThreadCpuTimeSupported()
+  {
+    if (isThreadCpuTimeSupported())
+      return true;
+    return SystemProperties.getProperty(CURRENT_THREAD_TIME_SUPPORT) != null;
+  }
+
+  public boolean isThreadContentionMonitoringEnabled()
+  {
+    if (isThreadContentionMonitoringSupported())
+      return contentionEnabled;
+    else
+      throw new UnsupportedOperationException("Contention monitoring " +
+					      "not supported.");
+  }
+
+  public boolean isThreadContentionMonitoringSupported()
+  {
+    return SystemProperties.getProperty(CONTENTION_SUPPORT) != null;
+  }
+
+  public boolean isThreadCpuTimeEnabled()
+  {
+    if (isThreadCpuTimeSupported() ||
+	isCurrentThreadCpuTimeSupported())
+      return timeEnabled;
+    else
+      throw new UnsupportedOperationException("Thread time not " +
+					      "supported.");
+  }
+  
+  public boolean isThreadCpuTimeSupported()
+  {
+    return SystemProperties.getProperty(THREAD_TIME_SUPPORT) != null;
+  }
+
+  public void resetPeakThreadCount()
+  {
+    checkControlPermissions();
+    VMThreadMXBeanImpl.resetPeakThreadCount();
+  }
+  
+  public void setThreadContentionMonitoringEnabled(boolean enable)
+  {
+    checkControlPermissions();
+    if (isThreadContentionMonitoringSupported())
+      contentionEnabled = enable;
+    else
+      throw new UnsupportedOperationException("Contention monitoring " +
+					      "not supported.");
+  }    
+  
+  public void setThreadCpuTimeEnabled(boolean enable)
+  {
+    checkControlPermissions();
+    if (isThreadCpuTimeSupported() ||
+	isCurrentThreadCpuTimeSupported())
+      timeEnabled = enable;
+    else
+      throw new UnsupportedOperationException("Thread time not " +
+					      "supported.");
+  }
+
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/management/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.lang.management package.
+   Copyright (C) 2006 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.lang.management</title></head>
+
+<body>
+<p>GNU implementations of the Java system management beans.</p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.lang package.
+   Copyright (C) 2005 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.java.lang</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/ClassSignatureParser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/ClassSignatureParser.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/ClassSignatureParser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/ClassSignatureParser.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,92 @@
+/* ClassSignatureParser.java
+   Copyright (C) 2005
+   Free Software Foundation
+
+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 gnu.java.lang.reflect;
+
+import java.lang.reflect.*;
+import java.util.ArrayList;
+
+public class ClassSignatureParser extends GenericSignatureParser
+{
+    private TypeVariable[] typeParameters;
+    private Type superclassType;
+    private Type[] interfaceTypes;
+
+    public ClassSignatureParser(Class c, String signature)
+    {
+        super(c, c.getClassLoader(), signature);
+
+        if (peekChar() == '<')
+        {
+            typeParameters = readFormalTypeParameters();
+        }
+        else
+        {
+            typeParameters = new TypeVariable[0];
+        }
+        // SuperclassSignature
+        superclassType = readClassTypeSignature();
+        ArrayList interfaces = new ArrayList();
+        while (peekChar() == 'L')
+        {
+            // SuperinterfaceSignature
+            interfaces.add(readClassTypeSignature());
+        }
+        interfaceTypes = new Type[interfaces.size()];
+        interfaces.toArray(interfaceTypes);
+        end();
+    }
+
+    public TypeVariable[] getTypeParameters()
+    {
+        TypeImpl.resolve(typeParameters);
+        return typeParameters;
+    }
+
+    public Type getSuperclassType()
+    {
+        superclassType = TypeImpl.resolve(superclassType);
+        return superclassType;
+    }
+
+    public Type[] getInterfaceTypes()
+    {
+        TypeImpl.resolve(interfaceTypes);
+        return interfaceTypes;
+    }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/FieldSignatureParser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/FieldSignatureParser.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/FieldSignatureParser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/java/lang/reflect/FieldSignatureParser.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,103 @@
+/* FieldSignatureParser.java
+   Copyright (C) 2005
+   Free Software Foundation
+
+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 gnu.java.lang.reflect;
+
+import java.lang.reflect.GenericSignatureFormatError;
+import java.lang.reflect.Type;
+
+public final class FieldSignatureParser extends GenericSignatureParser
+{
+    private Type type;
+
+    public FieldSignatureParser(Class container, String signature)
+    {
+        super(container, container.getClassLoader(), signature);
+
+        switch (peekChar())
+        {
+            case 'L':
+            case '[':
+            case 'T':
+                type = readFieldTypeSignature();
+                break;
+            case 'Z':
+                consume('Z');
+                type = boolean.class;
+                break;
+            case 'B':
+                consume('B');
+                type = byte.class;
+                break;
+            case 'S':
+                consume('S');
+                type = short.class;
+                break;
+            case 'C':
+                consume('C');
+                type = char.class;
+                break;
+            case 'I':
+                consume('I');
+                type = int.class;
+                break;
+            case 'F':
+                consume('F');
+                type = float.class;
+                break;
+            case 'J':
+                consume('J');
+                type = long.class;
+                break;
+            case 'D':
+                consume('D');
+                type = double.class;
+                break;
+            default:
+                throw new GenericSignatureFormatError();
+        }
+
+        end();
+    }
+
+    public Type getFieldType()
+    {
+        type = TypeImpl.resolve(type);
+        return type;
+    }
+}





More information about the llvm-commits mailing list