+++ /dev/null
-/** @file\r
- Global data for the program environment.\r
-\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available\r
- under the terms and conditions of the BSD License which accompanies this\r
- distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#include <Uefi.h>\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <sys/types.h>\r
-#include <limits.h>\r
-#include <signal.h>\r
-#include <time.h>\r
-#include <setjmp.h>\r
-\r
-#include <kfile.h>\r
-#include <Device/Device.h>\r
-\r
-#include "Device/Console.h"\r
-\r
-/* ################## Type Declarations ################################# */\r
-\r
-/** The type of an atexit handler function. **/\r
-typedef void __xithandler_t(void);\r
-\r
-/* ################## Global Declarations ############################### */\r
-#ifndef TYPE_BIT\r
-#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)\r
-#endif /* !defined TYPE_BIT */\r
-\r
-#ifndef TYPE_SIGNED\r
-#define TYPE_SIGNED(type) (((type) -1) < 0)\r
-#endif /* !defined TYPE_SIGNED */\r
-\r
-#ifndef INT_STRLEN_MAXIMUM\r
-/*\r
-** 302 / 1000 is log10(2.0) rounded up.\r
-** Subtract one for the sign bit if the type is signed;\r
-** add one for integer division truncation;\r
-** add one more for a minus sign if the type is signed.\r
-*/\r
-#define INT_STRLEN_MAXIMUM(type) \\r
-((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))\r
-#endif /* !defined INT_STRLEN_MAXIMUM */\r
-\r
-/*\r
-** Big enough for something such as\r
-** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n\r
-** (two three-character abbreviations, five strings denoting integers,\r
-** three explicit spaces, two explicit colons, a newline,\r
-** and a trailing ASCII nul).\r
-*/\r
-#define ASCTIME_BUFLEN ((2 * 3) + (5 * INT_STRLEN_MAXIMUM(int)) + 3 + 2 + 1 + 1)\r
-\r
-struct __filedes; /* Forward Reference */\r
-struct stat; /* Forward Reference so I don't have to include <stat.h> */\r
-\r
-struct __MainData {\r
- // File descriptors\r
- struct __filedes fdarray[OPEN_MAX];\r
- // Low-level File abstractions for the stdin, stdout, stderr streams\r
- ConInstance *StdIo[3];\r
-\r
- // Signal Handlers\r
- __sighandler_t *sigarray[SIG_LAST]; // Pointers to signal handlers\r
-\r
- char *NArgV[ARGC_MAX]; // Narrow character argv array\r
- char *NCmdLine; // Narrow character version of command line arguments.\r
-\r
- void (*cleanup)(void); // Stdio Cleanup Function Pointer\r
-\r
- __xithandler_t *atexit_handler[ATEXIT_MAX]; // Array of handlers for atexit.\r
- clock_t AppStartTime; // Set in Main.c and used for time.h\r
- clock_t ClocksPerSecond; // Set in Main.c and used for time.h\r
- int num_atexit; ///< Number of registered atexit handlers.\r
-\r
- CHAR16 UString[UNICODE_STRING_MAX];\r
- CHAR16 UString2[UNICODE_STRING_MAX];\r
- struct tm BDTime; // Broken-down time structure for localtime.\r
- EFI_TIME TimeBuffer; // Used by <time.h>mk\r
- char ASgetenv[ASCII_STRING_MAX]; // Only modified by getenv\r
- char ASasctime[ASCTIME_BUFLEN]; // Only modified by asctime\r
-\r
- jmp_buf MainExit; ///< Save environment used for implementing _Exit()\r
- int ExitValue; ///< Value being returned by _Exit()\r
-\r
- BOOLEAN aborting; // Ensures cleanup function only called once when aborting.\r
-};\r
-\r
-extern struct __MainData *gMD;\r