diff options
author | darylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-15 19:58:39 +0000 |
---|---|---|
committer | darylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-15 19:58:39 +0000 |
commit | a7a8363d86ec8ad445fb73619b1ca5cac4e56a86 (patch) | |
tree | 2f395fe3d054f5036014cd7eb1f892d7d7333bb0 /StdLib/Include | |
parent | c7907ba2fa68a7515747385bf63b47f5e281c904 (diff) | |
download | edk2-a7a8363d86ec8ad445fb73619b1ca5cac4e56a86.tar.gz edk2-a7a8363d86ec8ad445fb73619b1ca5cac4e56a86.tar.bz2 edk2-a7a8363d86ec8ad445fb73619b1ca5cac4e56a86.zip |
StdLib: Add multi-byte character support. The normal "narrow" character set is now UTF-8 instead of ASCII.
Add library classes which are required by StdLib, but not commonly defined in Platform DSC files, to StdLib.inc.
Modify MB_LEN_MAX to be 4, the maximum length of UTF-8 characters.
Adjust size of internal buffers to be multiples of MB_LEN_MAX instead of assuming 1-byte characters.
Make the XYoffset object public and move its declaration into EfiSysCall.h.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: daryl.mcdaniel@intel.com
Reviewed-by: erik.c.bjorge@intel.com
Reviewed-by: lee.g.rosenbaum@intel.com
Reviewed-by: leroy.p.leahy@intel.com
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13457 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/Include')
-rw-r--r-- | StdLib/Include/Arm/machine/ansi.h | 26 | ||||
-rw-r--r-- | StdLib/Include/Ia32/machine/ansi.h | 48 | ||||
-rw-r--r-- | StdLib/Include/Ipf/machine/ansi.h | 24 | ||||
-rw-r--r-- | StdLib/Include/X64/machine/ansi.h | 11 | ||||
-rw-r--r-- | StdLib/Include/limits.h | 4 | ||||
-rw-r--r-- | StdLib/Include/stdio.h | 6 | ||||
-rw-r--r-- | StdLib/Include/sys/EfiSysCall.h | 16 |
7 files changed, 94 insertions, 41 deletions
diff --git a/StdLib/Include/Arm/machine/ansi.h b/StdLib/Include/Arm/machine/ansi.h index 4c9e65a3bc..8273905cd3 100644 --- a/StdLib/Include/Arm/machine/ansi.h +++ b/StdLib/Include/Arm/machine/ansi.h @@ -1,6 +1,15 @@ -/* $NetBSD: ansi.h,v 1.7 2006/10/04 13:51:59 tnozaki Exp $ */
+/** @file
+ Machine dependent ANSI type definitions.
+
+ Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -29,8 +38,8 @@ * SUCH DAMAGE.
*
* from: @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
+ NetBSD: ansi.h,v 1.7 2006/10/04 13:51:59 tnozaki Exp
+**/
#ifndef _ANSI_H_
#define _ANSI_H_
@@ -85,9 +94,12 @@ * mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
-typedef union {
- __int64_t __mbstateL; /* for alignment */
- char __mbstate8[128];
+typedef struct {
+ UINT32 A; // Np;
+ UINT32 B; // U;
+ UINT32 E; // L
+ UINT8 C[4]; // n[4]
+ UINT16 D[2]; // w[2]
} __mbstate_t;
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
diff --git a/StdLib/Include/Ia32/machine/ansi.h b/StdLib/Include/Ia32/machine/ansi.h index 5872eb3694..6ef0a740ca 100644 --- a/StdLib/Include/Ia32/machine/ansi.h +++ b/StdLib/Include/Ia32/machine/ansi.h @@ -1,8 +1,17 @@ -/* $NetBSD: ansi.h,v 1.19 2006/10/04 13:52:00 tnozaki Exp $ */
+/** @file
+ Machine dependent ANSI type definitions.
+
+ Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-/*-
* Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,11 +37,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)ansi.h 8.2 (Berkeley) 1/4/94
+ * @(#)ansi.h 8.2 (Berkeley) 1/4/94
+ NetBSD: ansi.h,v 1.19 2006/10/04 13:52:00 tnozaki Exp
*/
-
-#ifndef _ANSI_H_
-#define _ANSI_H_
+#ifndef _ANSI_H_
+#define _ANSI_H_
#include <sys/EfiCdefs.h>
@@ -42,10 +51,10 @@ * Types which are fundamental to the implementation and may appear in
* more than one standard header are defined here. Standard headers
* then use:
- * #ifdef _BSD_SIZE_T_
- * typedef _BSD_SIZE_T_ size_t;
- * #undef _BSD_SIZE_T_
- * #endif
+ * #ifdef _BSD_SIZE_T_
+ * typedef _BSD_SIZE_T_ size_t;
+ * #undef _BSD_SIZE_T_
+ * #endif
*/
#define _BSD_CLOCK_T_ _EFI_CLOCK_T /* clock() */
#define _BSD_PTRDIFF_T_ _EFI_PTRDIFF_T_ /* ptr1 - ptr2 */
@@ -70,7 +79,7 @@ * chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
* lose a bit of ANSI conformance, but your programs will still work.
- *
+ *
* Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
* and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
* defined for ctype.h.
@@ -78,17 +87,20 @@ #define _BSD_WCHAR_T_ _EFI_WCHAR_T /* wchar_t */
#define _BSD_WINT_T_ _EFI_WINT_T /* wint_t */
#define _BSD_RUNE_T_ _EFI_WCHAR_T /* rune_t */
-#define _BSD_WCTRANS_T_ void * /* wctrans_t */
+#define _BSD_WCTRANS_T_ void * /* wctrans_t */
#define _BSD_WCTYPE_T_ unsigned int /* wctype_t */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
-typedef union {
- __int64_t __mbstateL; /* for alignment */
- char __mbstate8[128];
+typedef struct {
+ UINT32 A; // Np;
+ UINT32 B; // U;
+ UINT32 E; // L
+ UINT8 C[4]; // n[4]
+ UINT16 D[2]; // w[2]
} __mbstate_t;
-#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
+#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
-#endif /* _ANSI_H_ */
+#endif /* _ANSI_H_ */
diff --git a/StdLib/Include/Ipf/machine/ansi.h b/StdLib/Include/Ipf/machine/ansi.h index 07a2008717..bab41b040c 100644 --- a/StdLib/Include/Ipf/machine/ansi.h +++ b/StdLib/Include/Ipf/machine/ansi.h @@ -1,6 +1,15 @@ -/* $NetBSD: ansi.h,v 1.3 2006/10/04 13:52:00 tnozaki Exp $ */
+/** @file
+ Machine dependent ANSI type definitions.
+
+ Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -29,8 +38,8 @@ * SUCH DAMAGE.
*
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
+ NetBSD: ansi.h,v 1.3 2006/10/04 13:52:00 tnozaki Exp
*/
-
#ifndef _ANSI_H_
#define _ANSI_H_
@@ -86,9 +95,12 @@ * mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
-typedef union {
- __int64_t __mbstateL; /* for alignment */
- char __mbstate8[128];
+typedef struct {
+ UINT32 A; // Np;
+ UINT32 B; // U;
+ UINT32 E; // L
+ UINT8 C[4]; // n[4]
+ UINT16 D[2]; // w[2]
} __mbstate_t;
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
diff --git a/StdLib/Include/X64/machine/ansi.h b/StdLib/Include/X64/machine/ansi.h index 1d276f608c..e6ff195a82 100644 --- a/StdLib/Include/X64/machine/ansi.h +++ b/StdLib/Include/X64/machine/ansi.h @@ -1,7 +1,7 @@ /** @file
Machine dependent ANSI type definitions.
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License that accompanies this
distribution. The full text of the license may be found at
@@ -94,9 +94,12 @@ * mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
-typedef union {
- __int64_t __mbstateL; /* for alignment */
- char __mbstate8[128];
+typedef struct {
+ UINT32 A; // Np;
+ UINT32 B; // U;
+ UINT32 E; // L
+ UINT8 C[4]; // n[4]
+ UINT16 D[2]; // w[2]
} __mbstate_t;
#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
diff --git a/StdLib/Include/limits.h b/StdLib/Include/limits.h index 4fceca2015..5da4032f02 100644 --- a/StdLib/Include/limits.h +++ b/StdLib/Include/limits.h @@ -8,7 +8,7 @@ type as would an expression that is an object of the corresponding type
converted according to the integer promotions.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -28,7 +28,7 @@ /* Define the values required by the ISO/IEC 9899 Specification. */
/** Maximum number of bytes in a multibyte character, for any supported locale. **/
-#define MB_LEN_MAX 2 /* 16-bit UTC-2 */
+#define MB_LEN_MAX 4 /* UTF-8 can require up to 4 bytes */
/** Number of bits comprising the smallest object that is not a bit-field (byte). **/
#define CHAR_BIT __CHAR_BIT
diff --git a/StdLib/Include/stdio.h b/StdLib/Include/stdio.h index 59022666bd..c0a4deb783 100644 --- a/StdLib/Include/stdio.h +++ b/StdLib/Include/stdio.h @@ -105,7 +105,7 @@ by a three-character attempt at a mnemonic.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -243,8 +243,8 @@ typedef struct __sFILE { /*@}*/
/* tricks to meet minimum requirements even when malloc() fails */
- unsigned char _ubuf[3]; /**< guarantee an ungetc() buffer */
- unsigned char _nbuf[1]; /**< guarantee a getc() buffer */
+ unsigned char _ubuf[3 * MB_LEN_MAX]; /**< guarantee an ungetc() buffer */
+ unsigned char _nbuf[1 * MB_LEN_MAX]; /**< guarantee a getc() buffer */
/** separate buffer for fgetln() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetln() */
diff --git a/StdLib/Include/sys/EfiSysCall.h b/StdLib/Include/sys/EfiSysCall.h index cbaf1d1397..6f4742875e 100644 --- a/StdLib/Include/sys/EfiSysCall.h +++ b/StdLib/Include/sys/EfiSysCall.h @@ -53,7 +53,7 @@ BOOLEAN ValidateFD (int fd, int IsOpen);
@endverbatim
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -333,4 +333,18 @@ __BEGIN_DECLS int reboot (int, char *);
__END_DECLS
+/* The console output stream, stdout, supports cursor positioning via the
+ lseek() function call. The following entities facilitate packing the
+ X and Y coordinates into the offset parameter of the lseek call.
+*/
+typedef struct {
+ UINT32 Column;
+ UINT32 Row;
+} CURSOR_XY;
+
+typedef union {
+ UINT64 Offset;
+ CURSOR_XY XYpos;
+} XY_OFFSET;
+
#endif /* _EFI_SYS_CALL_H */
|