Jump to content

DosMapCase: Difference between revisions

From EDM2
Created page with "==Description== Performs case mapping on a string of binary values that represent ASCII characters. ==Syntax== <PRE> #define INCL_DOSNLS #include <os2.h> ULONG cb;..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
Performs case mapping on a string of binary values that represent ASCII characters.
Performs case mapping on a string of binary values that represent ASCII characters.


==Syntax==
==Syntax==
<PRE>
  DosMapCase(cb, pcc, pch)
#define INCL_DOSNLS
#include <os2.h>
 
ULONG          cb;    /*  The length, in bytes, of the string of binary values to be case-mapped. */
PCOUNTRYCODE    pcc;  /*  Pointer to the COUNTRYCODE structure in which the country code and code page are identified. */
PCHAR          pch;  /*  The string of binary characters to be case-mapped. */
APIRET          ulrc;  /* Return Code. */
 
ulrc = DosMapCase(cb, pcc, pch);


</PRE>
==Parameters==
==Parameters==
; cb (ULONG) - input : The length, in bytes, of the string of binary values to be case-mapped.  
;cb (ULONG) - input: The length, in bytes, of the string of binary values to be case-mapped.
 
;pcc (PCOUNTRYCODE) - input : Pointer to the COUNTRYCODE structure in which the country code and code page are identified.
; pcc (PCOUNTRYCODE) - input : Pointer to the COUNTRYCODE structure in which the country code and code page are identified.
:If country is set to 0, the case map table for the default system country code is used.
 
:If codepage is set to 0, the case map table for the current process code page of the caller is used.
    If country is set to 0, the case map table for the default system country code is used.
:Refer to the [[COUNTRYCODE]] for a table of values for country code and code page identifier.
 
;pch (PCHAR) - in/out : The string of binary characters to be case-mapped.
    If codepage is set to 0, the case map table for the current process code page of the caller is used.
:They are case-mapped in place, and they replace the input, so the results appear in pch.
 
Refer to the COUNTRYCODE for a table of values for country code and code page identifier.  
 
; pch (PCHAR) - in/out : The string of binary characters to be case-mapped.
 
They are case-mapped in place, and they replace the input, so the results appear in pch.


==Return Code==
==Return Code==
ulrc (APIRET) - returns
;ulrc (APIRET) - returns:DosMapCase returns one of the following values:
* 0 NO_ERROR
* 397 ERROR_NLS_OPEN_FAILED
* 398 ERROR_NLS_NO_CTRY_CODE
* 401 ERROR_NLS_TYPE_NOT_FOUND
* 476 ERROR_CODE_PAGE_NOT_FOUND


DosMapCase returns one of the following values:
* 0    NO_ERROR
* 397        ERROR_NLS_OPEN_FAILED
* 398        ERROR_NLS_NO_CTRY_CODE
* 401        ERROR_NLS_TYPE_NOT_FOUND
* 476        ERROR_CODE_PAGE_NOT_FOUND
==Remarks==
==Remarks==
DosMapCase performs case mapping on a string of binary values that represent ASCII characters.
DosMapCase performs case mapping on a string of binary values that represent ASCII characters.


The case map in the country file (the default name is COUNTRY.SYS) that corresponds to the system country code or selected country code, and to the process code page or selected code page, is used to perform the case mapping.  
The case map in the country file (the default name is [[COUNTRY.SYS]]) that corresponds to the system country code or selected country code, and to the process code page or selected code page, is used to perform the case mapping.


==Example Code==
==Example Code==
Line 84: Line 65:
   return NO_ERROR;
   return NO_ERROR;
}
}
</PRE>


</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosQueryCollate|CPI:DosQueryCollate]]
*[[DosQueryCollate]]
* [[OS2 API:CPI:DosQueryCp|CPI:DosQueryCp]]
*[[DosQueryCp]]
* [[OS2 API:CPI:DosQueryCtryInfo|CPI:DosQueryCtryInfo]]
*[[DosQueryCtryInfo]]
* [[OS2 API:CPI:DosQueryDBCSEnv|CPI:DosQueryDBCSEnv]]
*[[DosQueryDBCSEnv]]
* [[OS2 API:CPI:DosSetProcessCp|CPI:DosSetProcessCp]]
*[[DosSetProcessCp]]
 


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

Latest revision as of 17:25, 12 October 2018

Performs case mapping on a string of binary values that represent ASCII characters.

Syntax

DosMapCase(cb, pcc, pch)

Parameters

cb (ULONG) - input
The length, in bytes, of the string of binary values to be case-mapped.
pcc (PCOUNTRYCODE) - input
Pointer to the COUNTRYCODE structure in which the country code and code page are identified.
If country is set to 0, the case map table for the default system country code is used.
If codepage is set to 0, the case map table for the current process code page of the caller is used.
Refer to the COUNTRYCODE for a table of values for country code and code page identifier.
pch (PCHAR) - in/out
The string of binary characters to be case-mapped.
They are case-mapped in place, and they replace the input, so the results appear in pch.

Return Code

ulrc (APIRET) - returns
DosMapCase returns one of the following values:
  • 0 NO_ERROR
  • 397 ERROR_NLS_OPEN_FAILED
  • 398 ERROR_NLS_NO_CTRY_CODE
  • 401 ERROR_NLS_TYPE_NOT_FOUND
  • 476 ERROR_CODE_PAGE_NOT_FOUND

Remarks

DosMapCase performs case mapping on a string of binary values that represent ASCII characters.

The case map in the country file (the default name is COUNTRY.SYS) that corresponds to the system country code or selected country code, and to the process code page or selected code page, is used to perform the case mapping.

Example Code

This example converts a string to uppercase based on the current country settings.

#define INCL_DOSNLS     /* DOS National Language Support values */
#define INCL_DOSERRORS  /* DOS Error values */
#include <os2.h>
#include <stdio.h>
#include <string.h>

#define COUNTRY_CODE 0       /* Country code             (0 = current) */
#define NLS_CODEPAGE 0       /* Code page for conversion (0 = current) */

int main(VOID) {

COUNTRYCODE Country       = {0};        /* Country code  */
CHAR        uchString[80] = "";         /* String        */
APIRET      rc            = 0;          /* Return code   */

   Country.country  = COUNTRY_CODE;     /* Country code  */

   Country.codepage = NLS_CODEPAGE;     /* Code page     */

   strcpy(uchString, "Capitalize this entire sTrInG, please!");

   printf("Original string is:  %s\n", uchString);

   rc = DosMapCase(sizeof(uchString),   /* Length of string to convert */
                   &Country,            /* Country and code page info  */
                   uchString);          /* String to convert           */

   if (rc != NO_ERROR) {
      printf("DosMapCase error: return code = %u\n", rc);
      return 1;
   } else {
      printf("Converted string is: %s\n", uchString);
   } /* endif */

   return NO_ERROR;
}

Related Functions