]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Wchar/ConsDecons.c
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / Wchar / ConsDecons.c
CommitLineData
2aa62f2b 1/** @file\r
2 Constructor and Deconstructor functions for <wchar.h>.\r
3\r
4 Unless explicitly stated otherwise, the functions defined in this file order\r
5 two wide characters the same way as two integers of the underlying integer\r
6 type designated by wchar_t.\r
7\r
8 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
9 This program and the accompanying materials are licensed and made available under\r
10 the terms and conditions of the BSD License that accompanies this distribution.\r
11 The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php.\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16**/\r
17#include <Uefi.h>\r
18#include <Library/BaseLib.h>\r
19#include <Library/BaseMemoryLib.h>\r
20#include <Library/MemoryAllocationLib.h>\r
21\r
22#include <LibConfig.h>\r
23\r
24#include <errno.h>\r
25#include <wchar.h>\r
26\r
27/* Data initialized by the library constructor */\r
28UINT8 *__wchar_bitmap = NULL;\r
29UINTN __wchar_bitmap_size;\r
30UINTN __wchar_bitmap_64;\r
31\r
32EFI_STATUS\r
33EFIAPI\r
34__wchar_construct(\r
35 IN EFI_HANDLE ImageHandle,\r
36 IN EFI_SYSTEM_TABLE *SystemTable\r
37 )\r
38{\r
39 if( __wchar_bitmap == NULL) {\r
40 __wchar_bitmap_size = (WCHAR_MAX + 8) / 8U;\r
41 __wchar_bitmap = AllocatePool(__wchar_bitmap_size);\r
42 if( __wchar_bitmap == NULL) {\r
43 EFIerrno = RETURN_OUT_OF_RESOURCES;\r
44 errno = ENOMEM;\r
45 return EFIerrno;\r
46 }\r
47 return RETURN_SUCCESS;\r
48 }\r
49 return RETURN_ALREADY_STARTED;\r
50}\r
51\r
52EFI_STATUS\r
53EFIAPI\r
54__wchar_deconstruct(\r
55 IN EFI_HANDLE ImageHandle,\r
56 IN EFI_SYSTEM_TABLE *SystemTable\r
57 )\r
58{\r
59 if( __wchar_bitmap != NULL) {\r
60 FreePool( __wchar_bitmap);\r
61 __wchar_bitmap = NULL;\r
62 }\r
63 return RETURN_SUCCESS;\r
64}\r