jdonohue    00/03/17 13:45:19

  Modified:    c/src/XSLT NumeratorFormatter.cpp
  Log:
  Fixed problems with tokenizing format string
  
  Revision  Changes    Path
  1.5       +22 -19    xml-xalan/c/src/XSLT/NumeratorFormatter.cpp
  
  Index: NumeratorFormatter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NumeratorFormatter.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NumeratorFormatter.cpp    2000/02/29 20:54:23     1.4
  +++ NumeratorFormatter.cpp    2000/03/17 21:45:18     1.5
  @@ -558,19 +558,23 @@
   
        const int       start = m_currentPosition;
   
  -     while ((m_currentPosition < m_maxPosition) && 
  -                isLetterOrDigit(charAt(m_str, m_currentPosition))) 
  +     if (isLetterOrDigit(charAt(m_str, m_currentPosition)))
        {
  -             m_currentPosition++;
  +             while ((m_currentPosition < m_maxPosition) &&
  +                             isLetterOrDigit(charAt(m_str, 
m_currentPosition))) 
  +                     m_currentPosition++;
        }
  -
  -     if ((start == m_currentPosition) &&
  -             (!isLetterOrDigit(charAt(m_str, m_currentPosition)))) 
  +     else
        {
  -             m_currentPosition++;
  +             while ((m_currentPosition < m_maxPosition) &&
  +                             !isLetterOrDigit(charAt(m_str, 
m_currentPosition))) 
  +                     m_currentPosition++;
        }
   
  -     return substring(m_str, start, m_currentPosition);
  +     // @@ This didn't seem to be working right when start=current=0
  +     // return substring(m_str, start, m_currentPosition);
  +     DOMString sub = substring(m_str, start, m_currentPosition);
  +     return DOMString(toCharArray(sub), m_currentPosition-start);
   }
   
   
  @@ -581,24 +585,23 @@
        int     count = 0;
        int     currpos = m_currentPosition;
   
  +     // Tokens consist of sequences of alphabetic characters and sequences of
  +     // non-alphabetic characters
        while (currpos < m_maxPosition) 
        {
  -             const int       start = currpos;
  -
  -             while ((currpos < m_maxPosition) &&
  -                             isLetterOrDigit(charAt(m_str, currpos))) 
  +             if (isLetterOrDigit(charAt(m_str, currpos)))
                {
  -                     currpos++;
  +                     while ((currpos < m_maxPosition) &&
  +                                     isLetterOrDigit(charAt(m_str, 
currpos))) 
  +                             currpos++;
                }
  -
  -             if ((start == currpos) &&
  -                     (isLetterOrDigit(charAt(m_str, currpos)) == false)) 
  +             else
                {
  -                     currpos++;
  +                     while ((currpos < m_maxPosition) &&
  +                                     !isLetterOrDigit(charAt(m_str, 
currpos))) 
  +                             currpos++;
                }
  -
                count++;
        }
  -
        return count;
   }
  
  
  

Reply via email to