/*
** $PROJECT: MultiPrint - print datatype objects
**
** $VER: Init.c 39.0 (07.08.95)
**
** by
**
** Stefan Ruppert , Windthorststrasse 5 , 65439 Floersheim , GERMANY
**
** (C) Copyright 1995
** All Rights Reserved !
**
** $HISTORY:
**
** 07.08.95 : 039.000 : initial
*/

/* ------------------------------- includes ------------------------------- */

#include "MultiPrint.h"

/* ------------------------------ definition ------------------------------ */

#define PUDDLE_SIZE     4096
#define THRESH_SIZE     4096

/* ---------------------------- init function ----------------------------- */

void Free(struct GlobalData *gd)
{
	DeletePool(gd->gd_Pool);
}

#undef SysBase

struct GlobalData *Init(void)
{
	struct Library *SysBase = *((struct Library **) 4L);
	struct GlobalData *gd = NULL;
	APTR pool;

	if(SysBase->lib_Version >= 39)
	{
		if((pool = CreatePool(MEMF_ANY | MEMF_CLEAR,PUDDLE_SIZE,THRESH_SIZE)) != NULL)
		{
			if((gd = AllocPooled(pool,sizeof(struct GlobalData))) != NULL)
			{
				gd->gd_SysBase = SysBase;
				gd->gd_Pool    = pool;
			} else
				DeletePool(pool);
		}
	}

	return(gd);
}

