Changeset 13663 in webkit


Ignore:
Timestamp:
Apr 3, 2006, 4:49:39 PM (19 years ago)
Author:
staikos
Message:

Reviewed by Maciej.

Implement a unicode abstraction layer to make JavaScriptCore much more
easily ported to other platforms without having to take in libicu. Also
makes the unicode related code easier to understand.

Location:
trunk/JavaScriptCore
Files:
9 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r13658 r13663  
     12006-04-03  George Staikos   <[email protected]>
     2
     3        Reviewed by Maciej.
     4
     5        Implement a unicode abstraction layer to make JavaScriptCore much more
     6        easily ported to other platforms without having to take in libicu.  Also
     7        makes the unicode related code easier to understand.
     8
    192006-04-03  Timothy Hatcher  <[email protected]>
    210
  • trunk/JavaScriptCore/kjs/function.cpp

    r13603 r13663  
    4141#include <ctype.h>
    4242
    43 #include <unicode/uchar.h>
     43#include <kxmlcore/unicode/Unicode.h>
    4444
    4545namespace KJS {
     
    662662            return true;
    663663        default:
    664             return u_charType(c) == U_SPACE_SEPARATOR;
     664            return KXMLCore::Unicode::isSeparatorSpace(c);
    665665    }
    666666}
  • trunk/JavaScriptCore/kjs/lexer.cpp

    r13203 r13663  
    3838#include "lookup.h"
    3939#include "internal.h"
    40 #include <unicode/uchar.h>
     40#include <kxmlcore/unicode/Unicode.h>
    4141
    4242static bool isDecimalDigit(unsigned short c);
     
    138138      }
    139139      next3 = code[pos++].uc;
    140     } while (u_charType(next3) == U_FORMAT_CHAR);
     140    } while (KXMLCore::Unicode::isFormatChar(next3));
    141141  }
    142142}
     
    573573bool Lexer::isWhiteSpace() const
    574574{
    575   return (current == '\t' || current == 0x0b || current == 0x0c || u_charType(current) == U_SPACE_SEPARATOR);
     575  return current == '\t' || current == 0x0b || current == 0x0c || KXMLCore::Unicode::isSeparatorSpace(current);
    576576}
    577577
     
    589589bool Lexer::isIdentStart(unsigned short c)
    590590{
    591   return (U_GET_GC_MASK(c) & (U_GC_L_MASK | U_GC_NL_MASK)) || c == '$' || c == '_';
     591  return (KXMLCore::Unicode::category(c) & (KXMLCore::Unicode::Letter_Uppercase
     592        | KXMLCore::Unicode::Letter_Lowercase
     593        | KXMLCore::Unicode::Letter_Titlecase
     594        | KXMLCore::Unicode::Letter_Modifier
     595        | KXMLCore::Unicode::Letter_Other))
     596    || c == '$' || c == '_';
    592597}
    593598
    594599bool Lexer::isIdentPart(unsigned short c)
    595600{
    596   return (U_GET_GC_MASK(c) & (U_GC_L_MASK | U_GC_NL_MASK | U_GC_MN_MASK | U_GC_MC_MASK | U_GC_ND_MASK | U_GC_PC_MASK)) || c == '$' || c == '_';
     601  return (KXMLCore::Unicode::category(c) & (KXMLCore::Unicode::Letter_Uppercase
     602        | KXMLCore::Unicode::Letter_Lowercase
     603        | KXMLCore::Unicode::Letter_Titlecase
     604        | KXMLCore::Unicode::Letter_Modifier
     605        | KXMLCore::Unicode::Letter_Other
     606        | KXMLCore::Unicode::Mark_NonSpacing
     607        | KXMLCore::Unicode::Mark_SpacingCombining
     608        | KXMLCore::Unicode::Number_DecimalDigit
     609        | KXMLCore::Unicode::Punctuation_Connector))
     610    || c == '$' || c == '_';
    597611}
    598612
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r13541 r13663  
    4545using std::max;
    4646
    47 #include <unicode/uchar.h>
     47#include <kxmlcore/unicode/Unicode.h>
    4848
    4949namespace KJS {
     
    145145UChar UChar::toLower() const
    146146{
    147   return static_cast<unsigned short>(u_tolower(uc));
     147  return KXMLCore::Unicode::toLower(uc);
    148148}
    149149
    150150UChar UChar::toUpper() const
    151151{
    152   return static_cast<unsigned short>(u_toupper(uc));
     152  return KXMLCore::Unicode::toUpper(uc);
    153153}
    154154
  • trunk/JavaScriptCore/kxmlcore/Platform.h

    r13154 r13663  
    150150#if PLATFORM(MAC)
    151151#define KXMLCORE_USE_MULTIPLE_THREADS 1
     152#define KXMLCORE_USE_ICU_UNICODE 1
     153#endif
     154
     155#if PLATFORM(KDE)
     156#define KXMLCORE_USE_QT4_UNICODE 1
    152157#endif
    153158
Note: See TracChangeset for help on using the changeset viewer.