Initial import of regex stuff
This commit is contained in:
parent
8a57648b87
commit
d9b6fa1f93
@ -91,16 +91,16 @@ native get_localinfo(const info[],output[],len);
|
|||||||
native show_motd(player,const message[],const header[]="");
|
native show_motd(player,const message[],const header[]="");
|
||||||
|
|
||||||
/* Sends message to player. Set index to 0 to send text globaly. */
|
/* Sends message to player. Set index to 0 to send text globaly. */
|
||||||
native client_print(index,type,const message[],{Float,Sql,Result,_}:...);
|
native client_print(index,type,const message[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Sends message to player by engine. Set index to 0 to send text globaly. */
|
/* Sends message to player by engine. Set index to 0 to send text globaly. */
|
||||||
native engclient_print(player,type,const message[],{Float,Sql,Result,_}:...);
|
native engclient_print(player,type,const message[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Sends message to console. */
|
/* Sends message to console. */
|
||||||
native console_print(id,const message[],{Float,Sql,Result,_}:...);
|
native console_print(id,const message[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Sends command to console. */
|
/* Sends command to console. */
|
||||||
native console_cmd(id,const cmd[],{Float,Sql,Result,_}:...);
|
native console_cmd(id,const cmd[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Registers event on which a given function will be called
|
/* Registers event on which a given function will be called
|
||||||
* Flags:
|
* Flags:
|
||||||
@ -131,7 +131,7 @@ native register_logevent(const function[], argsnum, ... );
|
|||||||
native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);
|
native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);
|
||||||
|
|
||||||
/* Displays HUD message to given player. */
|
/* Displays HUD message to given player. */
|
||||||
native show_hudmessage(index,const message[],{Float,Sql,Result,_}:...);
|
native show_hudmessage(index,const message[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). */
|
/* Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). */
|
||||||
native show_menu(index,keys,const menu[], time = -1, title[] = "");
|
native show_menu(index,keys,const menu[], time = -1, title[] = "");
|
||||||
@ -140,7 +140,7 @@ native show_menu(index,keys,const menu[], time = -1, title[] = "");
|
|||||||
* When you are asking for string the array and length is needed (read_data(2,name,len)).
|
* When you are asking for string the array and length is needed (read_data(2,name,len)).
|
||||||
* Integer is returned by function (new me = read_data(3)).
|
* Integer is returned by function (new me = read_data(3)).
|
||||||
* Float is set in second parameter (read_data(3,value)). */
|
* Float is set in second parameter (read_data(3,value)). */
|
||||||
native read_data(value, {Float,Sql,Result,_}:... );
|
native read_data(value, {Float,Sql,Result,Regex,_}:... );
|
||||||
|
|
||||||
/* Returns number of values in client message. */
|
/* Returns number of values in client message. */
|
||||||
native read_datanum();
|
native read_datanum();
|
||||||
@ -161,7 +161,7 @@ native parse_loguser(const text[], name[], nlen, &userid = -2, authid[] = "", al
|
|||||||
|
|
||||||
/* Prints message to server console.
|
/* Prints message to server console.
|
||||||
* You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
|
* You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
|
||||||
native server_print(const message[], {Float,Sql,Result,_}:...);
|
native server_print(const message[], {Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Returns 1 or 0. */
|
/* Returns 1 or 0. */
|
||||||
native is_map_valid(const mapname[]);
|
native is_map_valid(const mapname[]);
|
||||||
@ -289,13 +289,13 @@ native user_kill(index,flag=0);
|
|||||||
* ... - optional parameters
|
* ... - optional parameters
|
||||||
* Return value:
|
* Return value:
|
||||||
* always 0 */
|
* always 0 */
|
||||||
native log_amx(const string[], {Float,Sql,Result,_}:...);
|
native log_amx(const string[], {Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Sends message to standard HL logs. */
|
/* Sends message to standard HL logs. */
|
||||||
native log_message(const message[],{Float,Sql,Result,_}:...);
|
native log_message(const message[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Sends log message to specified file. */
|
/* Sends log message to specified file. */
|
||||||
native log_to_file(const file[],const message[],{Float,Sql,Result,_}:...);
|
native log_to_file(const file[],const message[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Returns number of players put in server.
|
/* Returns number of players put in server.
|
||||||
* If flag is set then also connecting are counted. */
|
* If flag is set then also connecting are counted. */
|
||||||
@ -350,7 +350,7 @@ native find_player(const flags[], ... );
|
|||||||
native remove_quotes(text[]);
|
native remove_quotes(text[]);
|
||||||
|
|
||||||
/* Executes command on player. */
|
/* Executes command on player. */
|
||||||
native client_cmd(index,const command[],{Float,Sql,Result,_}:...);
|
native client_cmd(index,const command[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* This is an emulation of a client command (commands aren't send to client!).
|
/* This is an emulation of a client command (commands aren't send to client!).
|
||||||
* It allows to execute some commands on players and bots.
|
* It allows to execute some commands on players and bots.
|
||||||
@ -359,7 +359,7 @@ native client_cmd(index,const command[],{Float,Sql,Result,_}:...);
|
|||||||
native engclient_cmd(index,const command[],arg1[]="",arg2[]="");
|
native engclient_cmd(index,const command[],arg1[]="",arg2[]="");
|
||||||
|
|
||||||
/* Executes command on a server console. */
|
/* Executes command on a server console. */
|
||||||
native server_cmd(const command[],{Float,Sql,Result,_}:...);
|
native server_cmd(const command[],{Float,Sql,Result,Regex,_}:...);
|
||||||
|
|
||||||
/* Sets a cvar to given value. */
|
/* Sets a cvar to given value. */
|
||||||
native set_cvar_string(const cvar[],const value[]);
|
native set_cvar_string(const cvar[],const value[]);
|
||||||
|
38
plugins/include/regex.inc
Executable file
38
plugins/include/regex.inc
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
/* Regular Expression API
|
||||||
|
* (C)2004 by David "BAILOPAN" Anderson
|
||||||
|
* Licensed under the GNU General Public License.
|
||||||
|
* No warranties of any kind.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined _regex_included
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
#define _regex_included
|
||||||
|
|
||||||
|
enum Regex
|
||||||
|
{
|
||||||
|
REGEX_MATCH_FAIL = -2,
|
||||||
|
REGEX_PATTERN_FAIL,
|
||||||
|
REGEX_NO_MATCH,
|
||||||
|
REGEX_OK
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Return values:
|
||||||
|
-2 = Matching error (error code stored in ret)
|
||||||
|
-1 = Error in pattern (error message and offset # in error[] and ret)
|
||||||
|
0 = No match
|
||||||
|
>1 = Id for getting more info (you must call regex_free() later on)
|
||||||
|
(also note that ret will contain the number of substrings found)
|
||||||
|
*/
|
||||||
|
|
||||||
|
native Regex:regex_match(const string[], const pattern[], &ret, error[], maxLen);
|
||||||
|
|
||||||
|
/* Returns a matched substring from a regex handle
|
||||||
|
* substring ids start at 0 and end at ret-1, where ret is from the above function
|
||||||
|
*/
|
||||||
|
native regex_substr(Regex:id, str_id, buffer[], maxLen);
|
||||||
|
|
||||||
|
/* Frees the memory associated with a regex resuls and sets the handle to 0.
|
||||||
|
* You must do this if the handle >=1, once you're done.
|
||||||
|
*/
|
||||||
|
native regex_free(&Regex:id);
|
Loading…
Reference in New Issue
Block a user