diff --git a/plugins/include/clientprefs.inc b/plugins/include/clientprefs.inc index aa24b04b..f28776af 100644 --- a/plugins/include/clientprefs.inc +++ b/plugins/include/clientprefs.inc @@ -149,7 +149,7 @@ forward OnClientCookiesCached(client); * @param buffer Outbut 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. diff --git a/plugins/include/console.inc b/plugins/include/console.inc index 9b450f12..7359eff3 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -293,7 +293,7 @@ native ShowActivityEx(client, const String:tag[], const String:format[], any:... * @return An Action value. Not handling the command * 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. @@ -317,7 +317,7 @@ native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:descriptio * @return An Action value. Not handling the command * 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. @@ -421,7 +421,7 @@ native Handle:FindConVar(const String:name[]); * @param newValue String containing the new value of the convar. * @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. diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index 361afc64..acd412d0 100644 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -581,7 +581,7 @@ native SQL_UnlockDatabase(Handle:database); * @param data Data passed in via the original threaded invocation. * @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 diff --git a/plugins/include/functions.inc b/plugins/include/functions.inc index eba2d9dc..6c4198a6 100644 --- a/plugins/include/functions.inc +++ b/plugins/include/functions.inc @@ -352,7 +352,7 @@ native Call_Cancel(); * @param numParams Number of parameters passed to the native. * @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 diff --git a/plugins/include/logging.inc b/plugins/include/logging.inc index aa4c0c84..11405044 100644 --- a/plugins/include/logging.inc +++ b/plugins/include/logging.inc @@ -134,7 +134,7 @@ forward Action:OnLogAction(Handle:source, * @return Plugin_Handled or Plugin_Stop will prevent the message * 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. diff --git a/plugins/include/menus.inc b/plugins/include/menus.inc index 5582339c..587df79e 100644 --- a/plugins/include/menus.inc +++ b/plugins/include/menus.inc @@ -149,7 +149,7 @@ enum MenuSource * @param param2 Second action parameter (usually the item). * @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. @@ -513,7 +513,7 @@ stock VoteMenuToAll(Handle:menu, time) * defines. * @noreturn */ -functag VoteHandler public(Handle:menu, +functag public VoteHandler(Handle:menu, num_votes, num_clients, const client_info[][2], diff --git a/plugins/include/sdktools_entoutput.inc b/plugins/include/sdktools_entoutput.inc index d728e23f..0db74555 100644 --- a/plugins/include/sdktools_entoutput.inc +++ b/plugins/include/sdktools_entoutput.inc @@ -43,7 +43,7 @@ * @param activator Entity index of the activator. * @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 diff --git a/plugins/include/sdktools_sound.inc b/plugins/include/sdktools_sound.inc index 2005a965..a10e04b1 100644 --- a/plugins/include/sdktools_sound.inc +++ b/plugins/include/sdktools_sound.inc @@ -274,7 +274,7 @@ native EmitSentence(const clients[], * @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, * 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. @@ -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, * 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. diff --git a/plugins/include/sdktools_tempents.inc b/plugins/include/sdktools_tempents.inc index fc895304..cd454d0b 100644 --- a/plugins/include/sdktools_tempents.inc +++ b/plugins/include/sdktools_tempents.inc @@ -44,7 +44,7 @@ * @param delay Delay in seconds to send the TE. * @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. diff --git a/plugins/include/sorting.inc b/plugins/include/sorting.inc index 2d36be3b..93ea49cc 100644 --- a/plugins/include/sorting.inc +++ b/plugins/include/sorting.inc @@ -98,7 +98,7 @@ native SortStrings(String:array[][], num_strings, SortOrder:order = Sort_Ascendi * 0 if first is equal to 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. @@ -163,7 +163,7 @@ native SortADTArray(Handle:array, SortOrder:order, SortType:type); * 0 if first is equal to 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. diff --git a/plugins/include/textparse.inc b/plugins/include/textparse.inc index 408c931c..80df92ce 100644 --- a/plugins/include/textparse.inc +++ b/plugins/include/textparse.inc @@ -108,7 +108,7 @@ native bool:SMC_GetErrorString(SMCError:error, String:buffer[], buf_max); * @param smc The SMC Parse Handle. * @noreturn */ -functag SMC_ParseStart public(Handle:smc); +functag public SMC_ParseStart(Handle:smc); /** * 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. * @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. @@ -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. * @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. @@ -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. * @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. @@ -170,7 +170,7 @@ functag SMC_KeyValue SMCResult:public(Handle:smc, const String:key[], const Stri * @param smc The SMC Parse Handle. * @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. @@ -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. * @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. diff --git a/plugins/include/topmenus.inc b/plugins/include/topmenus.inc index 8019ed72..7fd4840f 100644 --- a/plugins/include/topmenus.inc +++ b/plugins/include/topmenus.inc @@ -127,7 +127,7 @@ enum TopMenuObject * @param maxlength Output buffer (if used). * @noreturn */ -functag TopMenuHandler public(Handle:topmenu, +functag public TopMenuHandler(Handle:topmenu, TopMenuAction:action, TopMenuObject:object_id, param, diff --git a/plugins/include/usermessages.inc b/plugins/include/usermessages.inc index 7fc57731..00178df4 100644 --- a/plugins/include/usermessages.inc +++ b/plugins/include/usermessages.inc @@ -124,14 +124,14 @@ native EndMessage(); * blocks the message from being sent, and Plugin_Continue * 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. * * @param msg_id Message index. */ -functag MsgSentNotify public(UserMsg:msg_id); +functag public MsgSentNotify(UserMsg:msg_id); /** * Hooks a user message. diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index e3720e54..af7c1ef9 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -3182,12 +3182,27 @@ static void dofuncenum(int listmode) constvalue *cur; funcenum_t *fenum = NULL; int i; + int newStyleTag = 0; + int isNewStyle = 0; /* get the explicit tag (required!) */ int l = lex(&val,&str); 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! */ @@ -3223,27 +3238,32 @@ static void dofuncenum(int listmode) break; } memset(&func, 0, sizeof(func)); - func.ret_tag = pc_addtag(NULL); /* Get the return tag */ - 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) + if (!isNewStyle) { - func.type = uSTOCK; - } else */if (l == tPUBLIC) { + func.ret_tag = pc_addtag(NULL); /* Get the return tag */ + 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; - } else { - error(1, "-public-", str); } needtoken('('); do