2020-03-21 14:12:26 +01:00
|
|
|
#ifndef __CLOVER_POSIX_H__
|
|
|
|
#define __CLOVER_POSIX_H__
|
2020-03-13 14:11:58 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
//#ifdef __cplusplus
|
|
|
|
//extern "C" {
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
#include "stdio.h"
|
2020-03-13 14:11:58 +01:00
|
|
|
#include "stdint.h"
|
|
|
|
#include "stddef.h"
|
2020-03-21 14:12:26 +01:00
|
|
|
#include "limits.h"
|
|
|
|
#include "stdarg.h"
|
|
|
|
#include "stdlib.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include "wchar.h"
|
2020-04-24 08:36:29 +02:00
|
|
|
#include "abort.h"
|
2020-03-21 14:12:26 +01:00
|
|
|
|
2020-03-13 14:11:58 +01:00
|
|
|
//
|
|
|
|
// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions
|
|
|
|
// originally from OpensslLib
|
|
|
|
|
|
|
|
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
|
|
|
|
#define memchr(buf,ch,count) ScanMem8(buf,(UINTN)(count),(UINT8)ch)
|
|
|
|
#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))
|
2020-03-21 14:12:26 +01:00
|
|
|
//#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
|
2020-03-13 14:11:58 +01:00
|
|
|
//#define strcmp AsciiStrCmp
|
|
|
|
//#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
|
2020-04-23 15:20:48 +02:00
|
|
|
//#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,AsciiStrLen(strDest)+1,strSource)
|
|
|
|
//#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,(UINTN)count+1,strSource,(UINTN)count)
|
2020-03-13 14:11:58 +01:00
|
|
|
//#define strlen(str) (size_t)(AsciiStrLen(str))
|
2020-04-23 15:20:48 +02:00
|
|
|
//#define strcat(strDest,strSource) AsciiStrCatS(strDest,AsciiStrLen(strDest)+1,strSource)
|
2020-03-13 14:11:58 +01:00
|
|
|
#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
|
|
|
|
#define strstr(a,b) AsciiStrStr(a,b)
|
|
|
|
|
|
|
|
void abort(void);
|
|
|
|
|
|
|
|
//// edkII Strcmp seems quite inefficient, even vs a naive implementation
|
|
|
|
int strcmp(const char* s1, const char* s2);
|
|
|
|
int strncmp(const char* s1, const char* s2, size_t n);
|
|
|
|
size_t strlen(const char *str);
|
|
|
|
|
|
|
|
|
|
|
|
inline float fabsf(float x) {
|
|
|
|
if (x < 0.f) return -x;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//#ifdef __cplusplus
|
|
|
|
//} // extern "C"
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|