Changed functag syntax so public keyword is in the normal place. The old style is still allowed.

This commit is contained in:
David Anderson 2008-09-21 14:56:38 -07:00
parent 6192efc078
commit a838276ec2
14 changed files with 64 additions and 44 deletions

View File

@ -149,7 +149,7 @@ forward OnClientCookiesCached(client);
* @param buffer Outbut buffer. * @param buffer Outbut buffer.
* @param maxlen Max length of the output buffer. * @param maxlen Max length of the output buffer.
*/ */
functag CookieMenuHandler public(client, CookieMenuAction:action, any:info, String:buffer[], maxlen); functag public CookieMenuHandler(client, CookieMenuAction:action, any:info, String:buffer[], maxlen);
/** /**
* Add a new prefab item to the client cookie settings menu. * Add a new prefab item to the client cookie settings menu.

View File

@ -293,7 +293,7 @@ native ShowActivityEx(client, const String:tag[], const String:format[], any:...
* @return An Action value. Not handling the command * @return An Action value. Not handling the command
* means that Source will report it as "not found." * means that Source will report it as "not found."
*/ */
functag SrvCmd Action:public(args); functag public Action:SrvCmd(args);
/** /**
* Creates a server-only console command, or hooks an already existing one. * Creates a server-only console command, or hooks an already existing one.
@ -317,7 +317,7 @@ native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:descriptio
* @return An Action value. Not handling the command * @return An Action value. Not handling the command
* means that Source will report it as "not found." * means that Source will report it as "not found."
*/ */
functag ConCmd Action:public(client, args); functag public Action:ConCmd(client, args);
/** /**
* Creates a console command, or hooks an already existing one. * Creates a console command, or hooks an already existing one.
@ -421,7 +421,7 @@ native Handle:FindConVar(const String:name[]);
* @param newValue String containing the new value of the convar. * @param newValue String containing the new value of the convar.
* @noreturn * @noreturn
*/ */
functag ConVarChanged public(Handle:convar, const String:oldValue[], const String:newValue[]); functag public ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[]);
/** /**
* Creates a hook for when a console variable's value is changed. * Creates a hook for when a console variable's value is changed.

View File

@ -581,7 +581,7 @@ native SQL_UnlockDatabase(Handle:database);
* @param data Data passed in via the original threaded invocation. * @param data Data passed in via the original threaded invocation.
* @param * @param
*/ */
functag SQLTCallback public(Handle:owner, Handle:hndl, const String:error[], any:data); functag public SQLTCallback(Handle:owner, Handle:hndl, const String:error[], any:data);
/** /**
* Tells whether two database handles both point to the same database * Tells whether two database handles both point to the same database

View File

@ -352,7 +352,7 @@ native Call_Cancel();
* @param numParams Number of parameters passed to the native. * @param numParams Number of parameters passed to the native.
* @return Value for the native call to return. * @return Value for the native call to return.
*/ */
functag NativeCall public(Handle:plugin, numParams); functag public NativeCall(Handle:plugin, numParams);
/** /**
* Creates a dynamic native. This should only be called in AskPluginLoad(), or * Creates a dynamic native. This should only be called in AskPluginLoad(), or

View File

@ -134,7 +134,7 @@ forward Action:OnLogAction(Handle:source,
* @return Plugin_Handled or Plugin_Stop will prevent the message * @return Plugin_Handled or Plugin_Stop will prevent the message
* from being written to the log file. * from being written to the log file.
*/ */
functag GameLogHook Action:public(const String:message[]); functag public Action:GameLogHook(const String:message[]);
/** /**
* Adds a game log hook. * Adds a game log hook.

View File

@ -149,7 +149,7 @@ enum MenuSource
* @param param2 Second action parameter (usually the item). * @param param2 Second action parameter (usually the item).
* @noreturn * @noreturn
*/ */
functag MenuHandler public(Handle:menu, MenuAction:action, param1, param2); functag public MenuHandler(Handle:menu, MenuAction:action, param1, param2);
/** /**
* Creates a new, empty menu using the default style. * Creates a new, empty menu using the default style.
@ -513,7 +513,7 @@ stock VoteMenuToAll(Handle:menu, time)
* defines. * defines.
* @noreturn * @noreturn
*/ */
functag VoteHandler public(Handle:menu, functag public VoteHandler(Handle:menu,
num_votes, num_votes,
num_clients, num_clients,
const client_info[][2], const client_info[][2],

View File

@ -43,7 +43,7 @@
* @param activator Entity index of the activator. * @param activator Entity index of the activator.
* @param delay Delay in seconds? before the event gets fired. * @param delay Delay in seconds? before the event gets fired.
*/ */
functag EntityOutput public(const String:output[], caller, activator, Float:delay); functag public EntityOutput(const String:output[], caller, activator, Float:delay);
/** /**
* Add an entity output hook on a entity classname * Add an entity output hook on a entity classname

View File

@ -274,7 +274,7 @@ native EmitSentence(const clients[],
* @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, * @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
* Plugin_Changed when any parameter has been modified. * Plugin_Changed when any parameter has been modified.
*/ */
functag AmbientSHook Action:public(String:sample[PLATFORM_MAX_PATH], &entity, &Float:volume, &level, &pitch, Float:pos[3], &flags, &Float:delay); functag public Action:AmbientSHook(String:sample[PLATFORM_MAX_PATH], &entity, &Float:volume, &level, &pitch, Float:pos[3], &flags, &Float:delay);
/** /**
* Called when a sound is going to be emitted to one or more clients. * Called when a sound is going to be emitted to one or more clients.
@ -292,7 +292,7 @@ functag AmbientSHook Action:public(String:sample[PLATFORM_MAX_PATH], &entity, &F
* @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, * @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
* Plugin_Changed when any parameter has been modified. * Plugin_Changed when any parameter has been modified.
*/ */
functag NormalSHook Action:public(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags); functag public Action:NormalSHook(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags);
/** /**
* Hooks all played ambient sounds. * Hooks all played ambient sounds.

View File

@ -44,7 +44,7 @@
* @param delay Delay in seconds to send the TE. * @param delay Delay in seconds to send the TE.
* @return Plugin_Continue to allow the transmission of the TE, Plugin_Stop to block it. * @return Plugin_Continue to allow the transmission of the TE, Plugin_Stop to block it.
*/ */
functag TEHook Action:public(const String:te_name[], const Players[], numClients, Float:delay); functag public Action:TEHook(const String:te_name[], const Players[], numClients, Float:delay);
/** /**
* Hooks a temp entity. * Hooks a temp entity.

View File

@ -98,7 +98,7 @@ native SortStrings(String:array[][], num_strings, SortOrder:order = Sort_Ascendi
* 0 if first is equal to second * 0 if first is equal to second
* 1 if first should go after second * 1 if first should go after second
*/ */
functag SortFunc1D public(elem1, elem2, const array[], Handle:hndl); functag public SortFunc1D(elem1, elem2, const array[], Handle:hndl);
/** /**
* Sorts a custom 1D array. You must pass in a comparison function. * Sorts a custom 1D array. You must pass in a comparison function.
@ -163,7 +163,7 @@ native SortADTArray(Handle:array, SortOrder:order, SortType:type);
* 0 if first is equal to second * 0 if first is equal to second
* 1 if first should go after second * 1 if first should go after second
*/ */
functag SortFuncADTArray public(index1, index2, Handle:array, Handle:hndl); functag public SortFuncADTArray(index1, index2, Handle:array, Handle:hndl);
/** /**
* Custom sorts an ADT Array. You must pass in a comparison function. * Custom sorts an ADT Array. You must pass in a comparison function.

View File

@ -108,7 +108,7 @@ native bool:SMC_GetErrorString(SMCError:error, String:buffer[], buf_max);
* @param smc The SMC Parse Handle. * @param smc The SMC Parse Handle.
* @noreturn * @noreturn
*/ */
functag SMC_ParseStart public(Handle:smc); functag public SMC_ParseStart(Handle:smc);
/** /**
* Sets the SMC_ParseStart function of a parse Handle. * Sets the SMC_ParseStart function of a parse Handle.
@ -128,7 +128,7 @@ native SMC_SetParseStart(Handle:smc, SMC_ParseStart:func);
* @param failed True if parsing failed, false otherwise. * @param failed True if parsing failed, false otherwise.
* @noreturn * @noreturn
*/ */
functag SMC_ParseEnd public(Handle:smc, bool:halted, bool:failed); functag public SMC_ParseEnd(Handle:smc, bool:halted, bool:failed);
/** /**
* Sets the SMC_ParseEnd of a parse handle. * Sets the SMC_ParseEnd of a parse handle.
@ -149,7 +149,7 @@ native SMC_SetParseEnd(Handle:smc, SMC_ParseEnd:func);
* @param opt_quotes True if the section name was quote-enclosed in the file. * @param opt_quotes True if the section name was quote-enclosed in the file.
* @return An SMCResult action to take. * @return An SMCResult action to take.
*/ */
functag SMC_NewSection SMCResult:public(Handle:smc, const String:name[], bool:opt_quotes); functag public SMCResult:SMC_NewSection(Handle:smc, const String:name[], bool:opt_quotes);
/** /**
* Called when the parser finds a new key/value pair. * Called when the parser finds a new key/value pair.
@ -162,7 +162,7 @@ functag SMC_NewSection SMCResult:public(Handle:smc, const String:name[], bool:op
* @param value_quotes Whether or not the value was enclosed in quotes. * @param value_quotes Whether or not the value was enclosed in quotes.
* @return An SMCResult action to take. * @return An SMCResult action to take.
*/ */
functag SMC_KeyValue SMCResult:public(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes); functag public SMCResult:SMC_KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes);
/** /**
* Called when the parser finds the end of the current section. * Called when the parser finds the end of the current section.
@ -170,7 +170,7 @@ functag SMC_KeyValue SMCResult:public(Handle:smc, const String:key[], const Stri
* @param smc The SMC Parse Handle. * @param smc The SMC Parse Handle.
* @return An SMCResult action to take. * @return An SMCResult action to take.
*/ */
functag SMC_EndSection SMCResult:public(Handle:smc); functag public SMCResult:SMC_EndSection(Handle:smc);
/** /**
* Sets the three main reader functions. * Sets the three main reader functions.
@ -191,7 +191,7 @@ native SMC_SetReaders(Handle:smc, SMC_NewSection:ns, SMC_KeyValue:kv, SMC_EndSec
* @param lineno The line number it occurs on. * @param lineno The line number it occurs on.
* @return An SMCResult action to take. * @return An SMCResult action to take.
*/ */
functag SMC_RawLine SMCResult:public(Handle:smc, const String:line[], lineno); functag public SMCResult:SMC_RawLine(Handle:smc, const String:line[], lineno);
/** /**
* Sets a raw line reader on an SMC parser Handle. * Sets a raw line reader on an SMC parser Handle.

View File

@ -127,7 +127,7 @@ enum TopMenuObject
* @param maxlength Output buffer (if used). * @param maxlength Output buffer (if used).
* @noreturn * @noreturn
*/ */
functag TopMenuHandler public(Handle:topmenu, functag public TopMenuHandler(Handle:topmenu,
TopMenuAction:action, TopMenuAction:action,
TopMenuObject:object_id, TopMenuObject:object_id,
param, param,

View File

@ -124,14 +124,14 @@ native EndMessage();
* blocks the message from being sent, and Plugin_Continue * blocks the message from being sent, and Plugin_Continue
* resumes normal functionality. * resumes normal functionality.
*/ */
functag MsgHook Action:public(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init); functag public Action:MsgHook(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init);
/** /**
* Called when a message is finished sending. * Called when a message is finished sending.
* *
* @param msg_id Message index. * @param msg_id Message index.
*/ */
functag MsgSentNotify public(UserMsg:msg_id); functag public MsgSentNotify(UserMsg:msg_id);
/** /**
* Hooks a user message. * Hooks a user message.

View File

@ -3182,12 +3182,27 @@ static void dofuncenum(int listmode)
constvalue *cur; constvalue *cur;
funcenum_t *fenum = NULL; funcenum_t *fenum = NULL;
int i; int i;
int newStyleTag = 0;
int isNewStyle = 0;
/* get the explicit tag (required!) */ /* get the explicit tag (required!) */
int l = lex(&val,&str); int l = lex(&val,&str);
if (l != tSYMBOL) if (l != tSYMBOL)
{ {
error(93); if (listmode == FALSE && l == tPUBLIC)
{
isNewStyle = 1;
newStyleTag = pc_addtag(NULL);
l = lex(&val, &str);
if (l != tSYMBOL)
{
error(93);
}
}
else
{
error(93);
}
} }
/* This tag can't already exist! */ /* This tag can't already exist! */
@ -3223,27 +3238,32 @@ static void dofuncenum(int listmode)
break; break;
} }
memset(&func, 0, sizeof(func)); memset(&func, 0, sizeof(func));
func.ret_tag = pc_addtag(NULL); /* Get the return tag */ if (!isNewStyle)
l = lex(&val, &str);
/* :TODO:
* Right now, there is a problem. We can't pass non-public function pointer addresses around,
* because the address isn't known until the final reparse. Unfortunately, you can write code
* before the address is known, because Pawn's compiler isn't truly multipass.
*
* When you call a function, there's no problem, because it does not write the address.
* The assembly looks like this:
* call MyFunction
* Then, only at assembly time (once all passes are done), does it know the address.
* I do not see any solution to this because there is no way I know to inject the function name
* rather than the constant value. And even if we could, we'd have to change the assembler recognize that.
*/
/*if (l == tSTOCK)
{ {
func.type = uSTOCK; func.ret_tag = pc_addtag(NULL); /* Get the return tag */
} else */if (l == tPUBLIC) { l = lex(&val, &str);
/* :TODO:
* Right now, there is a problem. We can't pass non-public function pointer addresses around,
* because the address isn't known until the final reparse. Unfortunately, you can write code
* before the address is known, because Pawn's compiler isn't truly multipass.
*
* When you call a function, there's no problem, because it does not write the address.
* The assembly looks like this:
* call MyFunction
* Then, only at assembly time (once all passes are done), does it know the address.
* I do not see any solution to this because there is no way I know to inject the function name
* rather than the constant value. And even if we could, we'd have to change the assembler recognize that.
*/
if (l == tPUBLIC) {
func.type = uPUBLIC;
} else {
error(1, "-public-", str);
}
}
else
{
func.ret_tag = newStyleTag;
func.type = uPUBLIC; func.type = uPUBLIC;
} else {
error(1, "-public-", str);
} }
needtoken('('); needtoken('(');
do do