Unit Locale

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Ultibo Locale Interface unit

This unit implements the locale support for Ultibo and provides the code page support for the WideStringManager/UnicodeStringManager interface for the RTL.

This unit provides compatible implementations of the following functions:

  • ConvertDefaultLocale
  • EnumCodePagesProc
  • EnumLocalesProc
  • EnumTimeFormats
  • GetCPInfo
  • GetNumberFormat
  • GetSystemDefaultLangID
  • GetUserDefaultLangID
  • IsValidLocale
  • GetConsoleOutputCP
  • EnumCalendarInfo
  • EnumDateFormats
  • EnumSystemCodePages
  • EnumTimeFormatsProc
  • GetCurrencyFormat
  • GetLocaleInfo
  • GetSystemDefaultLCID
  • GetUserDefaultLCID
  • SetLocaleInfo
  • SetConsoleCP
  • EnumCalendarInfoProc
  • EnumDateFormatsProc
  • EnumSystemLocales
  • GetACP
  • GetDateFormat
  • GetOEMCP
  • GetTimeFormat
  • IsValidCodePage
  • GetConsoleCP
  • SetConsoleOutputCP


The following functions are implemented by the Threads unit:

  • GetThreadLocale (ThreadGetLocale) (GetThreadLocale is exposed in the Ultibo unit)
  • SetThreadLocale (ThreadSetLocale) (SetThreadLocale is exposed in the Ultibo unit)

Most of the above are currently not implemented.


OEM Code Page defaults to 437 (OEM United States)

ANSI Code Page defaults to 1252 (ANSI Latin 1; Western European (Windows))


See also: https://msdn.microsoft.com/en-us/library/windows/desktop/dd319081%28v=vs.85%29.aspx

Constants



[Expand]
Default code page CP_*


[Expand]
Code page identifier CP_OEM_*, CP_ANSI_*


[Expand]
Default locale LOCALE_*


[Expand]
String length maximum MAX_*


[Expand]
MBCS and Unicode translation flag MB_*, WC_*


[Expand]
Character type flag CT_*


[Expand]
CType 1 flag bit C1_*


[Expand]
CType 2 flag bit C2_*


[Expand]
CType 3 flag bit C3_*


[Expand]
String flag NORM_*


[Expand]
Locale independent mapping flag MAP_*


[Expand]
Locale dependent mapping flag LCMAP_*


[Expand]
Language group enumeration flag LGRPID_*


[Expand]
Locale enumeration flag LCID_*


[Expand]
Code page enumeration flag CP_*


[Expand]
Sorting flag SORT_*


[Expand]
Compare string return value CSTR_*


[Expand]
Country/Region code CTRY_*


[Expand]
Primary language Id value LANG_*


[Expand]
Sublanguage Id value SUBLANG_*


Type definitions



Locale Id

LCID = DWORD;
PLCID = ^LCID;

Language Id

LANGID = Word;
PLANGID = ^LANGID;

Language group Id

LGRPID = DWORD;

Locale type

LCTYPE = DWORD;

Calendar type

CALTYPE = DWORD;

Calendar Id

CALID = DWORD;

CP information

[Expand]

CPINFO = _cpinfo;

TCpInfo = CPINFO;

PCpInfo = LPCPINFO;

LPCPINFO = ^CPINFO;

_cpinfo = record

CP info extended

[Expand]

CPINFOEX = _cpinfoex;

TCpInfoEx = CPINFOEX;

PCpInfoEx = LPCPINFOEX;

LPCPINFOEX = ^CPINFOEX;

_cpinfoex = record

Code table

[Expand]

PCodeTable = ^TCodeTable;

TCodeTable = record

Translation table

[Expand]

PTransTable = ^TTransTable;

TTransTable = record

Lowercase table

[Expand]

PLowerTable = ^TLowerTable;

TLowerTable = record

Uppercase table

[Expand]

PUpperTable = ^TUpperTable;

TUpperTable = record

Unicode table

[Expand]

PUnicodeTable = ^TUnicodeTable;

TUnicodeTable = record

Lead bytes

[Expand]

PLeadBytes = ^TLeadBytes;

TLeadBytes = record

Code page

[Expand]

PCodePage = ^TCodePage;

TCodePage = record


Public variables



Locale specific variables

OemPage:PCodePage;
AnsiPage:PCodePage;
DefaultPage:PCodePage;
CodePageLock:TPlatformLock;


Function declarations



Initialization functions

[Expand]
procedure LocaleInit;
Description: To be documented


Locale functions

[Expand]
function IsValidCodePage(CodePage:UINT):BOOL;
Description: To be documented


[Expand]
function GetACP:UINT;
Description: To be documented


[Expand]
function GetOEMCP:UINT;
Description: To be documented


[Expand]
function SetACP(CodePage:UINT):BOOL;
Description: To be documented


[Expand]
function SetOEMCP(CodePage:UINT):BOOL;
Description: To be documented


[Expand]
function GetConsoleCP:UINT;
Description: To be documented


[Expand]
function SetConsoleCP(wCodePageID:UINT):BOOL;
Description: To be documented


[Expand]
function GetConsoleOutputCP:UINT;
Description: To be documented


[Expand]
function SetConsoleOutputCP(wCodePageID:UINT):BOOL;
Description: To be documented


[Expand]
function GetCPInfo(CodePage:UINT; var lpCPInfo:TCPInfo):BOOL;
Description: To be documented


[Expand]
function GetCPInfoEx(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;
Description: To be documented


[Expand]
function GetCPInfoExA(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXA):BOOL;
Description: To be documented


[Expand]
function GetCPInfoExW(CodePage:UINT; dwFlags:DWORD; var lpCPInfoEx:CPINFOEXW):BOOL;
Description: To be documented


[Expand]
function IsValidLocale(Locale:LCID; dwFlags:DWORD):BOOL;
Description: To be documented


[Expand]
function GetSystemDefaultLCID:LCID;
Description: To be documented


[Expand]
function GetUserDefaultLCID:LCID;
Description: To be documented


[Expand]
function SetSystemDefaultLCID(Locale:LCID):BOOL;
Description: To be documented


[Expand]
function GetSystemDefaultLangID: LANGID;
Description: Get the System Default Language Identifier (Combined Primary and Sub language Identifiers)


[Expand]
function GetUserDefaultLangID: LANGID;
Description: Get the System Default Language Identifier (Combined Primary and Sub language Identifiers)


RTL unicode string manager functions

[Expand]
function SysGetStandardCodePage(const stdcp:TStandardCodePageEnum):TSystemCodePage;
Description: To be documented


Locale helper functions

[Expand]
function MapPage(CodePage:UINT):Word;
Description: Map a default code page to the actual current page


[Expand]
function GetPage(PageID:Word):PCodePage;
Description: Find the requested page in the linked list


[Expand]
function CheckPage(Page:PCodePage):Boolean;
Description: Check that the Page supplied is part of the Linked list


[Expand]
function LinkPage(Page:PCodePage):Boolean;
Description: Link Page to Prev,Next Siblings and Adjust First/Last


[Expand]
function UnlinkPage(Page:PCodePage):Boolean;
Description: Unlink Page from Prev,Next Siblings and Adjust First/Last


[Expand]
function LoadPage(PageID:Word; Table:PCodeTable; Lower:PLowerTable; Upper:PUpperTable):Boolean;
Description: Load a code table and allocate memory to create a code page


[Expand]
function UnloadPage(PageID:Word; Page:PCodePage):Boolean;
Description: Unload a code page and release allocated memory


[Expand]
function DefaultTrans(PageID,TransID:Word):Boolean;
Description: To be documented


[Expand]
function InstallTrans(PageID:Word; Table:PTransTable):Boolean;
Description: To be documented


Return to Unit Reference