//
// misc.h
//

//#include <mactypes.h>

		/*******************/
		/* 2D ARRAY MACROS */
		/*******************/

#define Alloc_2d_array(type, array, n, m)								\
{																		\
int _i;																	\
																		\
	array = (type **) AllocPtr((long)(n) * sizeof(type *));				\
	array[0] = (type *) AllocPtr((long)(n) * (long)(m) * sizeof(type));	\
	for (_i = 1; _i < (n); _i++)										\
		array[_i] = array[_i-1] + (m);									\
}


#define Free_2d_array(array)				\
{											\
		DisposePtr((Ptr)array[0]);			\
		DisposePtr((Ptr)array);				\
		array = nil;						\
}

//==========================================

#ifdef __cplusplus
extern "C" {
#endif

void	ShowSystemErr(long);
void	DoAlert(Str255 s);
Handle	AllocHandle(long);
void 	*AllocPtr(long size);

void CopyPStr(ConstStr255Param	inSourceStr, StringPtr	outDestStr);
void FloatToString(float num, Str255 string);

void DoLockPixels(GWorldPtr world);
void DoUnlockPixels(GWorldPtr world);
void DumpGWorld(GWorldPtr thisWorld, WindowPtr thisWindow, short copyMode);

void CalcFramesPerSecond(void);

void OpenLibResource(void);
void CloseLibResource(void);

void MyFlushEvents(void);
void Wait(long ticks);

#ifdef __cplusplus
}
#endif
