darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 1 | /** @file
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 2 | Common "Standard" Definitions.
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 3 |
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 4 | The files stddef.h and stdlib.h are "catch all" headers for definitions and declarations
|
| 5 | that don't fit well in the other headers. There are two separate header files because
|
| 6 | the contents of <stddef.h> are valid in both freestanding and hosted environment, while the
|
| 7 | header <stdlib.h> contains elements that are only valid in a hosted environment.
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 8 |
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 9 | This means that the elements in this file may not impose dependencies on headers other than
|
| 10 | <float.h>, <iso646.h>, <limits.h>, <stdarg.h>, <stdbool.h>, and (of course) <sys/EfiCdefs.h>.
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 11 |
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 12 | Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
| 13 | This program and the accompanying materials are licensed and made available under
|
| 14 | the terms and conditions of the BSD License that accompanies this distribution.
|
| 15 | The full text of the license may be found at
|
| 16 | http://opensource.org/licenses/bsd-license.
|
| 17 |
|
| 18 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 19 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 20 | **/
|
| 21 | #ifndef _STDDEF_H
|
| 22 | #define _STDDEF_H
|
| 23 | #include <sys/EfiCdefs.h>
|
| 24 |
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 25 | #ifdef _EFI_PTRDIFF_T_
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 26 | /** ptrdiff_t is the signed integer type of the result of subtracting two pointers. **/
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 27 | typedef _EFI_PTRDIFF_T_ ptrdiff_t;
|
| 28 | #undef _EFI_PTRDIFF_T_
|
| 29 | #endif
|
| 30 |
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 31 | #ifdef _EFI_SIZE_T_
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 32 | /** size_t is the unsigned integer type of the result of the sizeof operator. **/
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 33 | typedef _EFI_SIZE_T_ size_t;
|
| 34 | #undef _EFI_SIZE_T_
|
| 35 | #undef _BSD_SIZE_T_
|
| 36 | #endif
|
| 37 |
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 38 | #ifndef __cplusplus
|
| 39 | #ifdef _EFI_WCHAR_T
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 40 | /** wchar_t is an integer type whose range of values can represent distinct
|
| 41 | codes for all members of the largest extended character set specified among
|
| 42 | the supported locales. The null character shall have the code value zero.
|
| 43 | **/
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 44 | typedef _EFI_WCHAR_T wchar_t;
|
| 45 | #undef _EFI_WCHAR_T
|
| 46 | #undef _BSD_WCHAR_T_
|
| 47 | #endif
|
| 48 | #endif
|
| 49 |
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 50 | /** @def NULL
|
| 51 | A macro that expands to a null pointer constant.<BR>
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 52 | NULL is defined in MdePkg/Include/Base.h which is automatically included
|
| 53 | by the EDK II build tools.
|
| 54 | **/
|
| 55 |
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 56 | /** The offsetof macro determines the offset of the beginning of a structure
|
| 57 | member from the beginning of the structure.
|
| 58 |
|
| 59 | The macro expands to an integer constant expression that has type size_t,
|
| 60 | the value of which is the offset in bytes, to the structure member (Member),
|
| 61 | from the beginning of its structure (StrucName).
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 62 |
|
| 63 | Alliased to OFFSET_OF which is defined in MdePkg/Include/Base.h which is
|
| 64 | automatically included by the EDK II build tools.
|
| 65 | **/
|
darylm503 | a430bdb | 2011-08-15 19:05:36 +0000 | [diff] [blame] | 66 | #define offsetof(StrucName, Member) OFFSET_OF(StrucName, Member)
|
darylm503 | 2aa62f2 | 2011-04-27 21:42:16 +0000 | [diff] [blame] | 67 |
|
| 68 | #endif /* _STDDEF_H */
|