Add initial NLS support
This commit is contained in:
@@ -103,6 +103,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||||||
${XTOSKRNL_SOURCE_DIR}/rtl/llist.cc
|
${XTOSKRNL_SOURCE_DIR}/rtl/llist.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/math.cc
|
${XTOSKRNL_SOURCE_DIR}/rtl/math.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/memory.cc
|
${XTOSKRNL_SOURCE_DIR}/rtl/memory.cc
|
||||||
|
${XTOSKRNL_SOURCE_DIR}/rtl/nls.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/rbtree.cc
|
${XTOSKRNL_SOURCE_DIR}/rtl/rbtree.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/sha1.cc
|
${XTOSKRNL_SOURCE_DIR}/rtl/sha1.cc
|
||||||
${XTOSKRNL_SOURCE_DIR}/rtl/string.cc
|
${XTOSKRNL_SOURCE_DIR}/rtl/string.cc
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <rtl/llist.hh>
|
#include <rtl/llist.hh>
|
||||||
#include <rtl/math.hh>
|
#include <rtl/math.hh>
|
||||||
#include <rtl/memory.hh>
|
#include <rtl/memory.hh>
|
||||||
|
#include <rtl/nls.hh>
|
||||||
#include <rtl/rbtree.hh>
|
#include <rtl/rbtree.hh>
|
||||||
#include <rtl/sha1.hh>
|
#include <rtl/sha1.hh>
|
||||||
#include <rtl/slist.hh>
|
#include <rtl/slist.hh>
|
||||||
|
|||||||
34
xtoskrnl/includes/rtl/nls.hh
Normal file
34
xtoskrnl/includes/rtl/nls.hh
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/includes/rtl/nls.hh
|
||||||
|
* DESCRIPTION: National Language Support
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XTOSKRNL_RTL_NLS_HH
|
||||||
|
#define __XTOSKRNL_RTL_NLS_HH
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/* Runtime Library */
|
||||||
|
namespace RTL
|
||||||
|
{
|
||||||
|
class Nls
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STATIC XTAPI VOID GetDefaultCodePage(OUT PUSHORT AnsiCodePage,
|
||||||
|
OUT PUSHORT OemCodePage);
|
||||||
|
STATIC XTAPI VOID InitializeCodePageTable(IN PUSHORT TableBase,
|
||||||
|
OUT PCPTABLE_INFO CodePageTable);
|
||||||
|
STATIC XTAPI VOID InitializeNlsTables(IN PUSHORT AnsiTableBase,
|
||||||
|
IN PUSHORT OemTableBase,
|
||||||
|
IN PUSHORT CaseTableBase,
|
||||||
|
OUT PNLSTABLE_INFO NlsTable);
|
||||||
|
STATIC XTAPI WCHAR ToLowerUnicodeCharacter(IN WCHAR WideCHaracter);
|
||||||
|
STATIC XTAPI WCHAR ToUpperUnicodeCharacter(IN WCHAR WideCharacter);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __XTOSKRNL_RTL_NLS_HH */
|
||||||
130
xtoskrnl/rtl/nls.cc
Normal file
130
xtoskrnl/rtl/nls.cc
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/**
|
||||||
|
* PROJECT: ExectOS
|
||||||
|
* COPYRIGHT: See COPYING.md in the top level directory
|
||||||
|
* FILE: xtoskrnl/rtl/nls.cc
|
||||||
|
* DESCRIPTION: National Language Support
|
||||||
|
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the default ANSI and OEM code page identifiers for the system.
|
||||||
|
*
|
||||||
|
* @param AnsiCodePage
|
||||||
|
* Receives the default ANSI code page identifier.
|
||||||
|
*
|
||||||
|
* @param OemCodePage
|
||||||
|
* Receives the default OEM code page identifier.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
RTL::Nls::GetDefaultCodePage(OUT PUSHORT AnsiCodePage,
|
||||||
|
OUT PUSHORT OemCodePage)
|
||||||
|
{
|
||||||
|
/* No NLS support */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
|
/* Set fallback values to zero */
|
||||||
|
*AnsiCodePage = 0;
|
||||||
|
*OemCodePage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a code page table information structure from a raw table base pointer.
|
||||||
|
*
|
||||||
|
* @param TableBase
|
||||||
|
* Supplies a pointer to the raw code page data.
|
||||||
|
*
|
||||||
|
* @param CodePageTable
|
||||||
|
* Receives the initialized code page table information structure.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
RTL::Nls::InitializeCodePageTable(IN PUSHORT TableBase,
|
||||||
|
OUT PCPTABLE_INFO CodePageTable)
|
||||||
|
{
|
||||||
|
/* No NLS support */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the global NLS table information structure using raw table bases.
|
||||||
|
*
|
||||||
|
* @param AnsiTableBase
|
||||||
|
* Supplies a pointer to the raw ANSI translation table data.
|
||||||
|
*
|
||||||
|
* @param OemTableBase
|
||||||
|
* Supplies a pointer to the raw OEM translation table data.
|
||||||
|
*
|
||||||
|
* @param CaseTableBase
|
||||||
|
* Supplies a pointer to the raw Unicode uppercase/lowercase mapping table data.
|
||||||
|
*
|
||||||
|
* @param NlsTable
|
||||||
|
* Receives the fully initialized NLS table structure.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
VOID
|
||||||
|
RTL::Nls::InitializeNlsTables(IN PUSHORT AnsiTableBase,
|
||||||
|
IN PUSHORT OemTableBase,
|
||||||
|
IN PUSHORT CaseTableBase,
|
||||||
|
OUT PNLSTABLE_INFO NlsTable)
|
||||||
|
{
|
||||||
|
/* No NLS support */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a wide character to its lowercase equivalent using Unicode rules.
|
||||||
|
*
|
||||||
|
* @param WideCharacter
|
||||||
|
* Supplies the Unicode wide character to convert.
|
||||||
|
*
|
||||||
|
* @return This routine returns the lowercase equivalent of the provided wide character.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
WCHAR
|
||||||
|
RTL::Nls::ToLowerUnicodeCharacter(IN WCHAR WideCharacter)
|
||||||
|
{
|
||||||
|
/* This is temporary wrapper with no NLS support */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
|
/* Fall back to the internal wide string character transformation engine */
|
||||||
|
return RTL::WideString::ToLowerWideCharacter(WideCharacter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a wide character to its uppercase equivalent using Unicode rules.
|
||||||
|
*
|
||||||
|
* @param WideCharacter
|
||||||
|
* Supplies the Unicode wide character to convert.
|
||||||
|
*
|
||||||
|
* @return This routine returns the uppercase equivalent of the provided wide character.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTAPI
|
||||||
|
WCHAR
|
||||||
|
RTL::Nls::ToUpperUnicodeCharacter(IN WCHAR WideCharacter)
|
||||||
|
{
|
||||||
|
/* This is temporary wrapper with no NLS support */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
|
/* Fallback to the internal wide string character transformation engine */
|
||||||
|
return RTL::WideString::ToUpperWideCharacter(WideCharacter);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user