extensions/cstrike/sdk/smsdk_ext.cpp
author David Anderson <dvander@alliedmods.net>
Tue Dec 23 01:33:37 2008 -0500 (2008-12-23)
changeset 2471 194be299b700
parent 2289 44045ead61cd
permissions -rw-r--r--
SourceMod can now be somewhat compiled on OS X for patch sanity testing (bug 3516, r=ds).
This adds the ability for us to change the GCC version we use more flexibly.
faluco@1441
     1
/**
faluco@1441
     2
 * vim: set ts=4 :
faluco@1441
     3
 * =============================================================================
faluco@1441
     4
 * SourceMod Base Extension Code
ds@1947
     5
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
faluco@1441
     6
 * =============================================================================
faluco@1441
     7
 *
faluco@1441
     8
 * This program is free software; you can redistribute it and/or modify it under
faluco@1441
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
faluco@1441
    10
 * Free Software Foundation.
faluco@1441
    11
 * 
faluco@1441
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
faluco@1441
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
faluco@1441
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
faluco@1441
    15
 * details.
faluco@1441
    16
 *
faluco@1441
    17
 * You should have received a copy of the GNU General Public License along with
faluco@1441
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
faluco@1441
    19
 *
faluco@1441
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
faluco@1441
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
faluco@1441
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
faluco@1441
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
faluco@1441
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
faluco@1441
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
faluco@1441
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
faluco@1441
    27
 * or <http://www.sourcemod.net/license.php>.
faluco@1441
    28
 *
faluco@1441
    29
 * Version: $Id$
faluco@1441
    30
 */
faluco@1441
    31
faluco@1441
    32
#include <stdio.h>
dvander@2471
    33
#include <stdlib.h>
faluco@1441
    34
#include "smsdk_ext.h"
faluco@1441
    35
faluco@1441
    36
/**
faluco@1441
    37
 * @file smsdk_ext.cpp
faluco@1441
    38
 * @brief Contains wrappers for making Extensions easier to write.
faluco@1441
    39
 */
faluco@1441
    40
faluco@1441
    41
IExtension *myself = NULL;				/**< Ourself */
faluco@1441
    42
IShareSys *g_pShareSys = NULL;			/**< Share system */
faluco@1441
    43
IShareSys *sharesys = NULL;				/**< Share system */
faluco@1441
    44
ISourceMod *g_pSM = NULL;				/**< SourceMod helpers */
faluco@1441
    45
ISourceMod *smutils = NULL;				/**< SourceMod helpers */
faluco@1441
    46
faluco@1441
    47
#if defined SMEXT_ENABLE_FORWARDSYS
faluco@1441
    48
IForwardManager *g_pForwards = NULL;	/**< Forward system */
faluco@1441
    49
IForwardManager *forwards = NULL;		/**< Forward system */
faluco@1441
    50
#endif
faluco@1441
    51
#if defined SMEXT_ENABLE_HANDLESYS
faluco@1441
    52
IHandleSys *g_pHandleSys = NULL;		/**< Handle system */
faluco@1441
    53
IHandleSys *handlesys = NULL;			/**< Handle system */
faluco@1441
    54
#endif
faluco@1441
    55
#if defined SMEXT_ENABLE_PLAYERHELPERS
faluco@1441
    56
IPlayerManager *playerhelpers = NULL;	/**< Player helpers */
faluco@1441
    57
#endif //SMEXT_ENABLE_PLAYERHELPERS
faluco@1441
    58
#if defined SMEXT_ENABLE_DBMANAGER
faluco@1441
    59
IDBManager *dbi = NULL;					/**< DB Manager */
faluco@1441
    60
#endif //SMEXT_ENABLE_DBMANAGER
faluco@1441
    61
#if defined SMEXT_ENABLE_GAMECONF
faluco@1441
    62
IGameConfigManager *gameconfs = NULL;	/**< Game config manager */
faluco@1441
    63
#endif //SMEXT_ENABLE_DBMANAGER
faluco@1441
    64
#if defined SMEXT_ENABLE_MEMUTILS
faluco@1441
    65
IMemoryUtils *memutils = NULL;
faluco@1441
    66
#endif //SMEXT_ENABLE_DBMANAGER
faluco@1441
    67
#if defined SMEXT_ENABLE_GAMEHELPERS
faluco@1441
    68
IGameHelpers *gamehelpers = NULL;
faluco@1441
    69
#endif
faluco@1441
    70
#if defined SMEXT_ENABLE_TIMERSYS
faluco@1441
    71
ITimerSystem *timersys = NULL;
faluco@1441
    72
#endif
faluco@1441
    73
#if defined SMEXT_ENABLE_ADTFACTORY
faluco@1441
    74
IADTFactory *adtfactory = NULL;
faluco@1441
    75
#endif
faluco@1441
    76
#if defined SMEXT_ENABLE_THREADER
faluco@1441
    77
IThreader *threader = NULL;
faluco@1441
    78
#endif
faluco@1441
    79
#if defined SMEXT_ENABLE_LIBSYS
faluco@1441
    80
ILibrarySys *libsys = NULL;
faluco@1441
    81
#endif
dvander@2471
    82
#if defined SMEXT_ENABLE_PLUGINSYS
dvander@2471
    83
SourceMod::IPluginManager *plsys;
dvander@2471
    84
#endif
dvander@2471
    85
#if defined SMEXT_ENABLE_MENUS
dvander@2471
    86
IMenuManager *menus = NULL;
dvander@2471
    87
#endif
dvander@2471
    88
#if defined SMEXT_ENABLE_ADMINSYS
dvander@2471
    89
IAdminSystem *adminsys = NULL;
dvander@2471
    90
#endif
dvander@2471
    91
#if defined SMEXT_ENABLE_TEXTPARSERS
dvander@2471
    92
ITextParsers *textparsers = NULL;
dvander@2471
    93
#endif
dvander@1692
    94
#if defined SMEXT_ENABLE_USERMSGS
dvander@1692
    95
IUserMessages *usermsgs = NULL;
dvander@1692
    96
#endif
dvander@2471
    97
#if defined SMEXT_ENABLE_TRANSLATOR
dvander@2471
    98
ITranslator *translator = NULL;
dvander@2471
    99
#endif
faluco@1441
   100
faluco@1441
   101
/** Exports the main interface */
faluco@1441
   102
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
faluco@1441
   103
{
faluco@1441
   104
	return g_pExtensionIface;
faluco@1441
   105
}
faluco@1441
   106
faluco@1441
   107
SDKExtension::SDKExtension()
faluco@1441
   108
{
faluco@1441
   109
#if defined SMEXT_CONF_METAMOD
faluco@1441
   110
	m_SourceMMLoaded = false;
faluco@1441
   111
	m_WeAreUnloaded = false;
faluco@1441
   112
	m_WeGotPauseChange = false;
faluco@1441
   113
#endif
faluco@1441
   114
}
faluco@1441
   115
faluco@1441
   116
bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late)
faluco@1441
   117
{
faluco@1441
   118
	g_pShareSys = sharesys = sys;
faluco@1441
   119
	myself = me;
faluco@1441
   120
faluco@1441
   121
#if defined SMEXT_CONF_METAMOD
faluco@1441
   122
	m_WeAreUnloaded = true;
faluco@1441
   123
faluco@1441
   124
	if (!m_SourceMMLoaded)
faluco@1441
   125
	{
faluco@1441
   126
		if (error)
faluco@1441
   127
		{
faluco@1441
   128
			snprintf(error, maxlength, "Metamod attach failed");
faluco@1441
   129
		}
faluco@1441
   130
		return false;
faluco@1441
   131
	}
faluco@1441
   132
#endif
faluco@1441
   133
	SM_GET_IFACE(SOURCEMOD, g_pSM);
faluco@1441
   134
	smutils = g_pSM;
faluco@1441
   135
#if defined SMEXT_ENABLE_HANDLESYS
faluco@1441
   136
	SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys);
faluco@1441
   137
	handlesys = g_pHandleSys;
faluco@1441
   138
#endif
faluco@1441
   139
#if defined SMEXT_ENABLE_FORWARDSYS
faluco@1441
   140
	SM_GET_IFACE(FORWARDMANAGER, g_pForwards);
faluco@1441
   141
	forwards = g_pForwards;
faluco@1441
   142
#endif
faluco@1441
   143
#if defined SMEXT_ENABLE_PLAYERHELPERS
faluco@1441
   144
	SM_GET_IFACE(PLAYERMANAGER, playerhelpers);
faluco@1441
   145
#endif
faluco@1441
   146
#if defined SMEXT_ENABLE_DBMANAGER
faluco@1441
   147
	SM_GET_IFACE(DBI, dbi);
faluco@1441
   148
#endif
faluco@1441
   149
#if defined SMEXT_ENABLE_GAMECONF
faluco@1441
   150
	SM_GET_IFACE(GAMECONFIG, gameconfs);
faluco@1441
   151
#endif
faluco@1441
   152
#if defined SMEXT_ENABLE_MEMUTILS
faluco@1441
   153
	SM_GET_IFACE(MEMORYUTILS, memutils);
faluco@1441
   154
#endif
faluco@1441
   155
#if defined SMEXT_ENABLE_GAMEHELPERS
faluco@1441
   156
	SM_GET_IFACE(GAMEHELPERS, gamehelpers);
faluco@1441
   157
#endif
faluco@1441
   158
#if defined SMEXT_ENABLE_TIMERSYS
faluco@1441
   159
	SM_GET_IFACE(TIMERSYS, timersys);
faluco@1441
   160
#endif
faluco@1441
   161
#if defined SMEXT_ENABLE_ADTFACTORY
faluco@1441
   162
	SM_GET_IFACE(ADTFACTORY, adtfactory);
faluco@1441
   163
#endif
faluco@1441
   164
#if defined SMEXT_ENABLE_THREADER
faluco@1441
   165
	SM_GET_IFACE(THREADER, threader);
faluco@1441
   166
#endif
faluco@1441
   167
#if defined SMEXT_ENABLE_LIBSYS
faluco@1441
   168
	SM_GET_IFACE(LIBRARYSYS, libsys);
faluco@1441
   169
#endif
dvander@2471
   170
#if defined SMEXT_ENABLE_PLUGINSYS
dvander@2471
   171
	SM_GET_IFACE(PLUGINSYSTEM, plsys);
dvander@2471
   172
#endif
dvander@2471
   173
#if defined SMEXT_ENABLE_MENUS
dvander@2471
   174
	SM_GET_IFACE(MENUMANAGER, menus);
dvander@2471
   175
#endif
dvander@2471
   176
#if defined SMEXT_ENABLE_ADMINSYS
dvander@2471
   177
	SM_GET_IFACE(ADMINSYS, adminsys);
dvander@2471
   178
#endif
dvander@2471
   179
#if defined SMEXT_ENABLE_TEXTPARSERS
dvander@2471
   180
	SM_GET_IFACE(TEXTPARSERS, textparsers);
dvander@2471
   181
#endif
dvander@1692
   182
#if defined SMEXT_ENABLE_USERMSGS
dvander@1692
   183
	SM_GET_IFACE(USERMSGS, usermsgs);
dvander@1692
   184
#endif
dvander@2471
   185
#if defined SMEXT_ENABLE_TRANSLATOR
dvander@2471
   186
	SM_GET_IFACE(TRANSLATOR, translator);
dvander@2471
   187
#endif
faluco@1441
   188
faluco@1441
   189
	if (SDK_OnLoad(error, maxlength, late))
faluco@1441
   190
	{
faluco@1441
   191
#if defined SMEXT_CONF_METAMOD
faluco@1441
   192
		m_WeAreUnloaded = true;
faluco@1441
   193
#endif
faluco@1441
   194
		return true;
faluco@1441
   195
	}
faluco@1441
   196
faluco@1441
   197
	return false;
faluco@1441
   198
}
faluco@1441
   199
faluco@1441
   200
bool SDKExtension::IsMetamodExtension()
faluco@1441
   201
{
faluco@1441
   202
#if defined SMEXT_CONF_METAMOD
faluco@1441
   203
	return true;
faluco@1441
   204
#else
faluco@1441
   205
	return false;
faluco@1441
   206
#endif
faluco@1441
   207
}
faluco@1441
   208
faluco@1441
   209
void SDKExtension::OnExtensionPauseChange(bool state)
faluco@1441
   210
{
faluco@1441
   211
#if defined SMEXT_CONF_METAMOD
faluco@1441
   212
	m_WeGotPauseChange = true;
faluco@1441
   213
#endif
faluco@1441
   214
	SDK_OnPauseChange(state);
faluco@1441
   215
}
faluco@1441
   216
faluco@1441
   217
void SDKExtension::OnExtensionsAllLoaded()
faluco@1441
   218
{
faluco@1441
   219
	SDK_OnAllLoaded();
faluco@1441
   220
}
faluco@1441
   221
faluco@1441
   222
void SDKExtension::OnExtensionUnload()
faluco@1441
   223
{
faluco@1441
   224
#if defined SMEXT_CONF_METAMOD
faluco@1441
   225
	m_WeAreUnloaded = true;
faluco@1441
   226
#endif
faluco@1441
   227
	SDK_OnUnload();
faluco@1441
   228
}
faluco@1441
   229
faluco@1441
   230
const char *SDKExtension::GetExtensionAuthor()
faluco@1441
   231
{
faluco@1441
   232
	return SMEXT_CONF_AUTHOR;
faluco@1441
   233
}
faluco@1441
   234
faluco@1441
   235
const char *SDKExtension::GetExtensionDateString()
faluco@1441
   236
{
faluco@1441
   237
	return SMEXT_CONF_DATESTRING;
faluco@1441
   238
}
faluco@1441
   239
faluco@1441
   240
const char *SDKExtension::GetExtensionDescription()
faluco@1441
   241
{
faluco@1441
   242
	return SMEXT_CONF_DESCRIPTION;
faluco@1441
   243
}
faluco@1441
   244
faluco@1441
   245
const char *SDKExtension::GetExtensionVerString()
faluco@1441
   246
{
faluco@1441
   247
	return SMEXT_CONF_VERSION;
faluco@1441
   248
}
faluco@1441
   249
faluco@1441
   250
const char *SDKExtension::GetExtensionName()
faluco@1441
   251
{
faluco@1441
   252
	return SMEXT_CONF_NAME;
faluco@1441
   253
}
faluco@1441
   254
faluco@1441
   255
const char *SDKExtension::GetExtensionTag()
faluco@1441
   256
{
faluco@1441
   257
	return SMEXT_CONF_LOGTAG;
faluco@1441
   258
}
faluco@1441
   259
faluco@1441
   260
const char *SDKExtension::GetExtensionURL()
faluco@1441
   261
{
faluco@1441
   262
	return SMEXT_CONF_URL;
faluco@1441
   263
}
faluco@1441
   264
faluco@1441
   265
bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late)
faluco@1441
   266
{
faluco@1441
   267
	return true;
faluco@1441
   268
}
faluco@1441
   269
faluco@1441
   270
void SDKExtension::SDK_OnUnload()
faluco@1441
   271
{
faluco@1441
   272
}
faluco@1441
   273
faluco@1441
   274
void SDKExtension::SDK_OnPauseChange(bool paused)
faluco@1441
   275
{
faluco@1441
   276
}
faluco@1441
   277
faluco@1441
   278
void SDKExtension::SDK_OnAllLoaded()
faluco@1441
   279
{
faluco@1441
   280
}
faluco@1441
   281
faluco@1441
   282
#if defined SMEXT_CONF_METAMOD
faluco@1441
   283
faluco@1441
   284
PluginId g_PLID = 0;						/**< Metamod plugin ID */
faluco@1441
   285
ISmmPlugin *g_PLAPI = NULL;					/**< Metamod plugin API */
faluco@1441
   286
SourceHook::ISourceHook *g_SHPtr = NULL;	/**< SourceHook pointer */
faluco@1441
   287
ISmmAPI *g_SMAPI = NULL;					/**< SourceMM API pointer */
faluco@1441
   288
faluco@1441
   289
IVEngineServer *engine = NULL;				/**< IVEngineServer pointer */
faluco@1441
   290
IServerGameDLL *gamedll = NULL;				/**< IServerGameDLL pointer */
faluco@1441
   291
faluco@1441
   292
/** Exposes the extension to Metamod */
faluco@1441
   293
SMM_API void *PL_EXPOSURE(const char *name, int *code)
faluco@1441
   294
{
dvander@2471
   295
#if defined METAMOD_PLAPI_VERSION
faluco@1552
   296
	if (name && !strcmp(name, METAMOD_PLAPI_NAME))
dvander@2471
   297
#else
dvander@2471
   298
	if (name && !strcmp(name, PLAPI_NAME))
dvander@2471
   299
#endif
faluco@1441
   300
	{
faluco@1441
   301
		if (code)
faluco@1441
   302
		{
faluco@1441
   303
			*code = IFACE_OK;
faluco@1441
   304
		}
faluco@1441
   305
		return static_cast<void *>(g_pExtensionIface);
faluco@1441
   306
	}
faluco@1441
   307
faluco@1441
   308
	if (code)
faluco@1441
   309
	{
faluco@1441
   310
		*code = IFACE_FAILED;
faluco@1441
   311
	}
faluco@1441
   312
faluco@1441
   313
	return NULL;
faluco@1441
   314
}
faluco@1441
   315
faluco@1441
   316
bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
faluco@1441
   317
{
faluco@1441
   318
	PLUGIN_SAVEVARS();
faluco@1441
   319
dvander@2471
   320
#if !defined METAMOD_PLAPI_VERSION
dvander@2471
   321
	GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
dvander@2471
   322
	GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
dvander@2471
   323
#else
faluco@1552
   324
	GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
faluco@1552
   325
	GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
dvander@2471
   326
#endif
faluco@1441
   327
faluco@1441
   328
	m_SourceMMLoaded = true;
faluco@1441
   329
faluco@1441
   330
	return SDK_OnMetamodLoad(ismm, error, maxlen, late);
faluco@1441
   331
}
faluco@1441
   332
faluco@1441
   333
bool SDKExtension::Unload(char *error, size_t maxlen)
faluco@1441
   334
{
faluco@1441
   335
	if (!m_WeAreUnloaded)
faluco@1441
   336
	{
faluco@1441
   337
		if (error)
faluco@1441
   338
		{
faluco@1441
   339
			snprintf(error, maxlen, "This extension must be unloaded by SourceMod.");
faluco@1441
   340
		}
faluco@1441
   341
		return false;
faluco@1441
   342
	}
faluco@1441
   343
faluco@1441
   344
	return SDK_OnMetamodUnload(error, maxlen);
faluco@1441
   345
}
faluco@1441
   346
faluco@1441
   347
bool SDKExtension::Pause(char *error, size_t maxlen)
faluco@1441
   348
{
faluco@1441
   349
	if (!m_WeGotPauseChange)
faluco@1441
   350
	{
faluco@1441
   351
		if (error)
faluco@1441
   352
		{
faluco@1441
   353
			snprintf(error, maxlen, "This extension must be paused by SourceMod.");
faluco@1441
   354
		}
faluco@1441
   355
		return false;
faluco@1441
   356
	}
faluco@1441
   357
faluco@1441
   358
	m_WeGotPauseChange = false;
faluco@1441
   359
faluco@1441
   360
	return SDK_OnMetamodPauseChange(true, error, maxlen);
faluco@1441
   361
}
faluco@1441
   362
faluco@1441
   363
bool SDKExtension::Unpause(char *error, size_t maxlen)
faluco@1441
   364
{
faluco@1441
   365
	if (!m_WeGotPauseChange)
faluco@1441
   366
	{
faluco@1441
   367
		if (error)
faluco@1441
   368
		{
faluco@1441
   369
			snprintf(error, maxlen, "This extension must be unpaused by SourceMod.");
faluco@1441
   370
		}
faluco@1441
   371
		return false;
faluco@1441
   372
	}
faluco@1441
   373
faluco@1441
   374
	m_WeGotPauseChange = false;
faluco@1441
   375
faluco@1441
   376
	return SDK_OnMetamodPauseChange(false, error, maxlen);
faluco@1441
   377
}
faluco@1441
   378
faluco@1441
   379
const char *SDKExtension::GetAuthor()
faluco@1441
   380
{
faluco@1441
   381
	return GetExtensionAuthor();
faluco@1441
   382
}
faluco@1441
   383
faluco@1441
   384
const char *SDKExtension::GetDate()
faluco@1441
   385
{
faluco@1441
   386
	return GetExtensionDateString();
faluco@1441
   387
}
faluco@1441
   388
faluco@1441
   389
const char *SDKExtension::GetDescription()
faluco@1441
   390
{
faluco@1441
   391
	return GetExtensionDescription();
faluco@1441
   392
}
faluco@1441
   393
faluco@1441
   394
const char *SDKExtension::GetLicense()
faluco@1441
   395
{
faluco@1441
   396
	return SMEXT_CONF_LICENSE;
faluco@1441
   397
}
faluco@1441
   398
faluco@1441
   399
const char *SDKExtension::GetLogTag()
faluco@1441
   400
{
faluco@1441
   401
	return GetExtensionTag();
faluco@1441
   402
}
faluco@1441
   403
faluco@1441
   404
const char *SDKExtension::GetName()
faluco@1441
   405
{
faluco@1441
   406
	return GetExtensionName();
faluco@1441
   407
}
faluco@1441
   408
faluco@1441
   409
const char *SDKExtension::GetURL()
faluco@1441
   410
{
faluco@1441
   411
	return GetExtensionURL();
faluco@1441
   412
}
faluco@1441
   413
faluco@1441
   414
const char *SDKExtension::GetVersion()
faluco@1441
   415
{
faluco@1441
   416
	return GetExtensionVerString();
faluco@1441
   417
}
faluco@1441
   418
faluco@1441
   419
bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late)
faluco@1441
   420
{
faluco@1441
   421
	return true;
faluco@1441
   422
}
faluco@1441
   423
faluco@1441
   424
bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength)
faluco@1441
   425
{
faluco@1441
   426
	return true;
faluco@1441
   427
}
faluco@1441
   428
faluco@1441
   429
bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength)
faluco@1441
   430
{
faluco@1441
   431
	return true;
faluco@1441
   432
}
faluco@1441
   433
faluco@1441
   434
#endif
faluco@1441
   435
faluco@1441
   436
/* Overload a few things to prevent libstdc++ linking */
dvander@2471
   437
#if defined __linux__ || defined __APPLE__
faluco@1441
   438
extern "C" void __cxa_pure_virtual(void)
faluco@1441
   439
{
faluco@1441
   440
}
faluco@1441
   441
faluco@1441
   442
void *operator new(size_t size)
faluco@1441
   443
{
faluco@1441
   444
	return malloc(size);
faluco@1441
   445
}
faluco@1441
   446
faluco@1441
   447
void *operator new[](size_t size) 
faluco@1441
   448
{
faluco@1441
   449
	return malloc(size);
faluco@1441
   450
}
faluco@1441
   451
faluco@1441
   452
void operator delete(void *ptr) 
faluco@1441
   453
{
faluco@1441
   454
	free(ptr);
faluco@1441
   455
}
faluco@1441
   456
faluco@1441
   457
void operator delete[](void * ptr)
faluco@1441
   458
{
faluco@1441
   459
	free(ptr);
faluco@1441
   460
}
faluco@1441
   461
#endif
dvander@2471
   462