dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.80, 1.81 int_table


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.80, 1.81 int_table.c, 1.83, 1.84 lib_string.c, 1.33, 1.34
Date: Fri, 29 Aug 2003 00:26:58 -0400

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv26578/engine

Modified Files:
        int_proto.h int_table.c lib_string.c 
Log Message:


Implement the "String.CompareInternal" internalcall in terms
of the Unicode comparison support routines.


Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -C2 -r1.80 -r1.81
*** int_proto.h 23 Aug 2003 10:39:13 -0000      1.80
--- int_proto.h 29 Aug 2003 04:26:55 -0000      1.81
***************
*** 74,78 ****
  extern ILInt32 _IL_String_IndexOf(ILExecThread * _thread, System_String * 
_this, ILUInt16 _p1, ILInt32 _p2, ILInt32 _p3);
  extern ILInt32 _IL_String_InternalOrdinal(ILExecThread * _thread, 
System_String * _p1, ILInt32 _p2, ILInt32 _p3, System_String * _p4, ILInt32 
_p5, ILInt32 _p6);
- extern ILInt32 _IL_String_InternalCompare(ILExecThread * _thread, 
System_String * _p1, ILInt32 _p2, ILInt32 _p3, System_String * _p4, ILInt32 
_p5, ILInt32 _p6, ILBool _p7, ILObject * _p8);
  extern System_String * _IL_String_Trim(ILExecThread * _thread, System_String 
* _this, System_Array * _p1, ILInt32 _p2);
  extern System_String * _IL_String_ctor_pcii(ILExecThread * _thread, ILUInt16 
* _p1, ILInt32 _p2, ILInt32 _p3);
--- 74,77 ----
***************
*** 82,85 ****
--- 81,85 ----
  extern System_String * _IL_String_ctor_pb(ILExecThread * _thread, ILInt8 * 
_p1);
  extern ILInt32 _IL_String_Compare(ILExecThread * _thread, System_String * 
_p1, System_String * _p2);
+ extern ILInt32 _IL_String_CompareInternal(ILExecThread * _thread, 
System_String * _p1, ILInt32 _p2, ILInt32 _p3, System_String * _p4, ILInt32 
_p5, ILInt32 _p6, ILBool _p7);
  extern System_String * _IL_String_NewBuilder(ILExecThread * _thread, 
System_String * _p1, ILInt32 _p2);
  extern void _IL_String_Copy_StringiString(ILExecThread * _thread, 
System_String * _p1, ILInt32 _p2, System_String * _p3);

Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -r1.83 -r1.84
*** int_table.c 23 Aug 2003 10:39:13 -0000      1.83
--- int_table.c 29 Aug 2003 04:26:55 -0000      1.84
***************
*** 411,417 ****
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_ippiipiibp(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, void *, ILInt32, 
ILInt32, void *, ILInt32, ILInt32, ILInt8, void *))fn)(*((void * 
*)(avalue[0])), *((void * *)(avalue[1])), *((ILInt32 *)(avalue[2])), *((ILInt32 
*)(avalue[3])), *((void * *)(avalue[4])), *((ILInt32 *)(avalue[5])), *((ILInt32 
*)(avalue[6])), *((ILInt8 *)(avalue[7])), *((void * *)(avalue[8])));
  }
  
--- 411,417 ----
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_ppppi(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((void * *)rvalue) = (*(void * (*)(void *, void *, void *, 
ILInt32))fn)(*((void * *)(avalue[0])), *((void * *)(avalue[1])), *((void * 
*)(avalue[2])), *((ILInt32 *)(avalue[3])));
  }
  
***************
*** 420,426 ****
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_ppppi(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((void * *)rvalue) = (*(void * (*)(void *, void *, void *, 
ILInt32))fn)(*((void * *)(avalue[0])), *((void * *)(avalue[1])), *((void * 
*)(avalue[2])), *((ILInt32 *)(avalue[3])));
  }
  
--- 420,426 ----
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_pppiip(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((void * *)rvalue) = (*(void * (*)(void *, void *, ILInt32, ILInt32, 
void *))fn)(*((void * *)(avalue[0])), *((void * *)(avalue[1])), *((ILInt32 
*)(avalue[2])), *((ILInt32 *)(avalue[3])), *((void * *)(avalue[4])));
  }
  
***************
*** 429,435 ****
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_pppiip(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((void * *)rvalue) = (*(void * (*)(void *, void *, ILInt32, ILInt32, 
void *))fn)(*((void * *)(avalue[0])), *((void * *)(avalue[1])), *((ILInt32 
*)(avalue[2])), *((ILInt32 *)(avalue[3])), *((void * *)(avalue[4])));
  }
  
--- 429,435 ----
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_ippiipiib(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, void *, ILInt32, 
ILInt32, void *, ILInt32, ILInt32, ILInt8))fn)(*((void * *)(avalue[0])), 
*((void * *)(avalue[1])), *((ILInt32 *)(avalue[2])), *((ILInt32 *)(avalue[3])), 
*((void * *)(avalue[4])), *((ILInt32 *)(avalue[5])), *((ILInt32 *)(avalue[6])), 
*((ILInt8 *)(avalue[7])));
  }
  
***************
*** 512,516 ****
        IL_METHOD("IndexOf", "(Tcii)i", _IL_String_IndexOf, marshal_ippSii)
        IL_METHOD("InternalOrdinal", "(oSystem.String;iioSystem.String;ii)i", 
_IL_String_InternalOrdinal, marshal_ippiipii)
-       IL_METHOD("InternalCompare", 
"(oSystem.String;iioSystem.String;iiZoSystem.Globalization.CultureInfo;)i", 
_IL_String_InternalCompare, marshal_ippiipiibp)
        IL_METHOD("Trim", "(T[ci)oSystem.String;", _IL_String_Trim, 
marshal_ppppi)
        IL_CONSTRUCTOR(".ctor", "(T*cii)V", 0, 0, _IL_String_ctor_pcii, 
marshal_pppii)
--- 512,515 ----
***************
*** 520,523 ****
--- 519,523 ----
        IL_CONSTRUCTOR(".ctor", "(T*b)V", 0, 0, _IL_String_ctor_pb, marshal_ppp)
        IL_METHOD("Compare", "(oSystem.String;oSystem.String;)i", 
_IL_String_Compare, marshal_ippp)
+       IL_METHOD("CompareInternal", "(oSystem.String;iioSystem.String;iiZ)i", 
_IL_String_CompareInternal, marshal_ippiipiib)
        IL_METHOD("NewBuilder", "(oSystem.String;i)oSystem.String;", 
_IL_String_NewBuilder, marshal_pppi)
        IL_METHOD("Copy", "(oSystem.String;ioSystem.String;)V", 
_IL_String_Copy_StringiString, marshal_vppip)

Index: lib_string.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_string.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** lib_string.c        22 Jun 2003 01:20:35 -0000      1.33
--- lib_string.c        29 Aug 2003 04:26:55 -0000      1.34
***************
*** 352,357 ****
  /*
   * Compare two Unicode strings.
-  *
-  * TODO: replace this with something better and move to "support".
   */
  static int ILStrCmpUnicode(const ILUInt16 *str1, ILInt32 length1,
--- 352,355 ----
***************
*** 388,438 ****
  
  /*
-  * Compare two Unicode strings, while ignoring case.
-  *
-  * TODO: replace this with something better and move to "support".
-  */
- static int ILStrICmpUnicode(const ILUInt16 *str1, ILInt32 length1,
-                                                       const ILUInt16 *str2, 
ILInt32 length2)
- {
-       ILUInt16 ch1;
-       ILUInt16 ch2;
-       while(length1 > 0 && length2 > 0)
-       {
-               ch1 = *str1++;
-               ch2 = *str2++;
-               if(ch1 >= 'a' && ch1 <= 'z')
-               {
-                       ch1 = (ILUInt16)(ch1 - 'a' + 'A');
-               }
-               if(ch2 >= 'a' && ch2 <= 'z')
-               {
-                       ch2 = (ILUInt16)(ch2 - 'a' + 'A');
-               }
-               if(ch1 < ch2)
-               {
-                       return -1;
-               }
-               else if(ch1 > ch2)
-               {
-                       return 1;
-               }
-               --length1;
-               --length2;
-       }
-       if(length1 > 0)
-       {
-               return 1;
-       }
-       else if(length2 > 0)
-       {
-               return -1;
-       }
-       else
-       {
-               return 0;
-       }
- }
- 
- /*
   * public static int Compare(String strA, String strB);
   */
--- 386,389 ----
***************
*** 468,483 ****
  
  /*
!  * public static int InternalCompare(String strA, int indexA, int lengthA,
   *                                                                     String 
strB, int indexB, int lengthB,
!  *                                                                     bool 
ignoreCase, CultureInfo culture);
   */
! ILInt32 _IL_String_InternalCompare(ILExecThread *thread,
                                                                   
System_String *strA,
                                                                   ILInt32 
indexA, ILInt32 lengthA,
                                                                   
System_String *strB,
                                                                   ILInt32 
indexB, ILInt32 lengthB,
!                                                                  ILBool 
ignoreCase,
!                                                                  ILObject 
*culture)
  {
        /* Handle the easy cases first */
        if(!strA)
--- 419,435 ----
  
  /*
!  * public static int CompareInternal(String strA, int indexA, int lengthA,
   *                                                                     String 
strB, int indexB, int lengthB,
!  *                                                                     bool 
ignoreCase);
   */
! ILInt32 _IL_String_CompareInternal(ILExecThread *thread,
                                                                   
System_String *strA,
                                                                   ILInt32 
indexA, ILInt32 lengthA,
                                                                   
System_String *strB,
                                                                   ILInt32 
indexB, ILInt32 lengthB,
!                                                                  ILBool 
ignoreCase)
  {
+       int cmp;
+ 
        /* Handle the easy cases first */
        if(!strA)
***************
*** 497,507 ****
        }
  
-       /* TODO: handle culture information */
- 
        /* Compare the two strings */
        if(ignoreCase)
        {
!               return ILStrICmpUnicode(StringToBuffer(strA) + indexA, lengthA,
!                                                           
StringToBuffer(strB) + indexB, lengthB);
        }
        else
--- 449,486 ----
        }
  
        /* Compare the two strings */
        if(ignoreCase)
        {
!               if(lengthA >= lengthB)
!               {
!                       cmp = ILUnicodeStringCompare
!                                       (StringToBuffer(strA) + indexA,
!                                        StringToBuffer(strB) + indexB,
!                                        (unsigned long)(long)lengthB);
!                       if(cmp != 0)
!                       {
!                               return cmp;
!                       }
!                       if(lengthA > lengthB)
!                       {
!                               return 1;
!                       }
!                       else
!                       {
!                               return 0;
!                       }
!               }
!               else
!               {
!                       cmp = ILUnicodeStringCompare
!                                       (StringToBuffer(strA) + indexA,
!                                        StringToBuffer(strB) + indexB,
!                                        (unsigned long)(long)lengthA);
!                       if(cmp != 0)
!                       {
!                               return cmp;
!                       }
!                       return -1;
!               }
        }
        else
***************
*** 1565,1569 ****
                                                          ILString *strB)
  {
!       return (int)(_IL_String_InternalCompare
                                                (thread,
                                                 (System_String *)strA, 0,
--- 1544,1548 ----
                                                          ILString *strB)
  {
!       return (int)(_IL_String_CompareInternal
                                                (thread,
                                                 (System_String *)strA, 0,
***************
*** 1571,1575 ****
                                                 (System_String *)strB, 0,
                                                 ((strB != 0) ? ((System_String 
*)strB)->length : 0),
!                                                (ILBool)1, (void *)0));
  }
  
--- 1550,1554 ----
                                                 (System_String *)strB, 0,
                                                 ((strB != 0) ? ((System_String 
*)strB)->length : 0),
!                                                (ILBool)1));
  }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]