Jump to content

DosCaseMap: Difference between revisions

From EDM2
Created page with "==Description== This feature allows mapping of a binary input character string in accordance with a code of OS/2 countries. ==Syntax== DosCaseMap (Length, Country, BinarySt..."
 
Ak120 (talk | contribs)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
This feature allows mapping of a binary input character string in accordance with a code of OS/2 countries.
This feature allows mapping of a binary input character string in accordance with a code of OS/2 countries.


==Syntax==
==Syntax==
 
  DosCaseMap (Length, Country, BinaryString)
  DosCaseMap (Length, Country, BinaryString)  


==Parameters==
==Parameters==
Length (USHORT) - input
;Length (USHORT) - input:Length of the string of binary values to be case mapped.
 
;Country (PCOUNTRYCODE) - input/output:Address of the country information structure:
    Length of the string of binary values to be case mapped.  
:country (USHORT):Country code identifier is a binary value of the selected country code. 0 is the default country code.
 
:codepage (USHORT):Code page identifier is a binary value of the selected code page. 0 is the code page of the current process.
Country (PCOUNTRYCODE) - input/output
;BinaryString (PCHAR) - input/output:Address of a string of binary characters to be case mapped. They are case mapped in place so the results appear in BinaryString and the input is destroyed.
 
    Address of the country information structure:


    country (USHORT)
==Return==
        Country code identifier is a binary value of the selected country code. 0 is the default country code. codepage (USHORT)
;rc (USHORT) - return:Return code descriptions are:
        Code page identifier is a binary value of the selected code page. 0 is the code page of the current process. BinaryString (PCHAR) - input/output
*0 NO_ERROR
        Address of a string of binary characters to be case mapped. They are case mapped in place so the results appear in BinaryString and the input is destroyed. rc (USHORT) - return
*396 ERROR_NLS_NO_COUNTRY_FILE
        Return code descriptions are:
*397 ERROR_NLS_OPEN_FAILED
 
*398 ERROR_NO_COUNTRY_OR_CODEPAGE
        NO_ERROR 396
*399 ERROR_NLS_TABLE_TRUNCATED
            ERROR_NLS_NO_COUNTRY_FILE 397
            ERROR_NLS_OPEN_FAILED 398
            ERROR_NO_COUNTRY_OR_CODEPAGE 399
            ERROR_NLS_TABLE_TRUNCATED Remarks


==Remarks==
DosCaseMap is mainly used to map a lower case character string to an upper case character string. Unless the user replaces the country information file, DosCaseMap only does the conversion from lower case to upper case.
DosCaseMap is mainly used to map a lower case character string to an upper case character string. Unless the user replaces the country information file, DosCaseMap only does the conversion from lower case to upper case.


The case map information is taken from the country information file. See the COUNTRY statement in the IBM Operating System/2 Version 1.2 Command Reference for information on how to specify the country information file.
The case map information is taken from the country information file. See the COUNTRY statement in the ''IBM Operating System/2 Version 1.2 Command Reference'' for information on how to specify the country information file.


If countrycode is 0, the case mapping is performed using the information for the country specified in the COUNTRY statement in CONFIG.SYS.
If countrycode is 0, the case mapping is performed using the information for the country specified in the COUNTRY statement in CONFIG.SYS.
Line 35: Line 28:
If countrycode is not 0, the case mapping is performed using the information for that country.
If countrycode is not 0, the case mapping is performed using the information for that country.


If the code page identifier is 0, the case mapping is performed using the information for the current process code page. Refer to DosSetCp and the CHCP command in the IBM Operating System/2 Version 1.2 Command Reference for information on setting the process code page. If codepage is not 0, the case mapping is performed using the information for that code page.
If the code page identifier is 0, the case mapping is performed using the information for the current process code page. Refer to [[DosSetCp]] and the CHCP command in the ''IBM Operating System/2 Version 1.2 Command Reference'' for information on setting the process code page. If codepage is not 0, the case mapping is performed using the information for that code page.


The returned country dependent information may be for the default country and current process code page or for a specific country and code page.  
The returned country dependent information may be for the default country and current process code page or for a specific country and code page.


 
==Bindings==
==C Bindings==
===C===
<PRE>
<PRE>
typedef struct _COUNTRYCODE {  /* ctryc */
typedef struct _COUNTRYCODE {  /* ctryc */
   USHORT country;              /* country code */
   USHORT country;              /* country code */
   USHORT codepage;              /* code page */
   USHORT codepage;              /* code page */
} COUNTRYCODE;
} COUNTRYCODE;


Line 59: Line 50:
USHORT          rc;            /* return code */
USHORT          rc;            /* return code */
</PRE>
</PRE>
===Example===


===MASM===
<PRE>
COUNTRYCODE struc
  ctryc_country  dw  ? ;country code
  ctryc_codepage  dw  ? ;code page
COUNTRYCODE ends
EXTRN  DosCaseMap:FAR
INCL_DOSNLS        EQU 1
PUSH  WORD    Length        ;Length of string to case map
PUSH@  OTHER  Structure    ;Input data structure
PUSH@  OTHER  BinaryString  ;Binary string
CALL  DosCaseMap
Returns WORD
</PRE>
==Example==
This example case maps a string for the default country and code page 850.
This example case maps a string for the default country and code page 850.
<PRE>
<PRE>
Line 71: Line 80:
CHAR        BinString[30];
CHAR        BinString[30];
USHORT      rc;
USHORT      rc;


   Country.country = CURRENT_COUNTRY;        /* Country code */
   Country.country = CURRENT_COUNTRY;        /* Country code */
Line 79: Line 87:
                   &Country,                  /* Input data structure */
                   &Country,                  /* Input data structure */
                   BinString);                /* String */
                   BinString);                /* String */
</PRE>
==MASM Binding==
<PRE>
COUNTRYCODE struc
  ctryc_country  dw  ? ;country code
  ctryc_codepage  dw  ? ;code page
COUNTRYCODE ends
EXTRN  DosCaseMap:FAR
INCL_DOSNLS        EQU 1
PUSH  WORD    Length        ;Length of string to case map
PUSH@  OTHER  Structure    ;Input data structure
PUSH@  OTHER  BinaryString  ;Binary string
CALL  DosCaseMap
Returns WORD
</PRE>
</PRE>


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Latest revision as of 02:01, 17 February 2020

This feature allows mapping of a binary input character string in accordance with a code of OS/2 countries.

Syntax

DosCaseMap (Length, Country, BinaryString)

Parameters

Length (USHORT) - input
Length of the string of binary values to be case mapped.
Country (PCOUNTRYCODE) - input/output
Address of the country information structure:
country (USHORT):Country code identifier is a binary value of the selected country code. 0 is the default country code.
codepage (USHORT):Code page identifier is a binary value of the selected code page. 0 is the code page of the current process.
BinaryString (PCHAR) - input/output
Address of a string of binary characters to be case mapped. They are case mapped in place so the results appear in BinaryString and the input is destroyed.

Return

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 396 ERROR_NLS_NO_COUNTRY_FILE
  • 397 ERROR_NLS_OPEN_FAILED
  • 398 ERROR_NO_COUNTRY_OR_CODEPAGE
  • 399 ERROR_NLS_TABLE_TRUNCATED

Remarks

DosCaseMap is mainly used to map a lower case character string to an upper case character string. Unless the user replaces the country information file, DosCaseMap only does the conversion from lower case to upper case.

The case map information is taken from the country information file. See the COUNTRY statement in the IBM Operating System/2 Version 1.2 Command Reference for information on how to specify the country information file.

If countrycode is 0, the case mapping is performed using the information for the country specified in the COUNTRY statement in CONFIG.SYS.

If countrycode is not 0, the case mapping is performed using the information for that country.

If the code page identifier is 0, the case mapping is performed using the information for the current process code page. Refer to DosSetCp and the CHCP command in the IBM Operating System/2 Version 1.2 Command Reference for information on setting the process code page. If codepage is not 0, the case mapping is performed using the information for that code page.

The returned country dependent information may be for the default country and current process code page or for a specific country and code page.

Bindings

C

typedef struct _COUNTRYCODE {   /* ctryc */
  USHORT country;               /* country code */
  USHORT codepage;              /* code page */
} COUNTRYCODE;

#define INCL_DOSNLS

USHORT  rc = DosCaseMap(Length, Structure, BinaryString);

USHORT           Length;        /* Length of string to case map */
PCOUNTRYCODE     Structure;     /* Input data structure */
PCHAR            BinaryString;  /* Address of binary string */

USHORT           rc;            /* return code */

MASM

COUNTRYCODE struc
  ctryc_country   dw  ? ;country code
  ctryc_codepage  dw  ? ;code page
COUNTRYCODE ends

EXTRN  DosCaseMap:FAR
INCL_DOSNLS         EQU 1

PUSH   WORD    Length        ;Length of string to case map
PUSH@  OTHER   Structure     ;Input data structure
PUSH@  OTHER   BinaryString  ;Binary string
CALL   DosCaseMap

Returns WORD

Example

This example case maps a string for the default country and code page 850.

#define INCL_DOSNLS

#define CURRENT_COUNTRY 0
#define NLS_CODEPAGE 850

COUNTRYCODE Country;
CHAR        BinString[30];
USHORT      rc;

   Country.country = CURRENT_COUNTRY;         /* Country code */
   Country.codepage = NLS_CODEPAGE;           /* Code page */
   strcpy(BinString,"Howdy");                 /* String to map */
   rc = DosCaseMap(sizeof(BinString),         /* Length of string */
                   &Country,                  /* Input data structure */
                   BinString);                /* String */