1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
extern "C" {
#include "h/gpfont.h"
#include "h/gpfont_port.h"
#include "h/gpgraphic.h"
#include "h/gpmm.h"
#include "h/gpmem.h"
#include "h/gpos_def.h"
#include "h/gpstdio.h"
#include "h/gpstdlib.h"
#include "h/gpdef.h"
#include "h/defines.h"
}
extern int gpprintf(const char *fmt, ...);
#define printf gpprintf
extern void *gpmalloc(size_t size);
extern void *gpcalloc(size_t nitems, size_t size);
extern void gpfree(void *block);
#define malloc gpmalloc
#define calloc gpcalloc //gm_calloc
#define free gpfree
/*#define memset gm_memset
#define memcopy gm_memcopy
#define strcpy gm_strcpy // uncomment?
#define strncpy gm_strncpy
#define strcat gm_strcat
#define sprintf gm_sprintf*/
#define assert(e) ((e) ? 0 : (printf("!AS: " #e " (%s, %d)\n", __FILE__, __LINE__)))
#define ASSERT assert
#define ENDLESSLOOP while (1)
#define FILE F_HANDLE
#define stderr NULL // hack...
#define stdout stderr
#define stdin stderr
extern FILE *gpfopen(const char *filename, const char *mode);
extern int gpfclose(FILE *stream);
extern int gpfseek(FILE *stream, long offset, int whence);
extern size_t gpfread(void *ptr, size_t size, size_t n, FILE *stream);
extern size_t gpfwrite(const void *ptr, size_t size, size_t n, FILE*stream);
extern long gpftell(FILE *stream);
extern void gpclearerr(FILE *stream);
extern int gpfeof(FILE *stream);
extern char *gpfgets(char *s, int n, FILE *stream);
extern int gpfflush(FILE *stream);
#define fopen gpfopen
#define fclose gpfclose
#define fseek gpfseek
#define fread gpfread
#define fwrite gpfwrite
#define ftell gpftell
#define clearerr gpclearerr
#define feof gpfeof
#define fgets gpfgets
extern int gpfprintf(FILE *stream, const char *fmt, ...);
#define fprintf gpfprintf
#define fflush gpfflush
extern void gphalt(int code=0);
#define exit gphalt
//#define error printf
#define time(x) (0) // fixme! (SIMON)
// EOF
|