Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsCollationMac.cpp File Reference
#include "nsCollationMac.h"
#include <Resources.h>
#include <TextUtils.h>
#include <Script.h>
#include "prmem.h"
#include "prmon.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsILocaleService.h"
#include "nsLocaleCID.h"
#include "nsIPlatformCharset.h"
#include "nsIMacLocale.h"
#include "nsCOMPtr.h"

Go to the source code of this file.


static short mac_get_script_sort_id (const short scriptcode)
static int mac_sort_tbl_compare (const void *s1, const void *s2)
static int mac_sort_tbl_init (const short scriptcode, unsigned char *mac_sort_tbl)
unsigned char mac_sort_tbl_search (const unsigned char ch, const unsigned char *mac_sort_tbl)


static Handle itl2Handle

Function Documentation

static short mac_get_script_sort_id ( const short  scriptcode) [static]

Definition at line 55 of file nsCollationMac.cpp.

       short itl2num;
       ItlbRecord **ItlbRecordHandle;

       /* get itlb of the system script */
       ItlbRecordHandle = (ItlbRecord **) GetResource('itlb', scriptcode);
       /* get itl2 number of current system script from itlb if possible
        * otherwise, try script manager (Script manager won't update 
        * itl2 number when the change on the fly )
       if(ItlbRecordHandle != NULL)
              if(*ItlbRecordHandle == NULL)
              if(*ItlbRecordHandle != NULL)
                     itl2num = (*ItlbRecordHandle)->itlbSort;
                     itl2num = GetScriptVariable(scriptcode, smScriptSort);
       } else {      /* Use this as fallback */
              itl2num = GetScriptVariable(scriptcode, smScriptSort);
       return itl2num;

Here is the caller graph for this function:

static int mac_sort_tbl_compare ( const void s1,
const void s2 
) [static]

Definition at line 85 of file nsCollationMac.cpp.

       return CompareText((Ptr) s1, (Ptr) s2, 1, 1, itl2Handle);

Here is the caller graph for this function:

static int mac_sort_tbl_init ( const short  scriptcode,
unsigned char *  mac_sort_tbl 
) [static]

Definition at line 90 of file nsCollationMac.cpp.

       int i;
       unsigned char sort_tbl[256];
       for (i = 0; i < 256; i++)
              sort_tbl[i] = (unsigned char) i;

       /* Get itl2. */
       itl2Handle = GetResource('itl2', mac_get_script_sort_id(scriptcode));
       if (itl2Handle == NULL)
              return -1;
       /* qsort */
       PRMonitor* mon = PR_NewMonitor();
       qsort((void *) sort_tbl, 256, 1, mac_sort_tbl_compare);
       (void) PR_ExitMonitor(mon);
       /* Put index to the table so we can map character code to sort oder. */
       for (i = 0; i < 256; i++)
              mac_sort_tbl[sort_tbl[i]] = (unsigned char) i;
       return 0;

Here is the call graph for this function:

unsigned char mac_sort_tbl_search ( const unsigned char  ch,
const unsigned char *  mac_sort_tbl 
) [inline]

Definition at line 117 of file nsCollationMac.cpp.

       /* Map character code to sort order. */
       return mac_sort_tbl[ch];

Variable Documentation

Handle itl2Handle [static]

Definition at line 83 of file nsCollationMac.cpp.