]>
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>
23 #include <Device/Device.h>
25 #include "Device/Console.h"
27 /* ################## Type Declarations ################################# */
29 /** The type of an atexit handler function. **/
30 typedef void __xithandler_t(void);
32 /* ################## Global Declarations ############################### */
34 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
35 #endif /* !defined TYPE_BIT */
38 #define TYPE_SIGNED(type) (((type) -1) < 0)
39 #endif /* !defined TYPE_SIGNED */
41 #ifndef INT_STRLEN_MAXIMUM
43 ** 302 / 1000 is log10(2.0) rounded up.
44 ** Subtract one for the sign bit if the type is signed;
45 ** add one for integer division truncation;
46 ** add one more for a minus sign if the type is signed.
48 #define INT_STRLEN_MAXIMUM(type) \
49 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
50 #endif /* !defined INT_STRLEN_MAXIMUM */
53 ** Big enough for something such as
54 ** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
55 ** (two three-character abbreviations, five strings denoting integers,
56 ** three explicit spaces, two explicit colons, a newline,
57 ** and a trailing ASCII nul).
59 #define ASCTIME_BUFLEN ((2 * 3) + (5 * INT_STRLEN_MAXIMUM(int)) + 3 + 2 + 1 + 1)
61 struct __filedes
; /* Forward Reference */
62 struct stat
; /* Forward Reference so I don't have to include <stat.h> */
66 struct __filedes fdarray
[OPEN_MAX
];
67 // Low-level File abstractions for the stdin, stdout, stderr streams
68 ConInstance
*StdIo
[3];
71 __sighandler_t
*sigarray
[SIG_LAST
]; // Pointers to signal handlers
73 char *NArgV
[ARGC_MAX
]; // Narrow character argv array
74 char *NCmdLine
; // Narrow character version of command line arguments.
76 void (*cleanup
)(void); // Stdio Cleanup Function Pointer
77 void (*FinalCleanup
)(void); // Function to free this structure and cleanup before exit.
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 BOOLEAN aborting
; // Ensures cleanup function only called once when aborting.
94 extern struct __MainData
*gMD
;