Change the translation of the "Help" menu item to "?", so that the menu can be displa...
[reactos.git] / rosapps / smartpdf / fitz / include / fitz / base_runtime.h
1 #undef nil
2 #define nil ((void*)0)
3
4 #undef offsetof
5 #define offsetof(s, m) (unsigned long)(&(((s*)0)->m))
6
7 #undef nelem
8 #define nelem(x) (sizeof(x)/sizeof((x)[0]))
9
10 #undef ABS
11 #define ABS(x) ( (x) < 0 ? -(x) : (x) )
12
13 #undef MAX
14 #define MAX(a,b) ( (a) > (b) ? (a) : (b) )
15
16 #undef MIN
17 #define MIN(a,b) ( (a) < (b) ? (a) : (b) )
18
19 #undef CLAMP
20 #define CLAMP(x,a,b) ( (x) > (b) ? (b) : ( (x) < (a) ? (a) : (x) ) )
21
22 #define MAX4(a,b,c,d) MAX(MAX(a,b), MAX(c,d))
23 #define MIN4(a,b,c,d) MIN(MIN(a,b), MIN(c,d))
24
25 #define STRIDE(n, bcp) (((bpc) * (n) + 7) / 8)
26
27 /* plan9 stuff for utf-8 and path munging */
28 int chartorune(int *rune, char *str);
29 int runetochar(char *str, int *rune);
30 int runelen(long c);
31 int runenlen(int *r, int nrune);
32 int fullrune(char *str, int n);
33 char *cleanname(char *name);
34
35 typedef struct fz_error_s fz_error;
36
37 struct fz_error_s
38 {
39 int refs;
40 char msg[184];
41 char file[32];
42 char func[32];
43 int line;
44 };
45
46 #define fz_outofmem (&fz_koutofmem)
47 extern fz_error fz_koutofmem;
48
49 #ifdef _WIN32
50 #define fz_throw(...) fz_throw0(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
51 #elif HAVE_C99
52 #define fz_throw(...) fz_throw0(__func__, __FILE__, __LINE__, __VA_ARGS__)
53 #else
54 #define fz_throw fz_throw1
55 #endif
56 fz_error *fz_throw0(const char *func, const char *file, int line, char *fmt, ...);
57 fz_error *fz_throw1(char *fmt, ...);
58
59 void fz_warn(char *fmt, ...);
60 void fz_droperror(fz_error *eo);
61
62 typedef struct fz_memorycontext_s fz_memorycontext;
63
64 struct fz_memorycontext_s
65 {
66 void * (*malloc)(fz_memorycontext *, int);
67 void * (*realloc)(fz_memorycontext *, void *, int);
68 void (*free)(fz_memorycontext *, void *);
69 };
70
71 fz_memorycontext *fz_currentmemorycontext(void);
72 void fz_setmemorycontext(fz_memorycontext *memorycontext);
73
74 void *fz_malloc(int n);
75 void *fz_realloc(void *p, int n);
76 void fz_free(void *p);
77
78 char *fz_strdup(char *s);
79