2016-01-28 14:52:40 +01:00
|
|
|
/** @file
|
|
|
|
|
*
|
|
|
|
|
* @par History
|
|
|
|
|
*/
|
2016-02-11 22:54:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "userfunc.h"
|
|
|
|
|
|
2018-01-29 21:55:48 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
2016-02-11 22:54:43 +01:00
|
|
|
#include "../clib/logfacility.h"
|
2024-01-16 17:55:42 +01:00
|
|
|
|
2016-02-11 22:54:43 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
namespace Pol
|
|
|
|
|
{
|
|
|
|
|
namespace Bscript
|
|
|
|
|
{
|
|
|
|
|
unsigned int UserFunction::_instances;
|
|
|
|
|
std::set<UserFunction*> UserFunction::_instancelist;
|
|
|
|
|
void UserFunction::show_instances()
|
|
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
std::string tmp;
|
2016-02-19 19:26:35 +01:00
|
|
|
for ( const auto& uf : _instancelist )
|
|
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
tmp += uf->name + "\n";
|
2016-02-11 22:54:43 +01:00
|
|
|
}
|
2024-01-12 06:51:44 +01:00
|
|
|
ERROR_PRINT( tmp );
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
|
|
|
|
void UserFunction::register_instance()
|
|
|
|
|
{
|
|
|
|
|
++_instances;
|
|
|
|
|
_instancelist.insert( this );
|
|
|
|
|
}
|
|
|
|
|
void UserFunction::unregister_instance()
|
|
|
|
|
{
|
|
|
|
|
_instancelist.erase( this );
|
|
|
|
|
--_instances;
|
|
|
|
|
}
|
|
|
|
|
unsigned int UserFunction::instances()
|
|
|
|
|
{
|
|
|
|
|
return _instances;
|
|
|
|
|
}
|
|
|
|
|
UserFunction::UserFunction()
|
|
|
|
|
: name( "" ),
|
|
|
|
|
parameters(),
|
|
|
|
|
position( 0 ),
|
|
|
|
|
forward_callers(),
|
|
|
|
|
ctx(),
|
2018-10-09 16:36:35 +02:00
|
|
|
function_body( nullptr ),
|
2016-02-19 19:26:35 +01:00
|
|
|
exported( false ),
|
|
|
|
|
emitted( false )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
} // namespace Bscript
|
|
|
|
|
} // namespace Pol
|