Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 2.45 KB

nls.c

File metadata and controls

76 lines (63 loc) · 2.45 KB
 
Sep 30, 2016
Sep 30, 2016
1
2
#include "os2native.h"
#include "nls.h"
Sep 30, 2016
Sep 30, 2016
3
Oct 2, 2016
Oct 2, 2016
4
5
6
7
8
9
10
11
12
APIRET DosQueryDBCSEnv(ULONG buflen, PCOUNTRYCODE pcc, PCHAR buf)
{
// !!! FIXME: implement this for real.
TRACE_NATIVE("DosQueryDBCSEnv(%u, %p, %p)", (uint) buflen, pcc, buf);
if ((pcc->country != 0) || (pcc->codepage != 0))
return ERROR_CODE_PAGE_NOT_FOUND;
memset(buf, '\0', buflen);
return NO_ERROR;
} // DosQueryDBCSEnv
Oct 9, 2016
Oct 9, 2016
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
APIRET DosMapCase(ULONG cb, PCOUNTRYCODE pcc, PCHAR pch)
{
// !!! FIXME: implement this for real.
TRACE_NATIVE("DosMapCase(%u, %p, %p)", (uint) cb, pcc, pch);
if ((pcc->country != 0) || (pcc->codepage != 0))
return ERROR_CODE_PAGE_NOT_FOUND;
for (ULONG i = 0; i < cb; i++) {
const CHAR ch = *pch;
*(pch++) = ((ch >= 'A') && (ch <= 'Z')) ? ch - ('A' - 'a') : ch;
} // for
return NO_ERROR;
} // DosMapCase
Nov 2, 2016
Nov 2, 2016
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
APIRET DosQueryCtryInfo(ULONG cb, PCOUNTRYCODE pcc, PCOUNTRYINFO pci, PULONG pcbActual)
{
// From the 4.5 toolkit docs: "If this area is too small to hold all of
// the available information, then as much information as possible is
// provided in the available space (in the order in which the data would
// appear)." ...so we fill in a local struct and memcpy it at the end.
COUNTRYINFO ci;
memset(&ci, '\0', sizeof (ci));
// From the 4.5 toolkit docs: "If the amount of data returned is not
// enough to fill the memory area provided by the caller, then the memory
// that is unaltered by the available data is zeroed out." ...so blank
// it all out now.
memset(pci, '\0', cb);
if ((pcc->country != 0) || (pcc->codepage != 0))
return ERROR_CODE_PAGE_NOT_FOUND;
// !!! FIXME: this is just what OS/2 Warp 4.52 returns by default for my USA system.
ci.country = 1;
ci.codepage = 437;
ci.fsDateFmt = 0;
ci.szCurrency[0] = '$';
ci.szThousandsSeparator[0] = ',';
ci.szDecimal[0] = '.';
ci.szDateSeparator[0] = '-';
ci.szTimeSeparator[0] = ':';
ci.fsCurrencyFmt = 0;;
ci.cDecimalPlace = 2;
ci.fsTimeFmt = 0;
//USHORT abReserved1[2];
ci.szDataSeparator[0] = ',';
//USHORT abReserved2[5];
if (pcbActual)
*pcbActual = 38; // OS/2 Warp 4.52 doesn't count the abReserved[5] at the end.
return NO_ERROR;
} // DosQueryCtryInfo
Oct 2, 2016
Oct 2, 2016
69
LX_NATIVE_MODULE_INIT()
Oct 9, 2016
Oct 9, 2016
70
LX_NATIVE_EXPORT(DosQueryDBCSEnv, 6),
Nov 2, 2016
Nov 2, 2016
71
LX_NATIVE_EXPORT(DosQueryCtryInfo, 5),
Oct 9, 2016
Oct 9, 2016
72
LX_NATIVE_EXPORT(DosMapCase, 7)
Oct 2, 2016
Oct 2, 2016
73
LX_NATIVE_MODULE_INIT_END()
74
75
// end of nls.c ...