Table of Contents

This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS

Note: This is legacy API call. It is recommended to use 32-bit equivalent

2021/09/17 04:47 · prokushev · 0 Comments
2021/08/20 03:18 · prokushev · 0 Comments

DosGetCollate

This call obtains a collating sequence table (for characters hex 00H through FFH) that resides in the country information file. It is used by the SORT utility to sort text according to the collating sequence.

Syntax

DosGetCollate (Length, Country, MemoryBuffer, DataLength)

Parameters

The buffer format for the returned information is:

Byte Description
0 Sort weight of ASCII (0)
1 Sort weight of ASCII (1)
.
.
.
255 Sort weight of ASCII (255)

Returns

rc (USHORT) - return:Return code descriptions are:

Remarks

The returned country-dependent information can be for the default country and current process code page or for a specific country and code page. For more information see DosSetCp.

Bindings

C

typedef struct _COUNTRYCODE {   /* ctryc */
 
  USHORT country;               /* country code */
  USHORT codepage;              /* code page */
 
} COUNTRYCODE;
 
#define INCL_DOSNLS
 
USHORT  rc = DosGetCollate(Length, Structure, MemoryBuffer, DataLength);
 
USHORT           Length;        /* Length of data area provided */
PCOUNTRYCODE     Structure;     /* Input data structure */
PCHAR            MemoryBuffer;  /* Collate table (returned) */
PUSHORT          DataLength;    /* Length of collate table (returned) */
 
USHORT           rc;            /* return code */

MASM

COUNTRYCODE struc
  ctryc_country   dw  ? ;country code
  ctryc_codepage  dw  ? ;code page
COUNTRYCODE ends
 
EXTRN  DosGetCollate:FAR
INCL_DOSNLS         EQU 1
 
PUSH   WORD    Length        ;Length of data area provided
PUSH@  OTHER   Structure     ;Input data structure
PUSH@  OTHER   MemoryBuffer  ;Collate table (returned)
PUSH@  WORD    DataLength    ;Length of collate table (returned)
CALL   DosGetCollate
 
Returns WORD

Example

This example gets a collating sequence table for codepage 850 and the current country.

#define INCL_DOSNLS
#define CURRENT_COUNTRY 0
#define NLS_CODEPAGE 850
 
COUNTRYCODE Country;
CHAR        CollBuffer[256];
USHORT      Length;
USHORT      rc;
 
 Country.country = CURRENT_COUNTRY;
 Country.codepage = NLS_CODEPAGE;
 
 rc = DosGetCollate(sizeof(CollBuffer), /* Length of data area provided */
                    &Country,           /* Input data structure */
                    CollBuffer,         /* Data area to contain collate table */
                    &Length);           /* Length of table */