Browse Prior Art Database

Simple NLSs/2/DOS Sort

IP.com Disclosure Number: IPCOM000101221D
Original Publication Date: 1990-Jul-01
Included in the Prior Art Database: 2005-Mar-16
Document File: 2 page(s) / 44K

Publishing Venue

IBM

Related People

Redpath, RJ: AUTHOR

Abstract

ASCII characters are common for National Language Support (NLS) languages that use a single byte character set (SBCS) for data. To sort this data a table for each country is built. This article is for constructing a NLS OS/2*/DOS Sort weight table for sorting using 10 lines of code. The technique dynamically builds the table and utilizes very little memory. The technique is for operating systems OS/2 and DOS 3.3 and above. Interrupt h65 can be used in place of the DOSGETCOLLATE() function for DOS 3.3 and above. The code is presented below.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 71% of the total text.

Simple NLSs/2/DOS Sort

       ASCII characters are common for National Language Support
(NLS) languages that use a single byte character set (SBCS) for data.
To sort this data a table for each country is built.  This article is
for constructing a NLS OS/2*/DOS Sort weight table for sorting using
10 lines of code.  The technique dynamically builds the table and
utilizes very little memory.  The technique is for operating systems
OS/2 and DOS 3.3 and above.  Interrupt h65 can be used in place of
the DOSGETCOLLATE() function for DOS 3.3 and above.  The code is
presented below.

NLSloadTable()
{unsigned ret,i;
unsigned char temp(0xFF);
 memset(&countrycode,0,sizeof(struct countrycode)
);/*defaults*/
 DOSGETCOLLATE (0xFF, (struct countrycode far

                            (Image Omitted)

*)&countrycode,
                (char far *)temp, (unsigned far *)&ret);
      for (i=0; i<OxFF; i++)
           NLStable(i) = (temp (i) <<8) ¯i;
}

int NLSstrcmp(s,t)
 PBYTE   s,t;
{
   for (; NLStable (*s) ==NLStable (*t) ; s++, t++)
      if (*s==0)
           return(0);
   return(NLStable(*s)-NLStable(*t));
}

      The technique is as follows: the DOSGETCOLLATE() function is
used to get a collating sequence table for characters hex '00'
through 'FF'.  This table does not take into consideration case
sensitivity.  The weights of uppercase 'O' and lowercase  'o' are the
same.  The DOSGETCOLLATE(...