/****************************************************************************************************

		COMSafeUtilities.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Arnaud
		Date:	3/17/2005

****************************************************************************************************/

#ifndef __COMSafeUtilities__
#define __COMSafeUtilities__

#if CP_PRAGMA_ONCE
#pragma once
#endif

// this file is only used when inside an extension
#ifdef qIsInExtension

#include "MCBasicTypes.h"


struct IMCUnknown;
struct IShUtilities;
struct IShDebugUtilities;
struct IShMemoryUtilities;
struct IShSafeUtilities;
struct IShSMPUtilities;
struct IShResourceUtilities;
struct IShFileUtilities;
struct IShFileFormatUtilities;
struct IShComponentUtilities;
struct IShThreadUtilities;
struct IMCUnknown;
struct IChangeManager;
struct IShActionManager;
struct IShMenuUtilities;
struct IShPartUtilities;
struct IShFileStream;
struct IShFileFormatUtilities;
struct IShPersonalityUtilities;
struct IShDragAndDropUtilities;
struct IShPlatformUtilities;            // Private
struct IMFClipboard;
struct IShMouseUtilities;
struct IShSoundUtilities;
struct IShParamUtilities;

class  TMCAsciiTranslationTable;


/*****************************************************************************\
*                                                                             *
*   Utilities pointers                                                        *
*                                                                             *
\*****************************************************************************/
// Utilities pointers are NULL by default, and are initialized by InitSafeUtilities()

void InitSafeUtilities		(IMCUnknown* utilities);
void CleanUpSafeUtilities	();

extern IShUtilities*					gShellUtilities;
extern IShMemoryUtilities*				gMemoryUtilities;
extern IShDebugUtilities*				gDebugUtilities;
extern IShSafeUtilities*				gShSafeUtilities;
extern IShSMPUtilities*					gShellSMPUtilities;
extern IShResourceUtilities*			gResourceUtilities;
extern IShFileUtilities*				gFileUtilities;
extern IShFileFormatUtilities*			gFileFormatUtilities;
extern IShThreadUtilities*				gShellThreadUtilities;
extern IShComponentUtilities*			gComponentUtilities;
extern IShActionManager*				gActionManager;
extern IShMenuUtilities*				gMenuUtilities;
extern IShPartUtilities*				gPartUtilities;
extern IShPersonalityUtilities*			gPersonalityUtilities;
extern IShDragAndDropUtilities*			gDragAndDropUtilities;
extern IChangeManager*					gChangeManager;
extern IMFClipboard*					gClipboardUtilities;
extern IShMouseUtilities*				gMouseUtilities;
extern IShSoundUtilities*				gSoundUtilities;
extern IShParamUtilities*				gParamUtilities;

/*****************************************************************************\
*                                                                             *
*   Memory management (uses the application's memory allocator)				  *
*                                                                             *
\*****************************************************************************/

void*  MCnew						(uint32  size);

void*  MCmalloc						(MCSize  size);
void*  MCcalloc						(uint32 nmemb, uint32 size);
void*  MCrealloc					(void* ptr, uint32  size);
void   MCfree						(void* ptr);

void*  MCmallocAligned				(uint32 size, uint8 alignPower);
void   MCfreeAligned				(void* ptr);

void*  MChighmallocPSHost			(int32  size);
void   MChighfreePSHost				(void* ptr);
void*  MChighlockPSHost				(void* ptr, boolean moveHigh);
void   MChighunlockPSHost			(void* ptr);
int32  MCgetPIHandleSizePSHost		(void* ptr);
int32  MCsetPIHandleSizePSHost		(void* ptr, int32 newSize);


/*****************************************************************************\
*                                                                             *
*   string table                                                              *
*                                                                             *
\*****************************************************************************/

TMCAsciiTranslationTable*			GetAsciiTranslationTable();

struct IMCFile;

void	GetFileForCurrentLanguage(IMCFile* file, boolean checkIfFileExists, boolean addSpace);

#endif // qIsInExtension

#endif
