home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kyūkyoku!! X68000 Emulator
/
X68000Book.dat
/
mac
/
OLS
/
X68000
/
Ko-Window
/
kow142s.lzh
/
corlib
/
WindowHeapAlloc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-19
|
786b
|
48 lines
/* 1995 H.Ogasawara (COR.) */
#include <sys_doslib.h>
#include <wlib.h>
extern int WindowProcessID;
extern int WindowHeapSize;
extern void _HeapInit();
#ifdef XC
extern char *_BEND,
*_HSTA,
*_HEND;
#endif
#ifdef LIBC
extern char *_esta,
*_HSTA,
*_HEND;
# define _BEND _esta
#endif
int
KoWindowHeapAlloc()
{
ProcessInfo *pp= WindowGetProcessInfo( WindowProcessID );
char *heap;
if( pp->HeapSize > 0 ){
MFREE( pp->Heap );
pp->HeapSize= 0;
}
if( WindowHeapSize > 0 ){
heap= MALLOC( WindowHeapSize );
if( heap > (char*)0x1000000 )
return FALSE;
_HSTA= heap;
_HEND= _HSTA+ WindowHeapSize;
#ifdef XC
_HeapInit();
#endif
pp->Heap= heap;
}else
_HEND= _HSTA;
pp->HeapSize= WindowHeapSize;
return TRUE;
}