Added charsmax() define, as a less typo-prone utility for sizeof(array)-1.

Added any: syntax to all variable args that need it, added proper {Float,_}: tags to some that didn't have it but should have.
This commit is contained in:
Steve Dudenhoeffer 2007-05-18 15:20:34 +00:00
parent 65748001f0
commit 66feed1d2b
7 changed files with 14 additions and 12 deletions

View File

@ -172,7 +172,7 @@ stock cmd_target(id,const arg[],flags = 1)
return player; return player;
} }
stock show_activity( id, const name[], {Float,_}: ... ) stock show_activity( id, const name[], any:... )
{ {
new buffer[128]; new buffer[128];
format_args( buffer , 127 , 2 ); format_args( buffer , 127 , 2 );

View File

@ -746,7 +746,7 @@ native register_library(const library[]);
/* Logs an error in your native, and breaks into the debugger. /* Logs an error in your native, and breaks into the debugger.
* Acts as if the calling plugin had the error. * Acts as if the calling plugin had the error.
*/ */
native log_error(error, const fmt[], ...); native log_error(error, const fmt[], any:...);
// More Dynamic Native System Stuff // More Dynamic Native System Stuff
// Each of these natives affects one of the parameters sent to your native. // Each of these natives affects one of the parameters sent to your native.
@ -949,7 +949,7 @@ native set_module_filter(const handler[]);
* Note that the plugin's filename is prepending to your message: * Note that the plugin's filename is prepending to your message:
* [myplugin.amxx] MESSAGE * [myplugin.amxx] MESSAGE
*/ */
native abort(error, const fmt[]="", {Float,_}:...); native abort(error, const fmt[]="", any:...);
/** /**
* Checks if a specific module is loaded. This is the exact same method AMX Mod X * Checks if a specific module is loaded. This is the exact same method AMX Mod X
@ -1016,7 +1016,7 @@ native set_fail_state(const err_msg[]);
//Returns the reference address of the variable passed in. //Returns the reference address of the variable passed in.
//This address is local to the plugin, and not a full CPU address //This address is local to the plugin, and not a full CPU address
//pass the variable as the first parameter //pass the variable as the first parameter
native get_var_addr(...); native get_var_addr(any:...);
//Returns the value of an address. This dereferences something returned by //Returns the value of an address. This dereferences something returned by
// get_var_addr(). Attempting to pass in a value beyond stack or heap limits // get_var_addr(). Attempting to pass in a value beyond stack or heap limits
@ -1060,7 +1060,7 @@ native PrepareArray(const array[], size, copyback=0);
* executes a forward. returns result in ret. * executes a forward. returns result in ret.
* returns 1 for success, 0 for failure. * returns 1 for success, 0 for failure.
*/ */
native ExecuteForward(forward_handle, &ret, {Float,_}:...); native ExecuteForward(forward_handle, &ret, any:...);
/** /**
* Destroys/deallocates any type of forward * Destroys/deallocates any type of forward

View File

@ -53,13 +53,13 @@ native Sql:dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxle
* If greater than zero, make sure to call dbi_free_result() on it! * If greater than zero, make sure to call dbi_free_result() on it!
* The return is a handle to the result set * The return is a handle to the result set
*/ */
native Result:dbi_query(Sql:_sql, _query[], {Float,_}:...); native Result:dbi_query(Sql:_sql, _query[], any:...);
/* Has the same usage as dbi_query, but this native returns by /* Has the same usage as dbi_query, but this native returns by
* reference the number of rows affected in the query. If the * reference the number of rows affected in the query. If the
* query fails rows will be equal to -1. * query fails rows will be equal to -1.
*/ */
native Result:dbi_query2(Sql:_sql, &rows, _query[], {Float,_}:...); native Result:dbi_query2(Sql:_sql, &rows, _query[], any:...);
/* Returns 0 on failure or End of Results. /* Returns 0 on failure or End of Results.
* Advances result pointer by one row. * Advances result pointer by one row.

View File

@ -88,7 +88,7 @@ native forward_return(type,any:...);
*/ */
native get_orig_retval({Float,_}:...); native get_orig_retval({Float,_}:...);
native engfunc(type,{Float,Sql,Result,AlertType,_}:...); native engfunc(type,any:...);
native dllfunc(type,any:...); native dllfunc(type,any:...);
//only use this with functions that pass a Trace //only use this with functions that pass a Trace

View File

@ -29,7 +29,7 @@ native nvault_open(const name[]);
/* Gets a vault value by returning an int /* Gets a vault value by returning an int
* setting a byref float or setting a string + maxlength * setting a byref float or setting a string + maxlength
*/ */
native nvault_get(vault, const key[], ...); native nvault_get(vault, const key[], {Float,_}:...);
/* Looks up a vault value for full information /* Looks up a vault value for full information
* Returns 0 if the entry is not found * Returns 0 if the entry is not found

View File

@ -59,7 +59,7 @@ native Handle:SQL_Connect(Handle:cn_tuple, &errcode, error[], maxlength);
* The query must always be freed. * The query must always be freed.
* This does not actually do the query! * This does not actually do the query!
*/ */
native Handle:SQL_PrepareQuery(Handle:db, const fmt[], {Float,_}:...); native Handle:SQL_PrepareQuery(Handle:db, const fmt[], any:...);
/** /**
@ -295,7 +295,7 @@ stock SQL_SimpleQuery(Handle:db, const query[], error[]="", maxlength=0, &rows=0
* Use this for executing a query where you don't care about the result. * Use this for executing a query where you don't care about the result.
* Returns 0 on failure, 1 on success * Returns 0 on failure, 1 on success
*/ */
stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], ...) stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], any:...)
{ {
static query_buf[2048]; static query_buf[2048];
vformat(query_buf, 2047, fmt, 6); vformat(query_buf, 2047, fmt, 6);
@ -320,7 +320,7 @@ stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[
* Use this for executing a query and not caring about the error. * Use this for executing a query and not caring about the error.
* Returns -1 on error, >=0 on success (with number of affected rows) * Returns -1 on error, >=0 on success (with number of affected rows)
*/ */
stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], {Float,_}:...) stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], any:...)
{ {
static query[4096]; static query[4096];
new Handle:hQuery; new Handle:hQuery;

View File

@ -11,6 +11,8 @@
#endif #endif
#define _string_included #define _string_included
#define charsmax(%1) (sizeof(%1)-1)
/* Checks if source contains string. On success function /* Checks if source contains string. On success function
* returns position in source, on failure returns -1. */ * returns position in source, on failure returns -1. */
native contain(const source[],const string[]); native contain(const source[],const string[]);