core/ForwardSys.cpp
author Nicholas Hastings <skamonkey@gmail.com>
Tue Jan 22 23:18:27 2013 -0500 (2013-01-22)
changeset 3749 4dc3d723c490
parent 2890 54f2a62d6198
child 3792 d8a07e40bcb6
permissions -rw-r--r--
Triggering build against new mac libprotobuf.
     1 /**
     2  * vim: set ts=4 sw=4 tw=99 noet :
     3  * =============================================================================
     4  * SourceMod
     5  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     6  * =============================================================================
     7  *
     8  * This program is free software; you can redistribute it and/or modify it under
     9  * the terms of the GNU General Public License, version 3.0, as published by the
    10  * Free Software Foundation.
    11  * 
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *
    20  * As a special exception, AlliedModders LLC gives you permission to link the
    21  * code of this program (as well as its derivative works) to "Half-Life 2," the
    22  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    23  * by the Valve Corporation.  You must obey the GNU General Public License in
    24  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    25  * this exception to all derivative works.  AlliedModders LLC defines further
    26  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    27  * or <http://www.sourcemod.net/license.php>.
    28  *
    29  * Version: $Id$
    30  */
    31 
    32 #include <assert.h>
    33 #include <stdarg.h>
    34 #include <string.h>
    35 #include "ForwardSys.h"
    36 #include "PluginSys.h"
    37 #include "ShareSys.h"
    38 #include "DebugReporter.h"
    39 
    40 CForwardManager g_Forwards;
    41 
    42 /**
    43  * Genesis turns to its source, reduction occurs stepwise although the essence is all one.
    44  * End of line.  FTL system check.
    45  *
    46  * :TODO: WHAT NEEDS TO BE TESTED IN THIS BEAST
    47  * VARARG FUNCTIONS:
    48  * - Pushing no varargs
    49  */
    50 
    51 // :TODO: IMPORTANT!!! The result pointer arg in the execute function maybe invalid if the forward fails
    52 // so later evaluation of this result may cause problems on higher levels of abstraction. DOCUMENT OR FIX ALL FORWARDS!
    53 
    54 CForwardManager::~CForwardManager()
    55 {
    56 	CStack<CForward *>::iterator iter;
    57 	for (iter=m_FreeForwards.begin(); iter!=m_FreeForwards.end(); iter++)
    58 	{
    59 		delete (*iter);
    60 	}
    61 	m_FreeForwards.popall();
    62 }
    63 
    64 void CForwardManager::OnSourceModAllInitialized()
    65 {
    66 	g_PluginSys.AddPluginsListener(this);
    67 	g_ShareSys.AddInterface(NULL, this);
    68 }
    69 
    70 IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned int num_params, const ParamType *types, ...)
    71 {
    72 	CForward *fwd;
    73 	va_list ap;
    74 	va_start(ap, types);
    75 	
    76 	fwd = CForward::CreateForward(name, et, num_params, types, ap);
    77 
    78 	va_end(ap);
    79 
    80 	if (fwd)
    81 	{
    82 		g_PluginSys.AddFunctionsToForward(name, fwd);
    83 
    84 		m_managed.push_back(fwd);
    85 	}
    86 
    87 	return fwd;
    88 }
    89 
    90 IChangeableForward *CForwardManager::CreateForwardEx(const char *name, ExecType et, int num_params, const ParamType *types, ...)
    91 {
    92 	CForward *fwd;
    93 	va_list ap;
    94 	va_start(ap, types);
    95 
    96 	fwd = CForward::CreateForward(name, et, num_params, types, ap);
    97 
    98 	va_end(ap);
    99 
   100 	if (fwd)
   101 	{
   102 		m_unmanaged.push_back(fwd);
   103 	}
   104 
   105 	return fwd;
   106 }
   107 
   108 void CForwardManager::OnPluginLoaded(IPlugin *plugin)
   109 {
   110 	/* Attach any globally managed forwards */
   111 	List<CForward *>::iterator iter;
   112 	CForward *fwd;
   113 
   114 	for (iter=m_managed.begin(); iter!=m_managed.end(); iter++)
   115 	{
   116 		fwd = (*iter);
   117 		IPluginFunction *pFunc = plugin->GetBaseContext()->GetFunctionByName(fwd->GetForwardName());
   118 		if (pFunc)
   119 		{
   120 			fwd->AddFunction(pFunc);
   121 		}
   122 	}
   123 }
   124 
   125 void CForwardManager::OnPluginUnloaded(IPlugin *plugin)
   126 {
   127 	List<CForward *>::iterator iter;
   128 	CForward *fwd;
   129 
   130 	for (iter=m_managed.begin(); iter!=m_managed.end(); iter++)
   131 	{
   132 		fwd = (*iter);
   133 		fwd->RemoveFunctionsOfPlugin(plugin);
   134 	}
   135 
   136 	for (iter=m_unmanaged.begin(); iter!=m_unmanaged.end(); iter++)
   137 	{
   138 		fwd = (*iter);
   139 		fwd->RemoveFunctionsOfPlugin(plugin);
   140 	}
   141 }
   142 
   143 IForward *CForwardManager::FindForward(const char *name, IChangeableForward **ifchng)
   144 {
   145 	List<CForward *>::iterator iter;
   146 	CForward *fwd;
   147 
   148 	for (iter=m_managed.begin(); iter!=m_managed.end(); iter++)
   149 	{
   150 		fwd = (*iter);
   151 		if (strcmp(fwd->GetForwardName(), name) == 0)
   152 		{
   153 			if (ifchng)
   154 			{
   155 				*ifchng = NULL;
   156 			}
   157 			return fwd;
   158 		}
   159 	}
   160 
   161 	for (iter=m_unmanaged.begin(); iter!=m_unmanaged.end(); iter++)
   162 	{
   163 		fwd = (*iter);
   164 		if (strcmp(fwd->GetForwardName(), name) == 0)
   165 		{
   166 			if (ifchng)
   167 			{
   168 				*ifchng = fwd;
   169 			}
   170 			return fwd;
   171 		}
   172 	}
   173 
   174 	if (ifchng)
   175 	{
   176 		*ifchng = NULL;
   177 	}
   178 
   179 	return NULL;
   180 }
   181 
   182 void CForwardManager::ReleaseForward(IForward *forward)
   183 {
   184 	ForwardFree(static_cast<CForward *>(forward));
   185 }
   186 
   187 void CForwardManager::ForwardFree(CForward *fwd)
   188 {
   189     if (fwd == NULL)
   190     {
   191         return;
   192     }
   193 
   194 	m_FreeForwards.push(fwd);
   195 	m_managed.remove(fwd);
   196 }
   197 
   198 CForward *CForwardManager::ForwardMake()
   199 {
   200 	CForward *fwd;
   201 	if (m_FreeForwards.empty())
   202 	{
   203 		fwd = new CForward;
   204 	} else {
   205 		fwd = m_FreeForwards.front();
   206 		m_FreeForwards.pop();
   207 	}
   208 	return fwd;
   209 }
   210 
   211 void CForwardManager::OnPluginPauseChange(IPlugin *plugin, bool paused)
   212 {
   213 	/* No longer used */
   214 }
   215 
   216 /*************************************
   217  * ACTUAL FORWARD API IMPLEMENTATION *
   218  *************************************/
   219 
   220 CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int num_params, const ParamType *types, va_list ap)
   221 {
   222 	ParamType _types[SP_MAX_EXEC_PARAMS];
   223 
   224 	if (num_params > SP_MAX_EXEC_PARAMS)
   225 	{
   226 		return NULL;
   227 	}
   228 	
   229 	if (types == NULL && num_params)
   230 	{
   231 		for (unsigned int i=0; i<num_params; i++)
   232 		{
   233 			_types[i] = (ParamType)va_arg(ap, int);
   234 			if (_types[i] == Param_VarArgs && (i != num_params - 1))
   235 			{
   236 				return NULL;
   237 			}
   238 		}
   239 		types = _types;
   240 	} else {
   241 		for (unsigned int i=0; i<num_params; i++)
   242 		{
   243 			_types[i] = types[i];
   244 			if (types[i] == Param_VarArgs && (i != num_params - 1))
   245 			{
   246 				return NULL;
   247 			}
   248 		}
   249 	}
   250 
   251 	/* First parameter can never be varargs */
   252 	if (num_params && _types[0] == Param_VarArgs)
   253 	{
   254 		return NULL;
   255 	}
   256 
   257 	CForward *pForward = g_Forwards.ForwardMake();
   258 	pForward->m_IterGuard = NULL;
   259 	pForward->m_curparam = 0;
   260 	pForward->m_ExecType = et;
   261 	snprintf(pForward->m_name, FORWARDS_NAME_MAX, "%s", name ? name : "");
   262 	
   263 	for (unsigned int i=0; i<num_params; i++)
   264 	{
   265 		pForward->m_types[i] = _types[i];
   266 	}
   267 
   268 	if (num_params && _types[num_params-1] == Param_VarArgs)
   269 	{
   270 		pForward->m_varargs = num_params--;
   271 	} else {
   272 		pForward->m_varargs = false;
   273 	}
   274 
   275 	pForward->m_numparams = num_params;
   276 	pForward->m_errstate = SP_ERROR_NONE;
   277 
   278 	pForward->m_functions.clear();
   279 
   280 	return pForward;
   281 }
   282 
   283 int CForward::Execute(cell_t *result, IForwardFilter *filter)
   284 {
   285 	if (m_errstate)
   286 	{
   287 		int err = m_errstate;
   288 		Cancel();
   289 		return err;
   290 	}
   291 
   292 	FuncIter iter = m_functions.begin();
   293 	IPluginFunction *func;
   294 	cell_t cur_result = 0;
   295 	cell_t high_result = 0;
   296 	cell_t low_result = 0;
   297 	int err;
   298 	unsigned int success=0;
   299 	unsigned int num_params = m_curparam;
   300 	FwdParamInfo temp_info[SP_MAX_EXEC_PARAMS];
   301 	FwdParamInfo *param;
   302 	ParamType type;
   303 
   304 	/* Save local, reset */
   305 	memcpy(temp_info, m_params, sizeof(m_params));
   306 	m_curparam = 0;
   307 
   308 	FuncIteratorGuard guard(&m_IterGuard, &iter);
   309 
   310 	while (iter != m_functions.end())
   311 	{
   312 		func = (*iter);
   313 
   314 		if (filter)
   315 			filter->Preprocess(func, temp_info);
   316 
   317 		for (unsigned int i=0; i<num_params; i++)
   318 		{
   319 			int err = SP_ERROR_PARAM;
   320 			param = &temp_info[i];
   321 
   322 			if (i >= m_numparams || m_types[i] == Param_Any)
   323 			{
   324 				type = param->pushedas;
   325 			}
   326 			else
   327 			{
   328 				type = m_types[i];
   329 			}
   330 
   331 			if ((i >= m_numparams) || (type & SP_PARAMFLAG_BYREF))
   332 			{
   333 				/* If we're byref or we're vararg, we always push everything by ref.
   334 				 * Even if they're byval, we must push them byref.
   335 				 */
   336 				if (type == Param_String)
   337 				{
   338 					err = func->PushStringEx((char *)param->byref.orig_addr, param->byref.cells, param->byref.sz_flags, param->byref.flags);
   339 				}
   340 				else if (type == Param_Float || type == Param_Cell)
   341 				{
   342 					err = func->PushCellByRef(&param->val); 
   343 				}
   344 				else
   345 				{
   346 					err = func->PushArray(param->byref.orig_addr, param->byref.cells, param->byref.flags);
   347 					assert(type == Param_Array || type == Param_FloatByRef || type == Param_CellByRef);
   348 				}
   349 			}
   350 			else
   351 			{
   352 				/* If we're not byref or not vararg, our job is a bit easier. */
   353 				assert(type == Param_Cell || type == Param_Float);
   354 				err = func->PushCell(param->val);
   355 			}
   356 
   357 			if (err != SP_ERROR_NONE)
   358 			{
   359 				g_DbgReporter.GenerateError(func->GetParentContext(), 
   360 					func->GetFunctionID(), 
   361 					err, 
   362 					"Failed to push parameter while executing forward");
   363 				continue;
   364 			}
   365 		}
   366 		
   367 		/* Call the function and deal with the return value. */
   368 		if ((err=func->Execute(&cur_result)) == SP_ERROR_NONE)
   369 		{
   370 			success++;
   371 			switch (m_ExecType)
   372 			{
   373 			case ET_Event:
   374 				{
   375 					if (cur_result > high_result)
   376 					{
   377 						high_result = cur_result;
   378 					}
   379 					break;
   380 				}
   381 			case ET_Hook:
   382 				{
   383 					if (cur_result > high_result)
   384 					{
   385 						high_result = cur_result;
   386 						if ((ResultType)high_result == Pl_Stop)
   387 						{
   388 							goto done;
   389 						}
   390 					}
   391 					break;
   392 				}
   393 			case ET_LowEvent:
   394 				{
   395 					/* Check if the current result is the lowest so far (or if it's the first result) */
   396 					if (cur_result < low_result || success == 1)
   397 					{
   398 						low_result = cur_result;
   399 					}
   400 					break;
   401 				}
   402 			default:
   403 				{
   404 					break;
   405 				}
   406 			}
   407 		}
   408 
   409 		if (!guard.Triggered())
   410 			iter++;
   411 	}
   412 
   413 done:
   414 
   415 	if (success)
   416 	{
   417 		switch (m_ExecType)
   418 		{
   419 		case ET_Ignore:
   420 			{
   421 				cur_result = 0;
   422 				break;
   423 			}
   424 		case ET_Event:
   425 		case ET_Hook:
   426 			{
   427 				cur_result = high_result;
   428 				break;
   429 			}
   430 		case ET_LowEvent:
   431 			{
   432 				cur_result = low_result;
   433 				break;
   434 			}
   435 		default:
   436 			{
   437 				break;
   438 			}
   439 		}
   440 
   441 		if (result)
   442 		{
   443 			*result = cur_result;
   444 		}
   445 	}
   446 
   447 	return SP_ERROR_NONE;
   448 }
   449 
   450 int CForward::PushCell(cell_t cell)
   451 {
   452 	if (m_curparam < m_numparams)
   453 	{
   454 		if (m_types[m_curparam] == Param_Any)
   455 		{
   456 			m_params[m_curparam].pushedas = Param_Cell;
   457 		} else if (m_types[m_curparam] != Param_Cell) {
   458 			return SetError(SP_ERROR_PARAM);
   459 		}
   460 	} else {
   461 		if (!m_varargs || m_numparams > SP_MAX_EXEC_PARAMS)
   462 		{
   463 			return SetError(SP_ERROR_PARAMS_MAX);
   464 		}
   465 		m_params[m_curparam].pushedas = Param_Cell;
   466 	}
   467 
   468 	m_params[m_curparam++].val = cell;
   469 
   470 	return SP_ERROR_NONE;
   471 }
   472 
   473 int CForward::PushFloat(float number)
   474 {
   475 	if (m_curparam < m_numparams)
   476 	{
   477 		if (m_types[m_curparam] == Param_Any)
   478 		{
   479 			m_params[m_curparam].pushedas = Param_Float;
   480 		} else if (m_types[m_curparam] != Param_Float) {
   481 			return SetError(SP_ERROR_PARAM);
   482 		}
   483 	} else {
   484 		if (!m_varargs || m_numparams > SP_MAX_EXEC_PARAMS)
   485 		{
   486 			return SetError(SP_ERROR_PARAMS_MAX);
   487 		}
   488 		m_params[m_curparam].pushedas = Param_Float;
   489 	}
   490 
   491 	m_params[m_curparam++].val = *(cell_t *)&number;
   492 
   493 	return SP_ERROR_NONE;
   494 }
   495 
   496 int CForward::PushCellByRef(cell_t *cell, int flags)
   497 {
   498 	if (m_curparam < m_numparams)
   499 	{
   500 		if (m_types[m_curparam] == Param_Any)
   501 		{
   502 			m_params[m_curparam].pushedas = Param_CellByRef;
   503 		} else if (m_types[m_curparam] != Param_CellByRef) {
   504 			return SetError(SP_ERROR_PARAM);
   505 		}
   506 	} else {
   507 		if (!m_varargs || m_numparams > SP_MAX_EXEC_PARAMS)
   508 		{
   509 			return SetError(SP_ERROR_PARAMS_MAX);
   510 		}
   511 		m_params[m_curparam].pushedas = Param_CellByRef;
   512 	}
   513 
   514 	_Int_PushArray(cell, 1, flags);
   515 	m_curparam++;
   516 
   517 	return SP_ERROR_NONE;
   518 }
   519 
   520 int CForward::PushFloatByRef(float *num, int flags)
   521 {
   522 	if (m_curparam < m_numparams)
   523 	{
   524 		if (m_types[m_curparam] == Param_Any)
   525 		{
   526 			m_params[m_curparam].pushedas = Param_FloatByRef;
   527 		} else if (m_types[m_curparam] != Param_FloatByRef) {
   528 			return SetError(SP_ERROR_PARAM);
   529 		}
   530 	} else {
   531 		if (!m_varargs || m_numparams > SP_MAX_EXEC_PARAMS)
   532 		{
   533 			return SetError(SP_ERROR_PARAMS_MAX);
   534 		}
   535 		m_params[m_curparam].pushedas = Param_FloatByRef;
   536 	}
   537 
   538 	_Int_PushArray((cell_t *)num, 1, flags);
   539 	m_curparam++;
   540 
   541 	return SP_ERROR_NONE;
   542 }
   543 
   544 void CForward::_Int_PushArray(cell_t *inarray, unsigned int cells, int flags)
   545 {
   546 	m_params[m_curparam].byref.cells = cells;
   547 	m_params[m_curparam].byref.flags = flags;
   548 	m_params[m_curparam].byref.orig_addr = inarray;
   549 }
   550 
   551 int CForward::PushArray(cell_t *inarray, unsigned int cells, int flags)
   552 {
   553 	/* We don't allow this here */
   554 	if (!inarray)
   555 	{
   556 		return SetError(SP_ERROR_PARAM);
   557 	}
   558 
   559 	if (m_curparam < m_numparams)
   560 	{
   561 		if (m_types[m_curparam] == Param_Any)
   562 		{
   563 			m_params[m_curparam].pushedas = Param_Array;
   564 		} else if (m_types[m_curparam] != Param_Array) {
   565 			return SetError(SP_ERROR_PARAM);
   566 		}
   567 	} else {
   568 		if (!m_varargs || m_curparam > SP_MAX_EXEC_PARAMS)
   569 		{
   570 			return SetError(SP_ERROR_PARAMS_MAX);
   571 		}
   572 		m_params[m_curparam].pushedas = Param_Array;
   573 	}
   574 
   575 	_Int_PushArray(inarray, cells, flags);
   576 
   577 	m_curparam++;
   578 
   579 	return SP_ERROR_NONE;
   580 }
   581 
   582 void CForward::_Int_PushString(cell_t *inarray, unsigned int cells, int sz_flags, int cp_flags)
   583 {
   584 	m_params[m_curparam].byref.cells = cells;	/* Notice this contains the char count not cell count */
   585 	m_params[m_curparam].byref.flags = cp_flags;
   586 	m_params[m_curparam].byref.orig_addr = inarray;
   587 	m_params[m_curparam].byref.sz_flags = sz_flags;
   588 }
   589 
   590 int CForward::PushString(const char *string)
   591 {
   592 	if (m_curparam < m_numparams)
   593 	{
   594 		if (m_types[m_curparam] == Param_Any)
   595 		{
   596 			m_params[m_curparam].pushedas = Param_String;
   597 		} else if (m_types[m_curparam] != Param_String) {
   598 			return SetError(SP_ERROR_PARAM);
   599 		}
   600 	} else {
   601 		if (!m_varargs || m_curparam > SP_MAX_EXEC_PARAMS)
   602 		{
   603 			return SetError(SP_ERROR_PARAMS_MAX);
   604 		}
   605 		m_params[m_curparam].pushedas = Param_String;
   606 	}
   607 
   608 	_Int_PushString((cell_t *)string, strlen(string)+1, SM_PARAM_STRING_COPY, 0);
   609 	m_curparam++;
   610 
   611 	return SP_ERROR_NONE;
   612 }
   613 
   614 int CForward::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags)
   615 {
   616 	if (m_curparam < m_numparams)
   617 	{
   618 		if (m_types[m_curparam] == Param_Any)
   619 		{
   620 			m_params[m_curparam].pushedas = Param_String;
   621 		} else if (m_types[m_curparam] != Param_String) {
   622 			return SetError(SP_ERROR_PARAM);
   623 		}
   624 	} else {
   625 		if (!m_varargs || m_curparam > SP_MAX_EXEC_PARAMS)
   626 		{
   627 			return SetError(SP_ERROR_PARAMS_MAX);
   628 		}
   629 		m_params[m_curparam].pushedas = Param_String;
   630 	}
   631 
   632 	_Int_PushString((cell_t *)buffer, length, sz_flags, cp_flags);
   633 	m_curparam++;
   634 
   635 	return SP_ERROR_NONE;
   636 }
   637 
   638 void CForward::Cancel()
   639 {
   640 	if (!m_curparam)
   641 	{
   642 		return;
   643 	}
   644 
   645 	m_curparam = 0;
   646 	m_errstate = SP_ERROR_NONE;
   647 }
   648 
   649 bool CForward::AddFunction(IPluginContext *pContext, funcid_t index)
   650 {
   651 	IPluginFunction *pFunc = pContext->GetFunctionById(index);
   652 
   653 	if (!pFunc)
   654 	{
   655 		return false;
   656 	}
   657 
   658 	return AddFunction(pFunc);
   659 }
   660 
   661 bool CForward::RemoveFunction(IPluginContext *pContext, funcid_t index)
   662 {
   663 	IPluginFunction *pFunc = pContext->GetFunctionById(index);
   664 
   665 	if (!pFunc)
   666 	{
   667 		return false;
   668 	}
   669 
   670 	return RemoveFunction(pFunc);
   671 }
   672 
   673 bool CForward::RemoveFunction(IPluginFunction *func)
   674 {
   675 	bool found = false;
   676 	FuncIter iter;
   677 	List<IPluginFunction *> *lst;
   678 
   679 	if (func->IsRunnable())
   680 	{
   681 		lst = &m_functions;
   682 	} else {
   683 		lst = &m_paused;
   684 	}
   685 
   686 	for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
   687 	{
   688 		if ((*iter) == func)
   689 		{
   690 			m_IterGuard->FixIteratorChain(iter);
   691 			found = true;
   692 			lst->erase(iter);
   693 			break;
   694 		}
   695 	}
   696 
   697 	/* Cancel a call, if any */
   698 	if (found || m_curparam)
   699 	{
   700 		func->Cancel();
   701 	}
   702 
   703 	return found;
   704 }
   705 
   706 unsigned int CForward::RemoveFunctionsOfPlugin(IPlugin *plugin)
   707 {
   708 	FuncIter iter;
   709 	IPluginFunction *func;
   710 	unsigned int removed = 0;
   711 	IPluginContext *pContext = plugin->GetBaseContext();
   712 	for (iter=m_functions.begin(); iter!=m_functions.end();)
   713 	{
   714 		func = (*iter);
   715 		if (func->GetParentContext() == pContext)
   716 		{
   717 			iter = m_functions.erase(iter);
   718 			removed++;
   719 		} else {
   720 			iter++;
   721 		}
   722 	}
   723 
   724 	return removed;
   725 }
   726 
   727 bool CForward::AddFunction(IPluginFunction *func)
   728 {
   729 	if (m_curparam)
   730 	{
   731 		return false;
   732 	}
   733 
   734 	if (func->IsRunnable())
   735 	{
   736 		m_functions.push_back(func);
   737 	} else {
   738 		m_paused.push_back(func);
   739 	}
   740 
   741 	return true;
   742 }
   743 
   744 const char *CForward::GetForwardName()
   745 {
   746 	return m_name;
   747 }
   748 
   749 unsigned int CForward::GetFunctionCount()
   750 {
   751 	return m_functions.size();
   752 }
   753 
   754 ExecType CForward::GetExecType()
   755 {
   756 	return m_ExecType;
   757 }