home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nlsnps.zip / nlsCompare.cpp < prev    next >
C/C++ Source or Header  |  1996-09-03  |  476b  |  22 lines

  1. #define INCL_DOSNLS
  2. #include <os2.h>
  3. #include "nls.h"
  4.  
  5. int nlsCompare(PUCHAR psz1, PUCHAR psz2)
  6. {  while (1)
  7.    {  UCHAR uc1 = *psz1++, uc2 = *psz2++;
  8.  
  9.       if (uc1 != uc2)
  10.       {  int iDiff = (UINT)nlsCollate(uc1) - (UINT)nlsCollate(uc2);
  11.      if (iDiff != 0) return iDiff;
  12.       }
  13.       else
  14.       {  if (uc1 == 0) return 0;
  15.      else if (nlsIsDBCS(uc1))
  16.      {  int iDiff = (UINT)*psz1++ - (UINT)*psz2++;
  17.         if (iDiff != 0) return iDiff;
  18.      }
  19.       }
  20.    }
  21. }
  22.