source: trunk/src/kernel32/codepage.cpp@ 2213

Last change on this file since 2213 was 2213, checked in by sandervl, 26 years ago

VT's codepage changes

File size: 1.2 KB
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
18static UconvObject DisplayUconv = NULL;
19static UconvObject WindowsUconv = NULL;
20
21ULONG GetDisplayCodepage()
22{
23 return ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "DISPLAY", 0);
24}
25
26ULONG GetWindowsCodepage()
27{
28 return ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "WINDOWS", 0);
29}
30
31static 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
47UconvObject GetDisplayUconvObject()
48{
49 if (!DisplayUconv)
50 DisplayUconv = GetObjectByCP(GetDisplayCodepage());
51
52 return DisplayUconv;
53}
54
55UconvObject 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.