PatchSet 4793 
Date: 2004/05/29 17:01:16
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixes for java.text + a small cleanup for jthreads.

        * kaffe/kaffevm/systems/unix-jthreads/signal.c
        (nullException): Check whether currentJThread exists.

        * kaffe/kaffevm/systems/unix-jthreads/jthread.c
        (currentJThread): Set to NULL.

        * libraries/javalib/java/text/RuleBasedCollator.java
        (CollationElement.CollationElement): Removed unused constructor.
        New argument for the other one.
        (subParseString): Mark the element as ignorable but do not erase
        them from the database.
        (compare): Take into account the ignore field for ignorable
        elements.
        (buildCollationVector): Use the ignore field now.

        * libraries/javalib/java/text/CollationElementIterator.java
        (setText): Keep ignorable characters.

Members: 
        ChangeLog:1.2362->1.2363 
        kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.113->1.114 
        kaffe/kaffevm/systems/unix-jthreads/signal.c:1.17->1.18 
        libraries/javalib/java/text/CollationElementIterator.java:1.17->1.18 
        libraries/javalib/java/text/RuleBasedCollator.java:1.21->1.22 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2362 kaffe/ChangeLog:1.2363
--- kaffe/ChangeLog:1.2362      Fri May 28 13:40:09 2004
+++ kaffe/ChangeLog     Sat May 29 17:01:16 2004
@@ -1,6 +1,26 @@
+2004-05-29  Guilhem Lavaux <[EMAIL PROTECTED]>
+
+       * kaffe/kaffevm/systems/unix-jthreads/signal.c
+       (nullException): Check whether currentJThread exists.
+
+       * kaffe/kaffevm/systems/unix-jthreads/jthread.c
+       (currentJThread): Set to NULL.
+
+       * libraries/javalib/java/text/RuleBasedCollator.java
+       (CollationElement.CollationElement): Removed unused constructor.
+       New argument for the other one.
+       (subParseString): Mark the element as ignorable but do not erase
+       them from the database.
+       (compare): Take into account the ignore field for ignorable
+       elements.
+       (buildCollationVector): Use the ignore field now.
+
+       * libraries/javalib/java/text/CollationElementIterator.java
+       (setText): Keep ignorable characters.
+       
 2004-05-27  Michael Franz  <[EMAIL PROTECTED]>
 
-       libraries/clib/awt/X/evt.c,
+       * libraries/clib/awt/X/evt.c,
        libraries/clib/awt/X/toolkit.h,
        libraries/clib/io/AudioPlayer.c,
        libraries/clib/io/File.c,
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.113 
kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.114
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.113   Thu Apr 22 16:28:16 
2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c Sat May 29 17:01:18 2004
@@ -113,7 +113,7 @@
 static int  max_priority;              /* maximum supported priority */
 static int  min_priority;              /* minimum supported priority */
 
-jthread* currentJThread;
+jthread* currentJThread = NULL;
 
 /* Context switch related functions */
 #ifndef JTHREAD_CONTEXT_SAVE
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.17 
kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.18
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c:1.17     Sun May  9 14:20:12 
2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/signal.c  Sat May 29 17:01:18 2004
@@ -97,9 +97,9 @@
 #if defined(STACK_POINTER)
        stackptr = (void *)STACK_POINTER(GET_SIGNAL_CONTEXT_POINTER(ctx));
 #if defined(STACK_GROWS_UP)
-       if (stackptr >= currentJThread->stackEnd)
+       if (currentJThread != NULL && stackptr >= currentJThread->stackEnd)
 #else
-       if (stackptr <= currentJThread->stackBase)
+       if (currentJThread != NULL && stackptr <= currentJThread->stackBase)
 #endif
          stackOverflowHandler(EXCEPTIONFRAMEPTR);
        else
Index: kaffe/libraries/javalib/java/text/CollationElementIterator.java
diff -u kaffe/libraries/javalib/java/text/CollationElementIterator.java:1.17 
kaffe/libraries/javalib/java/text/CollationElementIterator.java:1.18
--- kaffe/libraries/javalib/java/text/CollationElementIterator.java:1.17        Sun 
May 16 16:45:15 2004
+++ kaffe/libraries/javalib/java/text/CollationElementIterator.java     Sat May 29 
17:01:18 2004
@@ -357,11 +357,8 @@
            /* Third case: the simplest. We have got the prefix and it
             * has not to be expanded.
             */
-           if (!prefix.ignore)
-             {
-               v.add (prefix);
-               vi.add (new Integer(idx_idx));
-             }
+           v.add (prefix);
+           vi.add (new Integer(idx_idx));
            idx += prefix.key.length();
            /* If the sequence is in an expansion, we must decrease the
             * counter.
Index: kaffe/libraries/javalib/java/text/RuleBasedCollator.java
diff -u kaffe/libraries/javalib/java/text/RuleBasedCollator.java:1.21 
kaffe/libraries/javalib/java/text/RuleBasedCollator.java:1.22
--- kaffe/libraries/javalib/java/text/RuleBasedCollator.java:1.21       Thu May 13 
19:18:21 2004
+++ kaffe/libraries/javalib/java/text/RuleBasedCollator.java    Sat May 29 17:01:18 
2004
@@ -158,22 +158,16 @@
     String expansion;
 
     CollationElement(String key, int primary, short secondary, short tertiary,
-                    short equality, String expansion)
+                    short equality, String expansion, boolean ignore)
     {
       this.key = key;
       this.primary = primary;
       this.secondary = secondary;
       this.tertiary = tertiary;
       this.equality = equality;
-      this.ignore = false;
+      this.ignore = ignore;
       this.expansion = expansion;
     }
-    
-    CollationElement(String key)
-    {
-      this.key = key;
-      this.ignore = true;
-    }
 
     final int getValue()
     {
@@ -196,13 +190,13 @@
     static final int GREATERT = 2;
     static final int EQUAL = 3;
     static final int RESET = 4;
-    static final int IGNORE = 5;
-    static final int INVERSE_SECONDARY = 6;
+    static final int INVERSE_SECONDARY = 5;
     
     int comparisonType;
     String textElement;
     int hashText;
     int offset;
+    boolean ignore;
 
     String expansionOrdering;
   }
@@ -250,7 +244,7 @@
    */
   static final CollationElement SPECIAL_UNKNOWN_SEQ = 
     new CollationElement("", (short) 32767, (short) 0, (short) 0,
-                        (short) 0, null);
+                        (short) 0, null, false);
   
   /**
    * This method initializes a new instance of <code>RuleBasedCollator</code>
@@ -447,26 +441,16 @@
          throw new ParseException
            ("Modifier '!' is not yet supported by Classpath", i+base_offset);
        case '<':
-         ignoreChars = false;
          type = CollationSorter.GREATERP;
          break;
        case ';':
-         if (!ignoreChars)
-           type = CollationSorter.GREATERS;
-         else
-           type = CollationSorter.IGNORE;
+         type = CollationSorter.GREATERS;
          break;
        case ',':
-         if (!ignoreChars)
-           type = CollationSorter.GREATERT;
-         else
-           type = CollationSorter.IGNORE;
+         type = CollationSorter.GREATERT;
          break;
        case '=':
-         if (!ignoreChars)
-           type = CollationSorter.EQUAL;
-         else
-           type = CollationSorter.IGNORE;
+         type = CollationSorter.EQUAL;
          break;
        case '\'':
          eatingChars = !eatingChars;
@@ -549,10 +533,14 @@
 
        CollationSorter sorter = new CollationSorter();
        
+       if (operator == CollationSorter.GREATERP)
+         ignoreChars = false;
+
        sorter.comparisonType = operator;
        sorter.textElement = sb.toString();
        sorter.hashText = sorter.textElement.hashCode();
        sorter.offset = base_offset+rules.length();
+       sorter.ignore = ignoreChars;
        sb.setLength(0);
 
        v.add(sorter);
@@ -568,10 +556,14 @@
            || (sb.length() == 0 && !nextIsModifier && !eatingChars))
          throw new ParseException("text element empty at " + pos, pos);
 
+       if (operator == CollationSorter.GREATERP)
+         ignoreChars = false;
+
        sorter.comparisonType = operator;
        sorter.textElement = sb.toString();
        sorter.hashText = sorter.textElement.hashCode();
        sorter.offset = base_offset+pos;
+       sorter.ignore = ignoreChars;
        v.add(sorter);
       }
 
@@ -674,8 +666,6 @@
              last_tertiary_seq = tertiary_seq;
            equality_seq = 0;
            break;
-         case CollationSorter.IGNORE:
-           ignoreChar = true;
          case CollationSorter.EQUAL:
            equality_seq++;
            break;
@@ -687,18 +677,9 @@
              ("Invalid unknown state '" + elt.comparisonType + "'", elt.offset);
          }
 
-       CollationElement e;
-
-       if (!ignoreChar)
-         {
-           e = new CollationElement(elt.textElement, primary_seq,
-                                    secondary_seq, tertiary_seq,
-                                    equality_seq, elt.expansionOrdering);
-         }
-       else
-         e = new CollationElement(elt.textElement);
-
-       v.add(e);
+       v.add(new CollationElement(elt.textElement, primary_seq,
+                                  secondary_seq, tertiary_seq,
+                                  equality_seq, elt.expansionOrdering, elt.ignore));
       }
 
     this.inverseAccentComparison = inverseComparisons; 
@@ -741,17 +722,45 @@
   public int compare(String source, String target)
   {
     CollationElementIterator cs, ct;
+    CollationElement ord1block = null;
+    CollationElement ord2block = null;
+    boolean advance_block_1 = true;
+    boolean advance_block_2 = true;
 
     cs = getCollationElementIterator(source);
     ct = getCollationElementIterator(target);
 
     for(;;)
       {
-        CollationElement ord1block = cs.nextBlock(); 
-        CollationElement ord2block = ct.nextBlock(); 
        int ord1;
        int ord2;
 
+       /*
+        * We have to check whether the characters are ignorable.
+        * If it is the case then forget them. 
+        */
+       if (advance_block_1)
+         {
+           ord1block = cs.nextBlock();
+           if (ord1block != null && ord1block.ignore)
+             continue;
+         }
+       
+       if (advance_block_2)
+         {
+           ord2block = ct.nextBlock();
+           if (ord2block != null && ord2block.ignore)
+             {
+               advance_block_1 = false;
+               continue;
+             }
+        }
+       else
+         advance_block_2 = true;
+
+       if (!advance_block_1)
+         advance_block_1 = true;
+
        if (ord1block != null)
          ord1 = ord1block.getValue();
        else
@@ -781,12 +790,12 @@
        
        if (prim1 == 0 && getStrength() < TERTIARY)
          {
-           ct.previousBlock();
+            advance_block_2 = false;
            continue;
          }
        else if (prim2 == 0 && getStrength() < TERTIARY)
          {
-           cs.previousBlock();
+           advance_block_1 = false;
            continue;
          }
 
@@ -861,7 +870,7 @@
     else
       v = (short) c;
     return new CollationElement("" + c, last_primary_value + v,
-                               (short) 0, (short) 0, (short) 0, null);
+                               (short) 0, (short) 0, (short) 0, null, false);
   }
 
   /**
@@ -883,7 +892,7 @@
     else
       v = (short) c;
     return new CollationElement("" + c, (short) 0,
-                               (short) 0, (short) (last_tertiary_value + v), (short) 
0, null);
+                               (short) 0, (short) (last_tertiary_value + v), (short) 
0, null, false);
   }
 
   /**
@@ -945,6 +954,13 @@
 
     while (ord != CollationElementIterator.NULLORDER)
       {
+       // If the primary order is null, it means this is an ignorable
+       // character.
+       if (CollationElementIterator.primaryOrder(ord) == 0)
+         {
+            ord = cei.next();
+           continue;
+         }
         switch (getStrength())
           {
             case PRIMARY:

_______________________________________________
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to