Line | |
---|
1 | /*
|
---|
2 | ** Module :CODEPAGE.CPP
|
---|
3 | ** Abstract :
|
---|
4 | **
|
---|
5 | ** Copyright (C) Vit Timchishin
|
---|
6 | **
|
---|
7 | ** Log: Wed 22/12/1999 Created
|
---|
8 | **
|
---|
9 | */
|
---|
10 |
|
---|
11 | #include <odin.h>
|
---|
12 | #include <odinwrap.h>
|
---|
13 | #include <os2win.h>
|
---|
14 | #include "oslibdos.h"
|
---|
15 | #include "profile.h"
|
---|
16 | #include "codepage.h"
|
---|
17 |
|
---|
18 | static UconvObject DisplayUconv = NULL;
|
---|
19 | static UconvObject WindowsUconv = NULL;
|
---|
20 |
|
---|
21 | ULONG GetDisplayCodepage()
|
---|
22 | {
|
---|
23 | return ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "DISPLAY", 0);
|
---|
24 | }
|
---|
25 |
|
---|
26 | ULONG GetWindowsCodepage()
|
---|
27 | {
|
---|
28 | return ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "WINDOWS", 0);
|
---|
29 | }
|
---|
30 |
|
---|
31 | static UconvObject GetObjectByCP(ULONG codepage)
|
---|
32 | {
|
---|
33 | UconvObject rc = 0;
|
---|
34 | UniChar codepage_str[12];
|
---|
35 |
|
---|
36 | BOOL ret = UniMapCpToUcsCp(codepage, codepage_str, sizeof(codepage_str));
|
---|
37 | if ( ret == ULS_SUCCESS )
|
---|
38 | {
|
---|
39 | ret = UniCreateUconvObject( (UniChar*)L"", &rc );
|
---|
40 | if ( ret != ULS_SUCCESS )
|
---|
41 | rc = 0;
|
---|
42 | }
|
---|
43 | dprintf(("UniCreateUconvObject for CP %d (%08x)\n", codepage, rc ));
|
---|
44 | return rc;
|
---|
45 | }
|
---|
46 |
|
---|
47 | UconvObject GetDisplayUconvObject()
|
---|
48 | {
|
---|
49 | if (!DisplayUconv)
|
---|
50 | DisplayUconv = GetObjectByCP(GetDisplayCodepage());
|
---|
51 |
|
---|
52 | return DisplayUconv;
|
---|
53 | }
|
---|
54 |
|
---|
55 | UconvObject GetWindowsUconvObject()
|
---|
56 | {
|
---|
57 | if (!WindowsUconv)
|
---|
58 | WindowsUconv = GetObjectByCP(GetWindowsCodepage());
|
---|
59 |
|
---|
60 | return WindowsUconv;
|
---|
61 | }
|
---|
62 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.