--- /dev/null
+/** @file\r
+ \r
+ Module to rewrite stdlib references within Oniguruma\r
+\r
+ Copyright (c) 2014-2015, Hewlett-Packard Development Company, L.P.<BR>\r
+\r
+ This program and the accompanying materials are licensed and made available\r
+ under the terms and conditions of the BSD License that 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, WITHOUT\r
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+#ifndef ONIGURUMA_UEFI_PORT_H\r
+#define ONIGURUMA_UEFI_PORT_H\r
+\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#undef _WIN32\r
+#define P_(args) args\r
+\r
+#define SIZEOF_LONG sizeof(long)\r
+#define SIZEOF_INT sizeof(int)\r
+typedef UINTN size_t;\r
+\r
+#define malloc(n) AllocatePool(n)\r
+#define calloc(n,s) AllocateZeroPool((n)*(s))\r
+#define free(p) FreePool(p)\r
+#define realloc(OldPtr,NewSize,OldSize) ReallocatePool(OldSize,NewSize,OldPtr)\r
+#define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length)\r
+#define xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length)\r
+#define xmemset(Buffer,Value,Length) SetMem(Buffer,Length,Value)\r
+\r
+#define va_init_list(a,b) VA_START(a,b)\r
+#define va_list VA_LIST\r
+#define va_arg(a,b) VA_ARG(a,b)\r
+#define va_end(a) VA_END(a)\r
+\r
+#define FILE VOID\r
+#define stdout NULL\r
+#define fprintf(...)\r
+#define fputs(a,b)\r
+#define vsnprintf (int)AsciiVSPrint\r
+#define _vsnprintf vsnprintf\r
+\r
+#define setlocale(a,b)\r
+#define LC_ALL 0\r
+\r
+//#define MAX_STRING_SIZE 0x1000\r
+#define strlen_s(String,MaxSize) AsciiStrnLenS (String, MaxSize)\r
+#define strcat_s(Dest,MaxSize,Src) AsciiStrCatS (Dest, MaxSize, Src)\r
+#define strncpy_s(Dest,MaxSize,Src,Length) AsciiStrnCpyS (Dest, MaxSize, Src, Length)\r
+#define strcmp OnigStrCmp\r
+\r
+int OnigStrCmp (char* Str1, char* Str2);\r
+\r
+int sprintf (char *str, char const *fmt, ...);\r
+\r
+#define exit(n) ASSERT(FALSE);\r
+\r
+#endif // !ONIGURUMA_UEFI_PORT_H\r