[kaffe] CVS kaffe (guilhem): More java.text fixes.

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Wed Mar 24 12:39:02 2004


PatchSet 4572 
Date: 2004/03/24 20:23:53
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
More java.text fixes.

        * kaffe/kaffevm/mem/gc-incremental.c: Fixed typo.

        * libraries/javalib/java/text/SimpleDateFormat.java
        (formatWithAttribute): Fixed FieldPosition interpretation.

        * libraries/javalib/java/text/FieldPosition.java
        (FieldPosition): Fixed constructor as in spec.

        * libraries/javalib/gnu/java/text/FormatBuffer.java,
        libraries/javalib/gnu/java/text/AttributedFormatBuffer.java,
        libraries/javalib/gnu/java/text/StringFormatBuffer.java:
        (getDefaultAttribute): New method.

Members: 
	ChangeLog:1.2150->1.2151 
	kaffe/kaffevm/mem/gc-incremental.c:1.73->1.74 
	libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.2->1.3 
	libraries/javalib/gnu/java/text/FormatBuffer.java:1.2->1.3 
	libraries/javalib/gnu/java/text/StringFormatBuffer.java:1.2->1.3 
	libraries/javalib/java/text/FieldPosition.java:1.10->1.11 
	libraries/javalib/java/text/SimpleDateFormat.java:1.31->1.32 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2150 kaffe/ChangeLog:1.2151
--- kaffe/ChangeLog:1.2150	Wed Mar 24 20:08:10 2004
+++ kaffe/ChangeLog	Wed Mar 24 20:23:53 2004
@@ -1,3 +1,18 @@
+2004-03-24  Guilhem Lavaux <guilhem@kaffe.org>
+
+	* kaffe/kaffevm/mem/gc-incremental.c: Fixed typo.
+
+	* libraries/javalib/java/text/SimpleDateFormat.java
+	(formatWithAttribute): Fixed FieldPosition interpretation.
+
+	* libraries/javalib/java/text/FieldPosition.java
+	(FieldPosition): Fixed constructor as in spec.
+
+	* libraries/javalib/gnu/java/text/FormatBuffer.java,
+	libraries/javalib/gnu/java/text/AttributedFormatBuffer.java,
+	libraries/javalib/gnu/java/text/StringFormatBuffer.java:
+	(getDefaultAttribute): New method.
+
 2004-03-24  Dalibor Topic <robilad@kaffe.org>
 
 	* include/kaffe/jmalloc.h:
Index: kaffe/kaffe/kaffevm/mem/gc-incremental.c
diff -u kaffe/kaffe/kaffevm/mem/gc-incremental.c:1.73 kaffe/kaffe/kaffevm/mem/gc-incremental.c:1.74
--- kaffe/kaffe/kaffevm/mem/gc-incremental.c:1.73	Fri Mar 19 18:03:04 2004
+++ kaffe/kaffe/kaffevm/mem/gc-incremental.c	Wed Mar 24 20:23:57 2004
@@ -621,7 +621,7 @@
 			dprintf(
 			    "<GC: heap %dK, total before %dK,"
 			    " after %dK (%d/%d objs)\n %2.1f%% free,"
-			    " alloced %dK (#%d), marked %dK, "
+			    " allocated %dK (#%d), marked %dK, "
 			    "swept %dK (#%d)\n"
 			    " %d objs (%dK) awaiting finalization>\n",
 			(int)(gc_heap_total/1024), 
Index: kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java
diff -u kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.2 kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.3
--- kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java:1.2	Mon Mar 22 11:24:26 2004
+++ kaffe/libraries/javalib/gnu/java/text/AttributedFormatBuffer.java	Wed Mar 24 20:23:58 2004
@@ -154,6 +154,11 @@
     startingRange = currentPos;
   }
 
+  public AttributedCharacterIterator.Attribute getDefaultAttribute()
+  {
+    return defaultAttr;
+  }
+
   public void cutTail(int length)
   {
     buffer.setLength(buffer.length()-length);
Index: kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java
diff -u kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java:1.2 kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java:1.3
--- kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java:1.2	Mon Mar 22 11:24:26 2004
+++ kaffe/libraries/javalib/gnu/java/text/FormatBuffer.java	Wed Mar 24 20:23:58 2004
@@ -47,6 +47,7 @@
   public void append(char c);
   public void append(char c, AttributedCharacterIterator.Attribute attr);
   public void setDefaultAttribute(AttributedCharacterIterator.Attribute attr);
+  public AttributedCharacterIterator.Attribute getDefaultAttribute();
   public void cutTail(int length);
   public void clear();
 
Index: kaffe/libraries/javalib/gnu/java/text/StringFormatBuffer.java
diff -u kaffe/libraries/javalib/gnu/java/text/StringFormatBuffer.java:1.2 kaffe/libraries/javalib/gnu/java/text/StringFormatBuffer.java:1.3
--- kaffe/libraries/javalib/gnu/java/text/StringFormatBuffer.java:1.2	Mon Mar 22 11:24:27 2004
+++ kaffe/libraries/javalib/gnu/java/text/StringFormatBuffer.java	Wed Mar 24 20:23:58 2004
@@ -42,6 +42,7 @@
 public class StringFormatBuffer implements FormatBuffer
 {
   private StringBuffer buffer;
+  private AttributedCharacterIterator.Attribute defaultAttr;
 
   public StringFormatBuffer(int prebuffer)
   {
@@ -80,6 +81,12 @@
 
   public void setDefaultAttribute(AttributedCharacterIterator.Attribute attr)
   {
+    defaultAttr = attr;
+  }
+
+  public AttributedCharacterIterator.Attribute getDefaultAttribute()
+  {
+    return defaultAttr;
   }
 
   public void cutTail(int length)
Index: kaffe/libraries/javalib/java/text/FieldPosition.java
diff -u kaffe/libraries/javalib/java/text/FieldPosition.java:1.10 kaffe/libraries/javalib/java/text/FieldPosition.java:1.11
--- kaffe/libraries/javalib/java/text/FieldPosition.java:1.10	Sat Jan  3 03:45:26 2004
+++ kaffe/libraries/javalib/java/text/FieldPosition.java	Wed Mar 24 20:23:59 2004
@@ -72,13 +72,13 @@
   /**
    * This method initializes a new instance of <code>FieldPosition</code>
    * to have the specified field attribute. The attribute will be used as
-   * an id.
+   * an id. It is formally equivalent to calling FieldPosition(field, -1).
    *
    * @param field The field format attribute.
    */
   public FieldPosition (Format.Field field)
   {
-    this.field_attribute = field;
+    this(field, -1);
   }
 
   /**
Index: kaffe/libraries/javalib/java/text/SimpleDateFormat.java
diff -u kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.31 kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.32
--- kaffe/libraries/javalib/java/text/SimpleDateFormat.java:1.31	Mon Mar 22 11:25:05 2004
+++ kaffe/libraries/javalib/java/text/SimpleDateFormat.java	Wed Mar 24 20:23:59 2004
@@ -534,7 +534,8 @@
 	      default:
 		throw new IllegalArgumentException ("Illegal pattern character " + p.field);
 	      }
-	    if (pos != null && p.field == pos.getField())
+	    if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute()
+				|| p.field == pos.getField()))
 	      {
 		pos.setBeginIndex(beginIndex);
 		pos.setEndIndex(buffer.length());