]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLibPrivateInternalFiles/Include/MainData.h
2 Global data for the program environment.
4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <sys/types.h>
24 #include <Device/Device.h>
26 #include "Device/Console.h"
28 /* ################## Type Declarations ################################# */
30 /** The type of an atexit handler function. **/
31 typedef void __xithandler_t(void);
33 /* ################## Global Declarations ############################### */
35 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
36 #endif /* !defined TYPE_BIT */
39 #define TYPE_SIGNED(type) (((type) -1) < 0)
40 #endif /* !defined TYPE_SIGNED */
42 #ifndef INT_STRLEN_MAXIMUM
44 ** 302 / 1000 is log10(2.0) rounded up.
45 ** Subtract one for the sign bit if the type is signed;
46 ** add one for integer division truncation;
47 ** add one more for a minus sign if the type is signed.
49 #define INT_STRLEN_MAXIMUM(type) \
50 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
51 #endif /* !defined INT_STRLEN_MAXIMUM */
54 ** Big enough for something such as
55 ** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
56 ** (two three-character abbreviations, five strings denoting integers,
57 ** three explicit spaces, two explicit colons, a newline,
58 ** and a trailing ASCII nul).
60 #define ASCTIME_BUFLEN ((2 * 3) + (5 * INT_STRLEN_MAXIMUM(int)) + 3 + 2 + 1 + 1)
62 struct __filedes
; /* Forward Reference */
63 struct stat
; /* Forward Reference so I don't have to include <stat.h> */
67 struct __filedes fdarray
[OPEN_MAX
];
68 // Low-level File abstractions for the stdin, stdout, stderr streams
69 ConInstance
*StdIo
[3];
72 __sighandler_t
*sigarray
[SIG_LAST
]; // Pointers to signal handlers
74 char *NArgV
[ARGC_MAX
]; // Narrow character argv array
75 char *NCmdLine
; // Narrow character version of command line arguments.
77 void (*cleanup
)(void); // Stdio Cleanup Function Pointer
79 __xithandler_t
*atexit_handler
[ATEXIT_MAX
]; // Array of handlers for atexit.
80 clock_t AppStartTime
; // Set in Main.c and used for time.h
81 clock_t ClocksPerSecond
; // Set in Main.c and used for time.h
82 int num_atexit
; ///< Number of registered atexit handlers.
84 CHAR16 UString
[UNICODE_STRING_MAX
];
85 CHAR16 UString2
[UNICODE_STRING_MAX
];
86 struct tm BDTime
; // Broken-down time structure for localtime.
87 EFI_TIME TimeBuffer
; // Used by <time.h>mk
88 char ASgetenv
[ASCII_STRING_MAX
]; // Only modified by getenv
89 char ASasctime
[ASCTIME_BUFLEN
]; // Only modified by asctime
91 jmp_buf MainExit
; ///< Save environment used for implementing _Exit()
92 int ExitValue
; ///< Value being returned by _Exit()
94 BOOLEAN aborting
; // Ensures cleanup function only called once when aborting.
97 extern struct __MainData
*gMD
;