Add oleacc to build
[reactos.git] / rosapps / lib / dflat32 / dfalloc.c
1 /* ---------- dfalloc.c ---------- */
2
3 //#define WIN32_LEAN_AND_MEAN
4 #include <windows.h>
5
6 #include "dflat32/dflat.h"
7
8 static void AllocationError(void)
9 {
10 static BOOL OnceIn = FALSE;
11 extern jmp_buf AllocError;
12 extern BOOL AllocTesting;
13 static char *ErrMsg[] = {
14 "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿",
15 "³ Out of Memory! ³",
16 "RÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄU"
17 };
18 int x, y;
19 CHAR_INFO savbuf[54];
20 DFRECT rc = {30,11,47,13};
21 INPUT_RECORD ir;
22
23 if (!OnceIn)
24 {
25 OnceIn = TRUE;
26 /* ------ close all windows ------ */
27 DfSendMessage(ApplicationWindow, CLOSE_WINDOW, 0, 0);
28 GetVideo(rc, savbuf);
29 for (x = 0; x < 18; x++)
30 {
31 for (y = 0; y < 3; y++)
32 {
33 int c = (255 & (*(*(ErrMsg+y)+x))) | 0x7000;
34 PutVideoChar(x+rc.lf, y+rc.tp, c);
35 }
36 }
37 GetKey(&ir);
38 StoreVideo(rc, savbuf);
39 if (AllocTesting)
40 longjmp(AllocError, 1);
41 }
42 }
43
44 void *DFcalloc(size_t nitems, size_t size)
45 {
46 void *rtn = calloc(nitems, size);
47 if (size && rtn == NULL)
48 AllocationError();
49 return rtn;
50 }
51
52 void *DFmalloc(size_t size)
53 {
54 void *rtn = malloc(size);
55 if (size && rtn == NULL)
56 AllocationError();
57 return rtn;
58 }
59
60 void *DFrealloc(void *block, size_t size)
61 {
62 void *rtn;
63
64 rtn = realloc(block, size);
65 if (size && rtn == NULL)
66 AllocationError();
67 return rtn;
68 }
69
70 /* EOF */