11#ifndef REDFISH_CRT_LIB_H_
12#define REDFISH_CRT_LIB_H_
19#define MAX_STRING_SIZE 0x10000000
22#define LLONG_MIN MIN_INT64
25#define LLONG_MAX MAX_INT64
30#if defined (MDE_CPU_X64) || defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64)
37#elif defined (MDE_CPU_IA32) || defined (MDE_CPU_ARM) || defined (MDE_CPU_EBC)
44#if !defined (__CC_ARM)
45#define va_list VA_LIST
47#define va_start VA_START
50#define va_start(Marker, Parameter) __va_start(Marker, Parameter)
51#define va_arg(Marker, TYPE) __va_arg(Marker, TYPE)
52#define va_end(Marker) ((void)0)
58#define INT_MAX MAX_INT32
59#define LONG_MAX 0X7FFFFFFFL
60#define LONG_MIN (-LONG_MAX-1)
61#define ULONG_MAX 0xFFFFFFFF
65#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL
76typedef UINT32 uint32_t;
77typedef UINT16 uint16_t;
110 OUT CHAR8 *StartOfBuffer,
135 OUT CHAR8 *StartOfBuffer,
281 const char *__restrict nptr,
282 char **__restrict endptr
348 int (*)(
const void *,
const void *)
356#if defined (__GNUC__) && (__GNUC__ >= 2)
387#define strcmp AsciiStrCmp
388#define memcpy(dest, source, count) CopyMem(dest,source,(UINTN)(count))
389#define memset(dest, ch, count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
390#define memchr(buf, ch, count) ScanMem8(buf,(UINTN)(count),(UINT8)ch)
391#define memcmp(buf1, buf2, count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))
392#define memmove(dest, source, count) CopyMem(dest,source,(UINTN)(count))
393#define strlen(str) (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE))
394#define strcpy(strDest, strSource) AsciiStrCpyS(strDest,(strlen(strSource)+1),strSource)
395#define strncpy(strDest, strSource, count) AsciiStrnCpyS(strDest,(UINTN)count,strSource,(UINTN)count)
396#define strncpys(strDest, DestLen, strSource, count) AsciiStrnCpyS(strDest,DestLen,strSource,(UINTN)count)
397#define strcat(strDest, strSource) AsciiStrCatS(strDest,(strlen(strSource)+strlen(strDest)+1),strSource)
398#define strchr(str, ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
399#define strcasecmp(str1, str2) (int)AsciiStriCmp(str1,str2)
400#define strstr(s1, s2) AsciiStrStr(s1,s2)
401#define snprintf(buf, len, ...) RedfishAsciiSPrint(buf,len,__VA_ARGS__)
402#define vsnprintf(buf, len, format, marker) RedfishAsciiVSPrint((buf),(len),(format),(marker))
403#define assert(expression) ASSERT(expression)
404#define offsetof(type, member) OFFSET_OF(type,member)
long strtol(const char *, char **, int)
double strtod(const char *__restrict nptr, char **__restrict endptr)
char * strpbrk(const char *s1, const char *s2)
void qsort(void *, size_t, size_t, int(*)(const void *, const void *))
size_t fread(void *, size_t, size_t, FILE *)
UINTN EFIAPI RedfishAsciiVSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN VA_LIST Marker)
char * strdup(const char *str)
UINTN EFIAPI RedfishAsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
FILE * fopen(const char *, const char *)
unsigned long long strtoull(const char *nptr, char **endptr, int base)
size_t fwrite(const void *, size_t, size_t, FILE *)
long long strtoll(const char *nptr, char **endptr, int base)
unsigned long long UINT64 __attribute__((aligned(8)))