2020-02-23 12:21:28 +01:00
|
|
|
#ifndef __XTOOLSCOMMON_H__
|
|
|
|
#define __XTOOLSCOMMON_H__
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
#include <posix.h>
|
|
|
|
|
2020-02-23 21:23:31 +01:00
|
|
|
|
2020-02-23 12:21:28 +01:00
|
|
|
#define xsize UINTN
|
2020-03-26 13:59:20 +01:00
|
|
|
#define xisize INTN
|
2020-02-23 12:21:28 +01:00
|
|
|
#define MAX_XSIZE MAX_UINTN
|
2020-03-26 13:59:20 +01:00
|
|
|
#define MAX_XISIZE MAX_INTN
|
2020-02-23 12:21:28 +01:00
|
|
|
|
|
|
|
extern xsize XArrayGrowByDefault;
|
|
|
|
extern xsize XBufferGrowByDefault;
|
|
|
|
|
|
|
|
/* For convience, operator [] is define with int parameter.
|
|
|
|
* Defining __XTOOLS_INT_CHECK__ make a check that the parameter is >= 0
|
|
|
|
*/
|
|
|
|
#define __XTOOLS_INT_CHECK__
|
|
|
|
|
2020-03-09 02:12:24 +01:00
|
|
|
#include "../cpp_util/panic.h"
|
|
|
|
|
2020-03-10 17:50:55 +01:00
|
|
|
#ifdef CLOVER_BUILD
|
|
|
|
|
2020-03-13 14:11:58 +01:00
|
|
|
|
2020-02-27 15:34:29 +01:00
|
|
|
extern "C" {
|
2020-03-11 15:23:58 +01:00
|
|
|
#include <ProcessorBind.h>
|
2020-03-09 02:12:24 +01:00
|
|
|
#include <Library/BaseLib.h> // for StrCmp
|
2020-02-27 15:34:29 +01:00
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h> // for CopyMen
|
|
|
|
}
|
2020-03-04 14:37:39 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
//#define Xalloc(AllocationSize) AllocatePool(AllocationSize)
|
|
|
|
//#define Xrealloc(OldSize, NewSize, OldBuffer) ReallocatePool(OldSize, NewSize, OldBuffer)
|
|
|
|
//#define Xfree(Buffer) FreePool(Buffer)
|
|
|
|
//#define Xmemmove(dest,source,count) CopyMem(dest, (void*)(source), count) // that has to handle overlapping memory (prefer memmove to memcpy).
|
2020-02-27 15:34:29 +01:00
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
#if !defined(CLOVER_BUILD)
|
|
|
|
#define realloc(ptr, newsize, oldsize) realloc(ptr, newsize)
|
|
|
|
#endif
|
2020-02-27 15:34:29 +01:00
|
|
|
|
|
|
|
|
2020-03-13 14:11:58 +01:00
|
|
|
// Declare here instead of include to avoid circular dependency.
|
2020-03-26 13:59:20 +01:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define __attribute__(x)
|
|
|
|
#endif
|
|
|
|
|
2020-02-27 15:34:29 +01:00
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
DebugLog (
|
|
|
|
IN INTN DebugMode,
|
2020-03-26 13:59:20 +01:00
|
|
|
IN CONST CHAR8 *FormatString, ...) __attribute__((format(printf, 2, 3)));;
|
|
|
|
|
2020-02-27 15:34:29 +01:00
|
|
|
|
|
|
|
|
2020-02-23 12:21:28 +01:00
|
|
|
#endif
|