plugins/include/functions.inc
author David Anderson <dvander@alliedmods.net>
Tue Nov 27 02:19:39 2007 +0000 (2007-11-27)
changeset 1729 0f60cc4ce8bb
parent 1331 268429d2c9e4
child 1926 295f585cc4f5
permissions -rw-r--r--
added amb1191 - absolute paths
ds@1331
     1
/**
dvander@601
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@601
     4
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
ds@1330
     5
 * =============================================================================
ds@1330
     6
 *
ds@1330
     7
 * This file is part of the SourceMod/SourcePawn SDK.
dvander@601
     8
 *
ds@1330
     9
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    11
 * Free Software Foundation.
ds@1330
    12
 * 
ds@1330
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    16
 * details.
ds@1330
    17
 *
ds@1330
    18
 * You should have received a copy of the GNU General Public License along with
ds@1330
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
ds@1330
    20
 *
ds@1330
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    28
 * or <http://www.sourcemod.net/license.php>.
dvander@601
    29
 *
dvander@601
    30
 * Version: $Id$
dvander@601
    31
 */
dvander@601
    32
 
ds@621
    33
#define SP_PARAMFLAG_BYREF	(1<<0)	/**< Internal use only. */
ds@621
    34
ds@621
    35
/**
ds@621
    36
 * Describes the various ways to pass parameters to functions or forwards.
ds@621
    37
 */
ds@621
    38
enum ParamType
ds@621
    39
{
ds@621
    40
	Param_Any			= 0,							/**< Any data type can be pushed */
ds@621
    41
	Param_Cell			= (1<<1),						/**< Only basic cells can be pushed */
ds@621
    42
	Param_Float			= (2<<1),						/**< Only floats can be pushed */
ds@621
    43
	Param_String		= (3<<1)|SP_PARAMFLAG_BYREF,	/**< Only strings can be pushed */
ds@621
    44
	Param_Array			= (4<<1)|SP_PARAMFLAG_BYREF,	/**< Only arrays can be pushed */
ds@621
    45
	Param_VarArgs		= (5<<1),						/**< Same as "..." in plugins, anything can be pushed, but it will always be byref */
ds@621
    46
	Param_CellByRef		= (1<<1)|SP_PARAMFLAG_BYREF,	/**< Only a cell by reference can be pushed */
ds@621
    47
	Param_FloatByRef	= (2<<1)|SP_PARAMFLAG_BYREF		/**< Only a float by reference can be pushed */
ds@621
    48
};
ds@621
    49
ds@621
    50
/**
ds@621
    51
 * Defines how a forward iterates through plugin functions.
ds@621
    52
 */
ds@621
    53
enum ExecType
ds@621
    54
{
ds@621
    55
	ET_Ignore	= 0,	/**< Ignore all return values, return 0 */
ds@621
    56
	ET_Single	= 1,	/**< Only return the last exec, ignore all others */
ds@621
    57
	ET_Event	= 2,	/**< Acts as an event with the Actions defined in core.inc, no mid-Stops allowed, returns highest */
ds@621
    58
	ET_Hook		= 3		/**< Acts as a hook with the Actions defined in core.inc, mid-Stops allowed, returns highest */
ds@621
    59
};
ds@621
    60
ds@621
    61
/**
ds@621
    62
 * @section Flags that are used with Call_PushArrayEx() and Call_PushStringEx()
ds@621
    63
 */
ds@621
    64
#define SM_PARAM_COPYBACK		(1<<0)		/**< Copy an array/reference back after call */
ds@621
    65
#define SM_PARAM_STRING_UTF8	(1<<0)		/**< String should be UTF-8 handled */
ds@621
    66
#define SM_PARAM_STRING_COPY	(1<<1)		/**< String should be copied into the plugin */
ds@621
    67
ds@621
    68
/**
ds@621
    69
 * @endsection
ds@621
    70
 */
ds@621
    71
ds@621
    72
/**
ds@621
    73
 * @section Error codes
ds@621
    74
 */
dvander@601
    75
#define SP_ERROR_NONE					0	/**< No error occurred */
dvander@601
    76
#define SP_ERROR_FILE_FORMAT			1	/**< File format unrecognized */
dvander@601
    77
#define SP_ERROR_DECOMPRESSOR			2	/**< A decompressor was not found */
dvander@601
    78
#define SP_ERROR_HEAPLOW				3	/**< Not enough space left on the heap */
dvander@601
    79
#define SP_ERROR_PARAM					4	/**< Invalid parameter or parameter type */
dvander@601
    80
#define SP_ERROR_INVALID_ADDRESS		5	/**< A memory address was not valid */
dvander@601
    81
#define SP_ERROR_NOT_FOUND				6	/**< The object in question was not found */
dvander@601
    82
#define SP_ERROR_INDEX					7	/**< Invalid index parameter */
dvander@601
    83
#define SP_ERROR_STACKLOW				8	/**< Nnot enough space left on the stack */
dvander@601
    84
#define SP_ERROR_NOTDEBUGGING			9	/**< Debug mode was not on or debug section not found */
dvander@601
    85
#define SP_ERROR_INVALID_INSTRUCTION	10	/**< Invalid instruction was encountered */
dvander@601
    86
#define SP_ERROR_MEMACCESS				11	/**< Invalid memory access */
dvander@601
    87
#define SP_ERROR_STACKMIN				12	/**< Stack went beyond its minimum value */
dvander@601
    88
#define SP_ERROR_HEAPMIN				13  /**< Heap went beyond its minimum value */
dvander@601
    89
#define SP_ERROR_DIVIDE_BY_ZERO			14	/**< Division by zero */
dvander@601
    90
#define SP_ERROR_ARRAY_BOUNDS			15	/**< Array index is out of bounds */
dvander@601
    91
#define SP_ERROR_INSTRUCTION_PARAM		16	/**< Instruction had an invalid parameter */
dvander@601
    92
#define SP_ERROR_STACKLEAK				17  /**< A native leaked an item on the stack */
dvander@601
    93
#define SP_ERROR_HEAPLEAK				18  /**< A native leaked an item on the heap */
dvander@601
    94
#define SP_ERROR_ARRAY_TOO_BIG			19	/**< A dynamic array is too big */
dvander@601
    95
#define SP_ERROR_TRACKER_BOUNDS			20	/**< Tracker stack is out of bounds */
dvander@601
    96
#define SP_ERROR_INVALID_NATIVE			21	/**< Native was pending or invalid */
dvander@601
    97
#define SP_ERROR_PARAMS_MAX				22	/**< Maximum number of parameters reached */
dvander@601
    98
#define SP_ERROR_NATIVE					23	/**< Error originates from a native */
dvander@601
    99
#define SP_ERROR_NOT_RUNNABLE			24	/**< Function or plugin is not runnable */
dvander@601
   100
#define SP_ERROR_ABORTED				25	/**< Function call was aborted */
dvander@601
   101
dvander@601
   102
/**
ds@621
   103
 * @endsection
ds@621
   104
 */
ds@621
   105
ds@621
   106
/**
ds@621
   107
 * Gets a function id from a function name. 
ds@621
   108
 *
ds@621
   109
 * @param plugin			Handle of the plugin that contains the function.
ds@621
   110
							Pass INVALID_HANDLE to search in the calling plugin.
ds@621
   111
 * @param name				Name of the function.
ds@621
   112
 * @return 					Function id or INVALID_FUNCTION if not found.
ds@621
   113
 * @error					Invalid or corrupt plugin handle.
ds@621
   114
 */
ds@621
   115
native Function:GetFunctionByName(Handle:plugin, const String:name[]);
ds@621
   116
ds@621
   117
/**
ds@621
   118
 * Creates a global forward.
ds@621
   119
 *
ds@621
   120
 * @note The name used to create the forward is used as its public function in all target plugins.
ds@621
   121
 * @note This is ideal for global, static forwards that are never changed.
ds@635
   122
 * @note Global forwards cannot be cloned.
ds@635
   123
 * @note Use CloseHandle() to destroy these.
ds@621
   124
 *
ds@621
   125
 * @param name				Name of public function to use in forward.
ds@621
   126
 * @param type				Execution type to be used.
ds@621
   127
 * @param ...				Variable number of parameter types (up to 32).
ds@621
   128
 * @return 					Handle to new global forward.
ds@621
   129
 * @error					More than 32 paramater types passed.
ds@621
   130
 */
ds@634
   131
native Handle:CreateGlobalForward(const String:name[], ExecType:type, ParamType:...);
ds@621
   132
ds@621
   133
/**
ds@621
   134
 * Creates a private forward.
ds@621
   135
 *
ds@621
   136
 * @note No functions are automatically added. Use AddToForward() to do this.
ds@635
   137
 * @note Private forwards can be cloned.
ds@635
   138
 * @note Use CloseHandle() to destroy these.
ds@621
   139
 *
ds@621
   140
 * @param type				Execution type to be used.
ds@621
   141
 * @param ...				Variable number of parameter types (up to 32).
ds@621
   142
 * @return 					Handle to new private forward.
ds@621
   143
 * @error					More than 32 paramater types passed.
ds@621
   144
 */
ds@634
   145
native Handle:CreateForward(ExecType:type, ParamType:...);
ds@621
   146
ds@621
   147
/**
ds@621
   148
 * Returns the number of functions in a global or private forward's call list.
ds@621
   149
 *
ds@621
   150
 * @param fwd				Handle to global or private forward.
ds@621
   151
 * @return					Number of functions in forward.
ds@621
   152
 * @error					Invalid or corrupt forward handle.
ds@621
   153
 */
ds@621
   154
native GetForwardFunctionCount(Handle:fwd);
ds@621
   155
ds@621
   156
/**
ds@621
   157
 * Adds a function to a private forward's call list.
ds@621
   158
 *
ds@621
   159
 * @note Cannot be used during an incompleted call.
ds@621
   160
 *
ds@621
   161
 * @param fwd				Handle to private forward.
ds@621
   162
 * @param plugin			Handle of the plugin that contains the function.
ds@621
   163
 *							Pass INVALID_HANDLE to specify the calling plugin.
ds@621
   164
 * @param func				Function to add to forward.
ds@621
   165
 * @return					True on success, false otherwise.
ds@621
   166
 * @error					Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function.
ds@621
   167
 */
ds@621
   168
native bool:AddToForward(Handle:fwd, Handle:plugin, Function:func);
ds@621
   169
ds@621
   170
/**
ds@621
   171
 * Removes a function from a private forward's call list.
ds@621
   172
 *
ds@621
   173
 * @note Only removes one instance.
ds@621
   174
 * @note Functions will be removed automatically if their parent plugin is unloaded.
ds@621
   175
 *
ds@621
   176
 * @param fwd				Handle to private forward.
ds@621
   177
 * @param plugin			Handle of the plugin that contains the function.
ds@621
   178
 *							Pass INVALID_HANDLE to specify the calling plugin.
ds@621
   179
 * @param func				Function to remove from forward.
ds@621
   180
 * @return					True on success, false otherwise.
ds@621
   181
 * @error					Invalid or corrupt private forward handle, invalid or corrupt plugin handle, or invalid function.
ds@621
   182
 */
ds@621
   183
native bool:RemoveFromForward(Handle:fwd, Handle:plugin, Function:func);
ds@621
   184
ds@621
   185
/**
ds@621
   186
 * Removes all instances of a plugin from a private forward's call list.
ds@621
   187
 *
ds@621
   188
 * @note Functions will be removed automatically if their parent plugin is unloaded.
ds@621
   189
 *
ds@621
   190
 * @param fwd				Handle to private forward.
ds@621
   191
 * @param plugin			Handle of the plugin to remove instances of.
ds@621
   192
 *							Pass INVALID_HANDLE to specify the calling plugin.
ds@621
   193
 * @return					Number of functions removed from forward.
ds@621
   194
 * @error					Invalid or corrupt private forward handle or invalid or corrupt plugin handle.
ds@621
   195
 */
ds@621
   196
native RemoveAllFromForward(Handle:fwd, Handle:plugin);
ds@621
   197
ds@621
   198
/**
ds@621
   199
 * Starts a call to functions in a forward's call list.
ds@621
   200
 *
ds@621
   201
 * @note Cannot be used during an incompleted call.
ds@621
   202
 *
ds@621
   203
 * @param fwd				Handle to global or private forward.
ds@621
   204
 * @noreturn
ds@621
   205
 * @error					Invalid or corrupt forward handle or called before another call has completed.
ds@621
   206
 */
ds@621
   207
native Call_StartForward(Handle:fwd);
ds@621
   208
ds@621
   209
/**
ds@621
   210
 * Starts a call to a function.
ds@621
   211
 *
ds@621
   212
 * @note Cannot be used during an incompleted call.
ds@621
   213
 *
ds@621
   214
 * @param plugin			Handle of the plugin that contains the function.
ds@621
   215
 *							Pass INVALID_HANDLE to specify the calling plugin.
ds@621
   216
 * @param func				Function to call.
ds@621
   217
 * @noreturn
ds@621
   218
 * @error					Invalid or corrupt plugin handle, invalid function, or called before another call has completed.
ds@621
   219
 */
ds@621
   220
native Call_StartFunction(Handle:plugin, Function:func);
ds@621
   221
ds@621
   222
/**
ds@621
   223
 * Pushes a cell onto the current call.
ds@621
   224
 *
ds@621
   225
 * @note Cannot be used before a call has been started.
ds@621
   226
 *
ds@621
   227
 * @param value				Cell value to push.
ds@621
   228
 * @noreturn
ds@621
   229
 * @error					Called before a call has been started.
ds@621
   230
 */
dvander@815
   231
native Call_PushCell(any:value);
ds@621
   232
ds@621
   233
/**
ds@621
   234
 * Pushes a cell by reference onto the current call.
ds@621
   235
 *
ds@621
   236
 * @note Cannot be used before a call has been started.
ds@621
   237
 *
ds@621
   238
 * @param value				Cell reference to push.
ds@621
   239
 * @noreturn
ds@621
   240
 * @error					Called before a call has been started.
ds@621
   241
 */
dvander@815
   242
native Call_PushCellRef(&any:value);
ds@621
   243
ds@621
   244
/**
ds@621
   245
 * Pushes a float onto the current call.
ds@621
   246
 *
ds@621
   247
 * @note Cannot be used before a call has been started.
ds@621
   248
 *
ds@621
   249
 * @param value				Floating point value to push.
ds@621
   250
 * @noreturn
ds@621
   251
 * @error					Called before a call has been started.
ds@621
   252
 */
ds@621
   253
native Call_PushFloat(Float:value);
ds@621
   254
ds@621
   255
/**
ds@621
   256
 * Pushes a float by reference onto the current call.
ds@621
   257
 *
ds@621
   258
 * @note Cannot be used before a call has been started.
ds@621
   259
 *
ds@621
   260
 * @param value				Floating point reference to push.
ds@621
   261
 * @noreturn
ds@621
   262
 * @error					Called before a call has been started.
ds@621
   263
 */
ds@621
   264
native Call_PushFloatRef(&Float:value);
ds@621
   265
ds@621
   266
/**
ds@621
   267
 * Pushes an array onto the current call.
ds@621
   268
 *
ds@621
   269
 * @note Changes to array are not copied back to caller. Use PushArrayEx() to do this.
ds@621
   270
 * @note Cannot be used before a call has been started.
ds@621
   271
 *
ds@621
   272
 * @param value				Array to push.
ds@621
   273
 * @param size				Size of array.
ds@621
   274
 * @noreturn
ds@621
   275
 * @error					Called before a call has been started.
ds@621
   276
 */
dvander@815
   277
native Call_PushArray(const any:value[], size);
ds@621
   278
ds@621
   279
/**
ds@621
   280
 * Pushes an array onto the current call.
ds@621
   281
 *
ds@621
   282
 * @note Cannot be used before a call has been started.
ds@621
   283
 *
ds@621
   284
 * @param value				Array to push.
ds@621
   285
 * @param size				Size of array.
ds@621
   286
 * @param cpflags			Whether or not changes should be copied back to the input array.
ds@621
   287
 *							See SP_PARAM_* constants for details.
ds@621
   288
 * @noreturn
ds@621
   289
 * @error					Called before a call has been started.
ds@621
   290
 */
dvander@815
   291
native Call_PushArrayEx(any:value[], size, cpflags);
ds@621
   292
ds@621
   293
/**
ds@621
   294
 * Pushes a string onto the current call.
ds@621
   295
 *
ds@621
   296
 * @note Changes to string are not copied back to caller. Use PushStringEx() to do this.
ds@621
   297
 * @note Cannot be used before a call has been started.
ds@621
   298
 *
ds@621
   299
 * @param value				String to push.
ds@621
   300
 * @noreturn
ds@621
   301
 * @error					Called before a call has been started.
ds@621
   302
 */
ds@621
   303
native Call_PushString(const String:value[]);
ds@621
   304
ds@621
   305
/**
ds@621
   306
 * Pushes a string onto the current call.
ds@621
   307
 *
ds@621
   308
 * @note Cannot be used before a call has been started.
ds@621
   309
 *
ds@621
   310
 * @param value				String to push.
ds@621
   311
 * @param length			Length of string buffer.
ds@621
   312
 * @param szflags			Flags determining how string should be handled.
ds@621
   313
 *							See SP_PARAM_STRING_* constants for details.
ds@621
   314
 * @param cpflags			Whether or not changes should be copied back to the input array.
ds@621
   315
 *							See SP_PARAM_* constants for details.		
ds@621
   316
 * @noreturn
ds@621
   317
 * @error					Called before a call has been started.
ds@621
   318
 */
ds@621
   319
native Call_PushStringEx(String:value[], length, szflags, cpflags);
ds@621
   320
ds@621
   321
/**
ds@621
   322
 * Completes a call to a function or forward's call list.
ds@621
   323
 *
ds@621
   324
 * @note Cannot be used before a call has been started.
ds@621
   325
 *
ds@621
   326
 * @param result			Return value of function or forward's call list.		
ds@621
   327
 * @return					SP_ERROR_NONE on success, any other integer on failure.
ds@621
   328
 * @error					Called before a call has been started.
ds@621
   329
 */
dvander@982
   330
native Call_Finish(&any:result=0);
ds@621
   331
ds@621
   332
/**
ds@621
   333
 * Cancels a call to a function or forward's call list.
ds@621
   334
 *
ds@621
   335
 * @note Cannot be used before a call has been started.
ds@621
   336
 *		
ds@621
   337
 * @noreturn
ds@621
   338
 * @error					Called before a call has been started.
ds@621
   339
 */
ds@621
   340
native Call_Cancel();
ds@621
   341
ds@621
   342
/**
dvander@601
   343
 * Defines a native function.
dvander@601
   344
 *
dvander@601
   345
 * It is not necessary to validate the parameter count 
dvander@601
   346
 *
dvander@601
   347
 * @param plugin			Handle of the calling plugin.
dvander@601
   348
 * @param numParams			Number of parameters passed to the native.
dvander@601
   349
 * @return 					Value for the native call to return.
dvander@601
   350
 */
dvander@601
   351
functag NativeCall public(Handle:plugin, numParams);
dvander@601
   352
dvander@601
   353
/**
dvander@601
   354
 * Creates a dynamic native.  This should only be called in AskPluginLoad(), or 
dvander@601
   355
 * else you risk not having your native shared with other plugins.
dvander@601
   356
 *
dvander@601
   357
 * @param name				Name of the dynamic native; must be unique amongst
dvander@764
   358
 *							all other registered dynamic natives.
dvander@601
   359
 * @param func				Function to use as the dynamic native.
dvander@601
   360
 * @noreturn
dvander@601
   361
 */
dvander@601
   362
native CreateNative(const String:name[], NativeCall:func);
dvander@601
   363
dvander@601
   364
/**
dvander@601
   365
 * Throws an error in the calling plugin of a native, instead of your own plugin.
dvander@601
   366
 *
dvander@601
   367
 * @param error				Error code to use.
dvander@601
   368
 * @param fmt				Error message format.
dvander@601
   369
 * @param ...				Format arguments.
dvander@601
   370
 */
ds@634
   371
native ThrowNativeError(error, const String:fmt[], any:...);
dvander@601
   372
dvander@601
   373
/**
dvander@601
   374
 * Retrieves the string length from a native parameter string.  This is useful 
dvander@601
   375
 * fetching the entire string using dynamic arrays.
dvander@601
   376
 * @note If this function succeeds, Get/SetNativeString will also succeed.
dvander@601
   377
 *
dvander@601
   378
 * @param param				Parameter number, starting from 1.
dvander@601
   379
 * @param length			Stores the length of the string.
ds@621
   380
 * @return					SP_ERROR_NONE on success, any other integer on failure.
dvander@601
   381
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   382
 */
dvander@601
   383
native GetNativeStringLength(param, &length);
dvander@601
   384
dvander@601
   385
/**
dvander@601
   386
 * Retrieves a string from a native parameter.
dvander@601
   387
 * @note Output conditions are undefined on failure.
dvander@601
   388
 *
dvander@601
   389
 * @param param				Parameter number, starting from 1.
dvander@601
   390
 * @param buffer			Buffer to store the string in.
dvander@601
   391
 * @param maxlength			Maximum length of the buffer.
dvander@601
   392
 * @param bytes				Optionally store the number of bytes written.
dvander@601
   393
 * @return					SP_ERROR_NONE on success, any other integer on failure.
dvander@601
   394
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   395
 */
dvander@601
   396
native GetNativeString(param, String:buffer[], maxlength, &bytes=0);
dvander@601
   397
dvander@601
   398
/**
dvander@601
   399
 * Sets a string in a native parameter.
dvander@601
   400
 * @note Output conditions are undefined on failure.
dvander@601
   401
 *
dvander@601
   402
 * @param param				Parameter number, starting from 1.
dvander@601
   403
 * @param source			Source string to use.
dvander@601
   404
 * @param maxlength			Maximum number of bytes to write.
dvander@601
   405
 * @param utf8				If false, string will not be written
dvander@601
   406
 *							with UTF8 safety.
dvander@601
   407
 * @param bytes				Optionally store the number of bytes written.
dvander@601
   408
 * @return					SP_ERROR_NONE on success, any other integer on failure.
dvander@601
   409
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   410
 */
dvander@601
   411
native SetNativeString(param, const String:source[], maxlength, bool:utf8=true, &bytes=0);
dvander@601
   412
dvander@601
   413
/**
dvander@601
   414
 * Gets a cell from a native parameter.
dvander@601
   415
 *
dvander@601
   416
 * @param param				Parameter number, starting from 1.
dvander@601
   417
 * @return					Cell value at the parameter number.
dvander@601
   418
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   419
 */
ds@872
   420
native any:GetNativeCell(param);
dvander@601
   421
dvander@601
   422
/**
dvander@601
   423
 * Gets a cell from a native parameter, by reference.
dvander@601
   424
 *
dvander@601
   425
 * @param param				Parameter number, starting from 1.
dvander@601
   426
 * @return					Cell value at the parameter number.
dvander@601
   427
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   428
 */
ds@872
   429
native any:GetNativeCellRef(param);
dvander@601
   430
dvander@601
   431
/**
dvander@601
   432
 * Sets a cell from a native parameter, by reference.
dvander@601
   433
 *
dvander@601
   434
 * @param param				Parameter number, starting from 1.
dvander@601
   435
 * @param value				Cell value at the parameter number to set by reference.
dvander@601
   436
 * @noreturn
dvander@601
   437
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   438
 */
dvander@815
   439
native SetNativeCellRef(param, any:value);
dvander@601
   440
dvander@601
   441
/**
dvander@601
   442
 * Gets an array from a native parameter (always by reference).
dvander@601
   443
 *
dvander@601
   444
 * @param param				Parameter number, starting from 1.
dvander@601
   445
 * @param local				Local array to copy into.
dvander@601
   446
 * @param size				Maximum size of local array.
dvander@601
   447
 * @return					SP_ERROR_NONE on success, anything else on failure.
dvander@601
   448
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   449
 */
dvander@815
   450
native GetNativeArray(param, any:local[], size);
dvander@601
   451
dvander@601
   452
/**
dvander@601
   453
 * Copies a local array into a native parameter array (always by reference).
dvander@601
   454
 * 
dvander@601
   455
 * @param param				Parameter number, starting from 1.
dvander@601
   456
 * @param local				Local array to copy from.
dvander@601
   457
 * @param size				Size of the local array to copy.
dvander@601
   458
 * @return					SP_ERROR_NONE on success, anything else on failure.
dvander@601
   459
 * @error					Invalid parameter number or calling from a non-native function.
dvander@601
   460
 */
dvander@815
   461
native SetNativeArray(param, const any:local[], size);
dvander@601
   462
dvander@601
   463
/**
dvander@601
   464
 * Formats a string using parameters from a native.
dvander@601
   465
 *
dvander@601
   466
 * @note All parameter indexes start at 1.
dvander@601
   467
 * @note If the input and output buffers overlap, the contents
dvander@601
   468
 *  of the output buffer at the end is undefined.
dvander@601
   469
 *
dvander@601
   470
 * @param out_param			Output parameter number to write to.  If 0, out_string is used.
dvander@601
   471
 * @param fmt_param			Format parameter number.  If 0, fmt_string is used.
dvander@601
   472
 * @param vararg_param		First variable parameter number.
dvander@601
   473
 * @param out_len			Output string buffer maximum length (always required).
dvander@601
   474
 * @param written			Optionally stores the number of bytes written.
dvander@601
   475
 * @param out_string		Output string buffer to use if out_param is not used.
dvander@601
   476
 * @param fmt_string		Format string to use if fmt_param is not used.
dvander@601
   477
 * @return					SP_ERROR_NONE on success, anything else on failure.
dvander@601
   478
 */
dvander@601
   479
native FormatNativeString(out_param, 
dvander@601
   480
						  fmt_param, 
dvander@601
   481
						  vararg_param, 
dvander@601
   482
						  out_len,
dvander@601
   483
						  &written=0,
dvander@601
   484
						  String:out_string[]="",
dvander@601
   485
						  const String:fmt_string[]="");
dvander@601
   486
ds@872
   487
/**
ds@872
   488
 * Backwards compatibility stock - use GetNativeCell or GetNativeCellRef
ds@872
   489
 *
ds@872
   490
 * @deprecated
ds@872
   491
 */
ds@1268
   492
#pragma deprecated Use GetNativeCell() or GetNativeCellRef() instead
dvander@601
   493
stock Float:GetNativeFloat(param, bool:byref)
dvander@601
   494
{
dvander@601
   495
	if (!byref)
dvander@601
   496
	{
dvander@601
   497
		return Float:GetNativeCell(param);
dvander@601
   498
	} else {
dvander@601
   499
		return Float:GetNativeCellRef(param);
dvander@601
   500
	}
dvander@601
   501
}
ds@872
   502
ds@872
   503
/**
ds@872
   504
 * Backwards compatibility stock - use GetNativeCell or GetNativeCellRef
ds@872
   505
 *
ds@872
   506
 * @deprecated
ds@872
   507
 */
ds@1268
   508
#pragma deprecated Use GetNativeCell() or GetNativeCellRef() instead
dvander@601
   509
stock Handle:GetNativeHandle(param, bool:byref)
dvander@601
   510
{
dvander@601
   511
	if (!byref)
dvander@601
   512
	{
dvander@601
   513
		return Handle:GetNativeCell(param);
dvander@601
   514
	} else {
dvander@601
   515
		return Handle:GetNativeCellRef(param);
dvander@601
   516
	}
dvander@601
   517
}