]>
Commit | Line | Data |
---|---|---|
14b0e578 CS |
1 | /** @file\r |
2 | \r | |
3 | Module to rewrite stdlib references within Oniguruma\r | |
4 | \r | |
0af8e57c | 5 | (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>\r |
14b0e578 CS |
6 | \r |
7 | This program and the accompanying materials are licensed and made available\r | |
8 | under the terms and conditions of the BSD License that accompanies this\r | |
9 | distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php.\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r | |
13 | WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | **/\r | |
15 | #ifndef ONIGURUMA_UEFI_PORT_H\r | |
16 | #define ONIGURUMA_UEFI_PORT_H\r | |
17 | \r | |
18 | #include <Library/MemoryAllocationLib.h>\r | |
19 | #include <Library/PrintLib.h>\r | |
20 | #include <Library/BaseMemoryLib.h>\r | |
21 | #include <Library/BaseLib.h>\r | |
22 | #include <Library/DebugLib.h>\r | |
23 | \r | |
24 | #undef _WIN32\r | |
25 | #define P_(args) args\r | |
26 | \r | |
27 | #define SIZEOF_LONG sizeof(long)\r | |
28 | #define SIZEOF_INT sizeof(int)\r | |
29 | typedef UINTN size_t;\r | |
30 | \r | |
31 | #define malloc(n) AllocatePool(n)\r | |
32 | #define calloc(n,s) AllocateZeroPool((n)*(s))\r | |
ffbb5ae3 LE |
33 | \r |
34 | #define free(p) \\r | |
35 | do { \\r | |
36 | VOID *EvalOnce; \\r | |
37 | \\r | |
38 | EvalOnce = (p); \\r | |
39 | if (EvalOnce != NULL) { \\r | |
40 | FreePool (EvalOnce); \\r | |
41 | } \\r | |
42 | } while (FALSE)\r | |
43 | \r | |
14b0e578 CS |
44 | #define realloc(OldPtr,NewSize,OldSize) ReallocatePool(OldSize,NewSize,OldPtr)\r |
45 | #define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length)\r | |
46 | #define xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length)\r | |
47 | #define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value)\r | |
48 | \r | |
49 | #define va_init_list(a,b) VA_START(a,b)\r | |
50 | #define va_list VA_LIST\r | |
51 | #define va_arg(a,b) VA_ARG(a,b)\r | |
52 | #define va_end(a) VA_END(a)\r | |
53 | \r | |
54 | #define FILE VOID\r | |
55 | #define stdout NULL\r | |
56 | #define fprintf(...)\r | |
57 | #define fputs(a,b)\r | |
58 | #define vsnprintf (int)AsciiVSPrint\r | |
59 | #define _vsnprintf vsnprintf\r | |
60 | \r | |
61 | #define setlocale(a,b)\r | |
62 | #define LC_ALL 0\r | |
63 | \r | |
64 | #define MAX_STRING_SIZE 0x1000\r | |
65 | #define strlen_s(String,MaxSize) AsciiStrnLenS (String, MaxSize)\r | |
66 | #define strcat_s(Dest,MaxSize,Src) AsciiStrCatS (Dest, MaxSize, Src)\r | |
67 | #define strncpy_s(Dest,MaxSize,Src,Length) AsciiStrnCpyS (Dest, MaxSize, Src, Length)\r | |
68 | #define strcmp OnigStrCmp\r | |
69 | \r | |
70 | int OnigStrCmp (char* Str1, char* Str2);\r | |
71 | \r | |
a12b214e | 72 | int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...);\r |
14b0e578 CS |
73 | \r |
74 | #define exit(n) ASSERT(FALSE);\r | |
75 | \r | |
76 | #endif // !ONIGURUMA_UEFI_PORT_H\r |