VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.h

Last change on this file was 101291, checked in by vboxsync, 19 months ago

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1/** @file
2
3 Module to rewrite stdlib references within Oniguruma
4
5 (C) Copyright 2014-2021 Hewlett Packard Enterprise Development LP<BR>
6 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
7 Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
8
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10**/
11
12#ifndef ONIGURUMA_UEFI_PORT_H
13#define ONIGURUMA_UEFI_PORT_H
14
15#include <Library/MemoryAllocationLib.h>
16#include <Library/PrintLib.h>
17#include <Library/BaseMemoryLib.h>
18#include <Library/BaseLib.h>
19#include <Library/DebugLib.h>
20
21#define ONIG_NO_STANDARD_C_HEADERS
22#define ONIG_NO_PRINT
23#define P_(args) args
24
25#define INT_MAX 0x7FFFFFFF
26#define LONG_MAX 0x7FFFFFFF
27#define UINT_MAX 0xFFFFFFFF
28#define ULONG_MAX 0xFFFFFFFF
29
30#define SIZEOF_LONG 4
31#define SIZEOF_LONG_LONG 8
32typedef UINTN size_t;
33typedef UINT32 uint32_t;
34typedef INTN intptr_t;
35
36#ifndef offsetof
37#define offsetof OFFSET_OF
38#endif
39
40#if defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC)
41#define SIZEOF_VOIDP 4
42#else
43#define SIZEOF_VOIDP 8
44#endif
45
46#define calloc(n, s) AllocateZeroPool((n)*(s))
47#define xmemmove(Dest, Src, Length) CopyMem(Dest,Src,Length)
48#define xmemcpy(Dest, Src, Length) CopyMem(Dest,Src,Length)
49#define xmemset(Buffer, Value, Length) SetMem(Buffer,Length,Value)
50
51#define va_init_list(a, b) VA_START(a,b)
52#define va_list VA_LIST
53#define va_arg(a, b) VA_ARG(a,b)
54#define va_end(a) VA_END(a)
55#define va_start VA_START
56
57#define FILE VOID
58#define stdout NULL
59#define fprintf(...)
60#define fputs(a, b)
61#define vsnprintf (int)AsciiVSPrint
62#define _vsnprintf vsnprintf
63#define xsnprintf sprintf_s
64#define xvsnprintf vsnprintf
65#define alloca malloc
66
67#define setlocale(a, b)
68#define LC_ALL 0
69
70#define UCHAR_MAX 255
71#define MAX_STRING_SIZE 0x1000
72#define strlen_s(String, MaxSize) AsciiStrnLenS (String, MaxSize)
73#define xstrncpy(Dest, Src, MaxSize) strcat_s(Dest,MaxSize,Src)
74#define xstrcat(Dest, Src, MaxSize) strcat(Dest,Src,MaxSize)
75#define strcat(Dest, Src, MaxSize) strcat_s(Dest,MaxSize,Src)
76#define strcat_s(Dest, MaxSize, Src) AsciiStrCatS (Dest, MaxSize, Src)
77#define strncpy_s(Dest, MaxSize, Src, Length) AsciiStrnCpyS (Dest, MaxSize, Src, Length)
78#define strcmp OnigStrCmp
79
80int
81OnigStrCmp (
82 const char *Str1,
83 const char *Str2
84 );
85
86int EFIAPI
87sprintf_s (
88 char *str,
89 size_t sizeOfBuffer,
90 char const *fmt,
91 ...
92 );
93
94int
95strlen (
96 const char *str
97 );
98
99void *
100malloc (
101 size_t size
102 );
103
104void *
105realloc (
106 void *ptr,
107 size_t size
108 );
109
110#if !defined (MDE_CPU_ARM)
111void *
112memcpy (
113 void *dest,
114 const void *src,
115 unsigned int count
116 );
117
118#endif
119
120void *
121memset (
122 void *dest,
123 int ch,
124 unsigned int count
125 );
126
127void
128free (
129 void *ptr
130 );
131
132#define exit(n) ASSERT(FALSE);
133
134#endif // !ONIGURUMA_UEFI_PORT_H
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette