ReactOS  0.4.15-dev-3453-gff89651
compat.h
Go to the documentation of this file.
1 #ifndef _LIBMACH_COMPAT_H_
2 #define _LIBMACH_COMPAT_H_
3 
4 /* BSD like types */
5 typedef signed char schar;
6 typedef unsigned char uchar;
7 typedef unsigned int uint;
8 typedef unsigned long ulong;
9 typedef unsigned long long uvlong;
10 
11 typedef unsigned short u16int;
12 typedef short s16int;
13 typedef unsigned int u32int;
14 typedef int s32int;
15 typedef unsigned long long u64int;
16 typedef long long s64int;
17 
18 #ifndef _WIN32
19 typedef ulong size_t;
20 #endif
21 
24 VOID
25 NTAPI
27 
28 #undef assert
29 #define assert(x) do { \
30  if (!(x)) { \
31  werrstr("(%s:%d) assertion " #x " failed\n", __FILE__, __LINE__); \
32  RtlRaiseStatus(STATUS_ASSERTION_FAILURE); \
33  } \
34  } while (0)
35 #define offsetof(x,y) FIELD_OFFSET(x,y)
36 #define nil (0)
37 
38 #define nelem(arr) (sizeof((arr)[0]) / sizeof((arr)))
39 
40 int readn(void *fd, char *buf, ulong len);
41 int seek(void *fd, ulong off, int mode);
42 
44 void *RosSymRealloc(void *mem, ulong newsize);
45 void xfree(void *v);
46 
47 #define werrstr(str, ...) DPRINT(str "\n" ,##__VA_ARGS__)
48 #if 0
49 #ifdef NDEBUG
50 #define werrstr(x, ...)
51 #else
52 #define werrstr(x, ...) printf("(%s:%d) " x "\n",__FILE__,__LINE__,##__VA_ARGS__)
53 #endif
54 #endif
55 
56 #define malloc(x) RosSymAllocMem(x)
57 #define mallocz(x,y) RosSymAllocMemZero(x,y)
58 #define free(x) xfree(x)
59 #define USED(x) (*((char *)&(x)) ^= 0)
60 #define memset(x,y,z) RtlZeroMemory(x,z)
61 
62 #endif/*_LIBMACH_COMPAT_H_*/
#define IN
Definition: typedefs.h:39
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(IN NTSTATUS Status)
Definition: exception.c:85
LONG NTSTATUS
Definition: precomp.h:26
static int fd
Definition: io.c:51
signed char schar
Definition: compat.h:5
int s32int
Definition: compat.h:14
#define NTSYSAPI
Definition: ntoskrnl.h:14
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:176
long long s64int
Definition: compat.h:16
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
unsigned int uint
Definition: compat.h:7
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
void xfree(void *v)
Definition: uimain.c:758
short s16int
Definition: compat.h:12
unsigned int u32int
Definition: compat.h:13
Status
Definition: gdiplustypes.h:24
GLsizeiptr size
Definition: glext.h:5919
void * RosSymAllocMemZero(ulong num, ulong size)
Definition: pe.c:97
unsigned char uchar
Definition: compat.h:6
GLuint GLuint num
Definition: glext.h:9618
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
GLenum GLsizei len
Definition: glext.h:6722
unsigned long ulong
Definition: compat.h:8
unsigned short u16int
Definition: compat.h:11
GLenum mode
Definition: glext.h:6217
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
ulong size_t
Definition: compat.h:19
Definition: mem.c:156
unsigned long long uvlong
Definition: compat.h:9
void * RosSymRealloc(void *mem, ulong newsize)
int readn(void *fd, char *buf, ulong len)
Definition: pe.c:47
unsigned long long u64int
Definition: compat.h:15