]>
Commit | Line | Data |
---|---|---|
14b0e578 | 1 | /** @file\r |
ba39402f | 2 | \r |
14b0e578 CS |
3 | Module to rewrite stdlib references within Oniguruma\r |
4 | \r | |
d10e0580 | 5 | (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>\r |
48b6c60c | 6 | Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r |
14b0e578 | 7 | \r |
9d510e61 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
14b0e578 CS |
9 | **/\r |
10 | #ifndef ONIGURUMA_UEFI_PORT_H\r | |
11 | #define ONIGURUMA_UEFI_PORT_H\r | |
12 | \r | |
13 | #include <Library/MemoryAllocationLib.h>\r | |
14 | #include <Library/PrintLib.h>\r | |
15 | #include <Library/BaseMemoryLib.h>\r | |
16 | #include <Library/BaseLib.h>\r | |
17 | #include <Library/DebugLib.h>\r | |
18 | \r | |
48b6c60c SZ |
19 | \r |
20 | #define ONIG_NO_STANDARD_C_HEADERS\r | |
21 | #define ONIG_NO_PRINT\r | |
14b0e578 CS |
22 | #define P_(args) args\r |
23 | \r | |
48b6c60c SZ |
24 | #define INT_MAX 0x7FFFFFFF\r |
25 | #define LONG_MAX 0x7FFFFFFF\r | |
26 | #define UINT_MAX 0xFFFFFFFF\r | |
27 | #define ULONG_MAX 0xFFFFFFFF\r | |
28 | \r | |
29 | \r | |
30 | #define SIZEOF_LONG 4\r | |
31 | #define SIZEOF_LONG_LONG 8\r | |
32 | typedef UINTN size_t;\r | |
33 | typedef UINT32 uint32_t;\r | |
34 | typedef INTN intptr_t;\r | |
35 | \r | |
36 | #ifndef offsetof\r | |
37 | #define offsetof OFFSET_OF\r | |
38 | #endif\r | |
39 | \r | |
40 | #ifdef MDE_CPU_IA32\r | |
41 | #define SIZEOF_VOIDP 4\r | |
42 | #endif\r | |
43 | \r | |
44 | #ifdef MDE_CPU_X64\r | |
45 | #define SIZEOF_VOIDP 8\r | |
46 | #endif\r | |
14b0e578 | 47 | \r |
14b0e578 | 48 | #define calloc(n,s) AllocateZeroPool((n)*(s))\r |
14b0e578 CS |
49 | #define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length)\r |
50 | #define xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length)\r | |
51 | #define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value)\r | |
52 | \r | |
53 | #define va_init_list(a,b) VA_START(a,b)\r | |
54 | #define va_list VA_LIST\r | |
55 | #define va_arg(a,b) VA_ARG(a,b)\r | |
56 | #define va_end(a) VA_END(a)\r | |
48b6c60c | 57 | #define va_start VA_START\r |
14b0e578 CS |
58 | \r |
59 | #define FILE VOID\r | |
60 | #define stdout NULL\r | |
61 | #define fprintf(...)\r | |
62 | #define fputs(a,b)\r | |
63 | #define vsnprintf (int)AsciiVSPrint\r | |
64 | #define _vsnprintf vsnprintf\r | |
48b6c60c SZ |
65 | #define xsnprintf sprintf_s\r |
66 | #define xvsnprintf vsnprintf\r | |
67 | #define alloca malloc\r | |
14b0e578 CS |
68 | \r |
69 | #define setlocale(a,b)\r | |
70 | #define LC_ALL 0\r | |
71 | \r | |
48b6c60c | 72 | #define UCHAR_MAX 255\r |
14b0e578 CS |
73 | #define MAX_STRING_SIZE 0x1000\r |
74 | #define strlen_s(String,MaxSize) AsciiStrnLenS (String, MaxSize)\r | |
48b6c60c SZ |
75 | #define xstrncpy(Dest, Src, MaxSize) strcat_s(Dest,MaxSize,Src)\r |
76 | #define xstrcat(Dest,Src,MaxSize) strcat(Dest,Src,MaxSize)\r | |
77 | #define strcat(Dest,Src,MaxSize) strcat_s(Dest,MaxSize,Src)\r | |
14b0e578 CS |
78 | #define strcat_s(Dest,MaxSize,Src) AsciiStrCatS (Dest, MaxSize, Src)\r |
79 | #define strncpy_s(Dest,MaxSize,Src,Length) AsciiStrnCpyS (Dest, MaxSize, Src, Length)\r | |
80 | #define strcmp OnigStrCmp\r | |
81 | \r | |
48b6c60c | 82 | int OnigStrCmp (const char* Str1, const char* Str2);\r |
14b0e578 | 83 | \r |
a12b214e | 84 | int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...);\r |
48b6c60c SZ |
85 | int strlen(const char* str);\r |
86 | void* malloc(size_t size);\r | |
87 | void* realloc(void *ptr, size_t size);\r | |
8b680e4a SZ |
88 | void* memcpy (void *dest, const void *src, unsigned int count);\r |
89 | void* memset (void *dest, char ch, unsigned int count);\r | |
d10e0580 | 90 | void free(void *ptr);\r |
14b0e578 CS |
91 | \r |
92 | #define exit(n) ASSERT(FALSE);\r | |
93 | \r | |
94 | #endif // !ONIGURUMA_UEFI_PORT_H\r |