Changed functag syntax so public keyword is in the normal place. The old style is still allowed.
authorDavid Anderson <dvander@alliedmods.net>
Sun Sep 21 14:56:38 2008 -0700 (2008-09-21)
changeset 2317a7380514e63c
parent 2316 b43df30e5578
child 2319 a0867f8a9fba
child 2320 88550c031d23
Changed functag syntax so public keyword is in the normal place. The old style is still allowed.
plugins/include/clientprefs.inc
plugins/include/console.inc
plugins/include/dbi.inc
plugins/include/functions.inc
plugins/include/logging.inc
plugins/include/menus.inc
plugins/include/sdktools_entoutput.inc
plugins/include/sdktools_sound.inc
plugins/include/sdktools_tempents.inc
plugins/include/sorting.inc
plugins/include/textparse.inc
plugins/include/topmenus.inc
plugins/include/usermessages.inc
sourcepawn/compiler/sc1.c
     1.1 --- a/plugins/include/clientprefs.inc	Sun Sep 21 14:05:13 2008 -0700
     1.2 +++ b/plugins/include/clientprefs.inc	Sun Sep 21 14:56:38 2008 -0700
     1.3 @@ -149,7 +149,7 @@
     1.4   * @param buffer		Outbut buffer.
     1.5   * @param maxlen		Max length of the output buffer.			
     1.6   */
     1.7 -functag CookieMenuHandler public(client, CookieMenuAction:action, any:info, String:buffer[], maxlen);
     1.8 +functag public CookieMenuHandler(client, CookieMenuAction:action, any:info, String:buffer[], maxlen);
     1.9  
    1.10  /**
    1.11   * Add a new prefab item to the client cookie settings menu.
     2.1 --- a/plugins/include/console.inc	Sun Sep 21 14:05:13 2008 -0700
     2.2 +++ b/plugins/include/console.inc	Sun Sep 21 14:56:38 2008 -0700
     2.3 @@ -293,7 +293,7 @@
     2.4   * @return				An Action value.  Not handling the command
     2.5   *						means that Source will report it as "not found."
     2.6   */
     2.7 -functag SrvCmd Action:public(args);
     2.8 +functag public Action:SrvCmd(args);
     2.9  
    2.10  /**
    2.11   * Creates a server-only console command, or hooks an already existing one.  
    2.12 @@ -317,7 +317,7 @@
    2.13   * @return				An Action value.  Not handling the command
    2.14   *						means that Source will report it as "not found."
    2.15   */
    2.16 -functag ConCmd Action:public(client, args);
    2.17 +functag public Action:ConCmd(client, args);
    2.18  
    2.19  /**
    2.20   * Creates a console command, or hooks an already existing one.
    2.21 @@ -421,7 +421,7 @@
    2.22   * @param newValue		String containing the new value of the convar.
    2.23   * @noreturn
    2.24   */
    2.25 -functag ConVarChanged public(Handle:convar, const String:oldValue[], const String:newValue[]);
    2.26 +functag public ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[]);
    2.27  
    2.28  /**
    2.29   * Creates a hook for when a console variable's value is changed.
     3.1 --- a/plugins/include/dbi.inc	Sun Sep 21 14:05:13 2008 -0700
     3.2 +++ b/plugins/include/dbi.inc	Sun Sep 21 14:56:38 2008 -0700
     3.3 @@ -581,7 +581,7 @@
     3.4   * @param data			Data passed in via the original threaded invocation.
     3.5   * @param 
     3.6   */
     3.7 -functag SQLTCallback public(Handle:owner, Handle:hndl, const String:error[], any:data);
     3.8 +functag public SQLTCallback(Handle:owner, Handle:hndl, const String:error[], any:data);
     3.9  
    3.10  /**
    3.11   * Tells whether two database handles both point to the same database 
     4.1 --- a/plugins/include/functions.inc	Sun Sep 21 14:05:13 2008 -0700
     4.2 +++ b/plugins/include/functions.inc	Sun Sep 21 14:56:38 2008 -0700
     4.3 @@ -352,7 +352,7 @@
     4.4   * @param numParams			Number of parameters passed to the native.
     4.5   * @return 					Value for the native call to return.
     4.6   */
     4.7 -functag NativeCall public(Handle:plugin, numParams);
     4.8 +functag public NativeCall(Handle:plugin, numParams);
     4.9  
    4.10  /**
    4.11   * Creates a dynamic native.  This should only be called in AskPluginLoad(), or 
     5.1 --- a/plugins/include/logging.inc	Sun Sep 21 14:05:13 2008 -0700
     5.2 +++ b/plugins/include/logging.inc	Sun Sep 21 14:56:38 2008 -0700
     5.3 @@ -134,7 +134,7 @@
     5.4   * @return				Plugin_Handled or Plugin_Stop will prevent the message 
     5.5   * 						from being written to the log file.
     5.6   */
     5.7 -functag GameLogHook Action:public(const String:message[]);
     5.8 +functag public Action:GameLogHook(const String:message[]);
     5.9  
    5.10  /**
    5.11   * Adds a game log hook.
     6.1 --- a/plugins/include/menus.inc	Sun Sep 21 14:05:13 2008 -0700
     6.2 +++ b/plugins/include/menus.inc	Sun Sep 21 14:56:38 2008 -0700
     6.3 @@ -149,7 +149,7 @@
     6.4   * @param param2			Second action parameter (usually the item).
     6.5   * @noreturn
     6.6   */
     6.7 -functag MenuHandler public(Handle:menu, MenuAction:action, param1, param2);
     6.8 +functag public MenuHandler(Handle:menu, MenuAction:action, param1, param2);
     6.9  
    6.10  /**
    6.11   * Creates a new, empty menu using the default style.
    6.12 @@ -513,7 +513,7 @@
    6.13   *							defines.
    6.14   * @noreturn
    6.15   */
    6.16 -functag VoteHandler public(Handle:menu,
    6.17 +functag public VoteHandler(Handle:menu,
    6.18  						   num_votes, 
    6.19  						   num_clients,
    6.20  						   const client_info[][2], 
     7.1 --- a/plugins/include/sdktools_entoutput.inc	Sun Sep 21 14:05:13 2008 -0700
     7.2 +++ b/plugins/include/sdktools_entoutput.inc	Sun Sep 21 14:56:38 2008 -0700
     7.3 @@ -43,7 +43,7 @@
     7.4   * @param activator		Entity index of the activator.
     7.5   * @param delay			Delay in seconds? before the event gets fired.
     7.6   */
     7.7 -functag EntityOutput public(const String:output[], caller, activator, Float:delay);
     7.8 +functag public EntityOutput(const String:output[], caller, activator, Float:delay);
     7.9  
    7.10  /**
    7.11   * Add an entity output hook on a entity classname
     8.1 --- a/plugins/include/sdktools_sound.inc	Sun Sep 21 14:05:13 2008 -0700
     8.2 +++ b/plugins/include/sdktools_sound.inc	Sun Sep 21 14:56:38 2008 -0700
     8.3 @@ -274,7 +274,7 @@
     8.4   * @return		Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
     8.5   *			  Plugin_Changed when any parameter has been modified.
     8.6   */
     8.7 -functag AmbientSHook Action:public(String:sample[PLATFORM_MAX_PATH], &entity, &Float:volume, &level, &pitch, Float:pos[3], &flags, &Float:delay);
     8.8 +functag public Action:AmbientSHook(String:sample[PLATFORM_MAX_PATH], &entity, &Float:volume, &level, &pitch, Float:pos[3], &flags, &Float:delay);
     8.9  
    8.10  /**
    8.11   * Called when a sound is going to be emitted to one or more clients.
    8.12 @@ -292,7 +292,7 @@
    8.13   * @return			Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
    8.14   *				  Plugin_Changed when any parameter has been modified.
    8.15   */
    8.16 -functag NormalSHook Action:public(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags);
    8.17 +functag public Action:NormalSHook(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags);
    8.18  
    8.19  /**
    8.20   * Hooks all played ambient sounds.
     9.1 --- a/plugins/include/sdktools_tempents.inc	Sun Sep 21 14:05:13 2008 -0700
     9.2 +++ b/plugins/include/sdktools_tempents.inc	Sun Sep 21 14:56:38 2008 -0700
     9.3 @@ -44,7 +44,7 @@
     9.4   * @param delay		Delay in seconds to send the TE.
     9.5   * @return		Plugin_Continue to allow the transmission of the TE, Plugin_Stop to block it.
     9.6   */
     9.7 -functag TEHook Action:public(const String:te_name[], const Players[], numClients, Float:delay);
     9.8 +functag public Action:TEHook(const String:te_name[], const Players[], numClients, Float:delay);
     9.9  
    9.10  /**
    9.11   * Hooks a temp entity.
    10.1 --- a/plugins/include/sorting.inc	Sun Sep 21 14:05:13 2008 -0700
    10.2 +++ b/plugins/include/sorting.inc	Sun Sep 21 14:56:38 2008 -0700
    10.3 @@ -98,7 +98,7 @@
    10.4   *						0 if first is equal to second
    10.5   *						1 if first should go after second
    10.6   */
    10.7 -functag SortFunc1D public(elem1, elem2, const array[], Handle:hndl);
    10.8 +functag public SortFunc1D(elem1, elem2, const array[], Handle:hndl);
    10.9  
   10.10  /** 
   10.11   * Sorts a custom 1D array.  You must pass in a comparison function.
   10.12 @@ -163,7 +163,7 @@
   10.13   *					0 if first is equal to second
   10.14   *					1 if first should go after second
   10.15   */
   10.16 -functag SortFuncADTArray public(index1, index2, Handle:array, Handle:hndl);
   10.17 +functag public SortFuncADTArray(index1, index2, Handle:array, Handle:hndl);
   10.18  
   10.19  /**
   10.20   * Custom sorts an ADT Array. You must pass in a comparison function.
    11.1 --- a/plugins/include/textparse.inc	Sun Sep 21 14:05:13 2008 -0700
    11.2 +++ b/plugins/include/textparse.inc	Sun Sep 21 14:56:38 2008 -0700
    11.3 @@ -108,7 +108,7 @@
    11.4   * @param smc			The SMC Parse Handle.
    11.5   * @noreturn
    11.6   */
    11.7 -functag SMC_ParseStart public(Handle:smc);
    11.8 +functag public SMC_ParseStart(Handle:smc);
    11.9  
   11.10  /**
   11.11   * Sets the SMC_ParseStart function of a parse Handle.
   11.12 @@ -128,7 +128,7 @@
   11.13   * @param failed		True if parsing failed, false otherwise.
   11.14   * @noreturn
   11.15   */
   11.16 -functag SMC_ParseEnd public(Handle:smc, bool:halted, bool:failed);
   11.17 +functag public SMC_ParseEnd(Handle:smc, bool:halted, bool:failed);
   11.18  
   11.19  /**
   11.20   * Sets the SMC_ParseEnd of a parse handle.
   11.21 @@ -149,7 +149,7 @@
   11.22   * @param opt_quotes	True if the section name was quote-enclosed in the file.
   11.23   * @return				An SMCResult action to take.
   11.24   */
   11.25 -functag SMC_NewSection SMCResult:public(Handle:smc, const String:name[], bool:opt_quotes);
   11.26 +functag public SMCResult:SMC_NewSection(Handle:smc, const String:name[], bool:opt_quotes);
   11.27  
   11.28  /**
   11.29   * Called when the parser finds a new key/value pair.
   11.30 @@ -162,7 +162,7 @@
   11.31   * @param value_quotes	Whether or not the value was enclosed in quotes.
   11.32   * @return				An SMCResult action to take.
   11.33   */
   11.34 -functag SMC_KeyValue SMCResult:public(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes);
   11.35 +functag public SMCResult:SMC_KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes);
   11.36  
   11.37  /**
   11.38   * Called when the parser finds the end of the current section.
   11.39 @@ -170,7 +170,7 @@
   11.40   * @param smc			The SMC Parse Handle.
   11.41   * @return				An SMCResult action to take.
   11.42   */
   11.43 -functag SMC_EndSection SMCResult:public(Handle:smc);
   11.44 +functag public SMCResult:SMC_EndSection(Handle:smc);
   11.45  
   11.46  /**
   11.47   * Sets the three main reader functions.
   11.48 @@ -191,7 +191,7 @@
   11.49   * @param lineno		The line number it occurs on.
   11.50   * @return				An SMCResult action to take.
   11.51   */
   11.52 -functag SMC_RawLine SMCResult:public(Handle:smc, const String:line[], lineno);
   11.53 +functag public SMCResult:SMC_RawLine(Handle:smc, const String:line[], lineno);
   11.54  
   11.55  /**
   11.56   * Sets a raw line reader on an SMC parser Handle.
    12.1 --- a/plugins/include/topmenus.inc	Sun Sep 21 14:05:13 2008 -0700
    12.2 +++ b/plugins/include/topmenus.inc	Sun Sep 21 14:56:38 2008 -0700
    12.3 @@ -127,7 +127,7 @@
    12.4   * @param maxlength			Output buffer (if used).
    12.5   * @noreturn
    12.6   */
    12.7 -functag TopMenuHandler public(Handle:topmenu, 
    12.8 +functag public TopMenuHandler(Handle:topmenu, 
    12.9  							  TopMenuAction:action,
   12.10  							  TopMenuObject:object_id,
   12.11  							  param,
    13.1 --- a/plugins/include/usermessages.inc	Sun Sep 21 14:05:13 2008 -0700
    13.2 +++ b/plugins/include/usermessages.inc	Sun Sep 21 14:56:38 2008 -0700
    13.3 @@ -124,14 +124,14 @@
    13.4   *						blocks the message from being sent, and Plugin_Continue 
    13.5   *						resumes normal functionality.
    13.6   */
    13.7 -functag MsgHook Action:public(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init);
    13.8 +functag public Action:MsgHook(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init);
    13.9  
   13.10  /**
   13.11   * Called when a message is finished sending.
   13.12   *
   13.13   * @param msg_id		Message index.
   13.14   */
   13.15 -functag MsgSentNotify public(UserMsg:msg_id);
   13.16 +functag public MsgSentNotify(UserMsg:msg_id);
   13.17  
   13.18  /**
   13.19   * Hooks a user message.
    14.1 --- a/sourcepawn/compiler/sc1.c	Sun Sep 21 14:05:13 2008 -0700
    14.2 +++ b/sourcepawn/compiler/sc1.c	Sun Sep 21 14:56:38 2008 -0700
    14.3 @@ -3182,12 +3182,27 @@
    14.4  	constvalue *cur;
    14.5  	funcenum_t *fenum = NULL;
    14.6  	int i;
    14.7 +	int newStyleTag = 0;
    14.8 +	int isNewStyle = 0;
    14.9  
   14.10  	/* get the explicit tag (required!) */
   14.11  	int l = lex(&val,&str);
   14.12  	if (l != tSYMBOL)
   14.13  	{
   14.14 -		error(93);
   14.15 +		if (listmode == FALSE && l == tPUBLIC)
   14.16 +		{
   14.17 +			isNewStyle = 1;
   14.18 +			newStyleTag = pc_addtag(NULL);
   14.19 +			l = lex(&val, &str);
   14.20 +			if (l != tSYMBOL)
   14.21 +			{
   14.22 +				error(93);
   14.23 +			}
   14.24 +		}
   14.25 +		else
   14.26 +		{
   14.27 +			error(93);
   14.28 +		}
   14.29  	}
   14.30  
   14.31  	/* This tag can't already exist! */
   14.32 @@ -3223,27 +3238,32 @@
   14.33  			break;
   14.34  		}
   14.35  		memset(&func, 0, sizeof(func));
   14.36 -		func.ret_tag = pc_addtag(NULL);	/* Get the return tag */
   14.37 -		l = lex(&val, &str);
   14.38 -		/* :TODO:
   14.39 -		 * Right now, there is a problem.  We can't pass non-public function pointer addresses around,
   14.40 -		 * because the address isn't known until the final reparse.  Unfortunately, you can write code
   14.41 -		 * before the address is known, because Pawn's compiler isn't truly multipass.
   14.42 -		 *
   14.43 -		 * When you call a function, there's no problem, because it does not write the address.
   14.44 -		 * The assembly looks like this:
   14.45 -		 *   call MyFunction
   14.46 -		 * Then, only at assembly time (once all passes are done), does it know the address.
   14.47 -		 * I do not see any solution to this because there is no way I know to inject the function name
   14.48 -		 * rather than the constant value.  And even if we could, we'd have to change the assembler recognize that.
   14.49 -		 */
   14.50 -		/*if (l == tSTOCK)
   14.51 +		if (!isNewStyle)
   14.52  		{
   14.53 -			func.type = uSTOCK;
   14.54 -		} else */if (l == tPUBLIC) {
   14.55 +			func.ret_tag = pc_addtag(NULL);	/* Get the return tag */
   14.56 +			l = lex(&val, &str);
   14.57 +			/* :TODO:
   14.58 +			 * Right now, there is a problem.  We can't pass non-public function pointer addresses around,
   14.59 +			 * because the address isn't known until the final reparse.  Unfortunately, you can write code
   14.60 +			 * before the address is known, because Pawn's compiler isn't truly multipass.
   14.61 +			 *
   14.62 +			 * When you call a function, there's no problem, because it does not write the address.
   14.63 +			 * The assembly looks like this:
   14.64 +			 *   call MyFunction
   14.65 +			 * Then, only at assembly time (once all passes are done), does it know the address.
   14.66 +			 * I do not see any solution to this because there is no way I know to inject the function name
   14.67 +			 * rather than the constant value.  And even if we could, we'd have to change the assembler recognize that.
   14.68 +			 */
   14.69 +			if (l == tPUBLIC) {
   14.70 +				func.type = uPUBLIC;
   14.71 +			} else {
   14.72 +				error(1, "-public-", str);
   14.73 +			}
   14.74 +		}
   14.75 +		else
   14.76 +		{
   14.77 +			func.ret_tag = newStyleTag;
   14.78  			func.type = uPUBLIC;
   14.79 -		} else {
   14.80 -			error(1, "-public-", str);
   14.81  		}
   14.82  		needtoken('(');
   14.83  		do