2002-04-14 10:15:06 +00:00
|
|
|
|
/* ---------- dfalloc.c ---------- */
|
2002-03-28 12:15:40 +00:00
|
|
|
|
|
2002-04-14 10:15:06 +00:00
|
|
|
|
//#define WIN32_LEAN_AND_MEAN
|
2002-03-28 12:15:40 +00:00
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
2002-04-14 10:15:06 +00:00
|
|
|
|
#include "dflat32/dflat.h"
|
2002-03-28 12:15:40 +00:00
|
|
|
|
|
|
|
|
|
static void AllocationError(void)
|
|
|
|
|
{
|
|
|
|
|
static BOOL OnceIn = FALSE;
|
|
|
|
|
extern jmp_buf AllocError;
|
|
|
|
|
extern BOOL AllocTesting;
|
|
|
|
|
static char *ErrMsg[] = {
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ",
|
|
|
|
|
"<EFBFBD> Out of Memory! <20>",
|
|
|
|
|
"R<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>U"
|
|
|
|
|
};
|
|
|
|
|
int x, y;
|
|
|
|
|
CHAR_INFO savbuf[54];
|
|
|
|
|
DFRECT rc = {30,11,47,13};
|
|
|
|
|
INPUT_RECORD ir;
|
|
|
|
|
|
|
|
|
|
if (!OnceIn)
|
|
|
|
|
{
|
|
|
|
|
OnceIn = TRUE;
|
|
|
|
|
/* ------ close all windows ------ */
|
|
|
|
|
DfSendMessage(ApplicationWindow, CLOSE_WINDOW, 0, 0);
|
|
|
|
|
GetVideo(rc, savbuf);
|
|
|
|
|
for (x = 0; x < 18; x++)
|
|
|
|
|
{
|
|
|
|
|
for (y = 0; y < 3; y++)
|
|
|
|
|
{
|
|
|
|
|
int c = (255 & (*(*(ErrMsg+y)+x))) | 0x7000;
|
|
|
|
|
PutVideoChar(x+rc.lf, y+rc.tp, c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GetKey(&ir);
|
|
|
|
|
StoreVideo(rc, savbuf);
|
|
|
|
|
if (AllocTesting)
|
|
|
|
|
longjmp(AllocError, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *DFcalloc(size_t nitems, size_t size)
|
|
|
|
|
{
|
|
|
|
|
void *rtn = calloc(nitems, size);
|
|
|
|
|
if (size && rtn == NULL)
|
|
|
|
|
AllocationError();
|
|
|
|
|
return rtn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *DFmalloc(size_t size)
|
|
|
|
|
{
|
|
|
|
|
void *rtn = malloc(size);
|
|
|
|
|
if (size && rtn == NULL)
|
|
|
|
|
AllocationError();
|
|
|
|
|
return rtn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *DFrealloc(void *block, size_t size)
|
|
|
|
|
{
|
|
|
|
|
void *rtn;
|
|
|
|
|
|
|
|
|
|
rtn = realloc(block, size);
|
|
|
|
|
if (size && rtn == NULL)
|
|
|
|
|
AllocationError();
|
|
|
|
|
return rtn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* EOF */
|