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

Last change on this file since 3843 was 3843, checked in by bird, 25 years ago

Added $Id keyword.

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