polserver/pol-core/bscript/execmodl.cpp
Kevin Eady 593cfffb83
Add uninit, true, false keywords to grammar (#596)
* Update grammar

* Update expression handling for uninit

* update existing tests

* Add new tests

* Remove fullpath from escriptgrammar generation comment

* fix tests

* Update eScript guide

* Declare escript version 0x11

* Add core-changes

* Add `true` and `false` to grammar

* true/false implementation

* Fix existing tests

* Add new tests

* Update core changes

* add docs

* Fix BooleanValue::describe_to

* bool optimizations

* optimize uninit

* remove unused var assignments

* Update grammar for case labels for uninit, booleans

* Fix case label handling for uninit, true, false

* Tests

* Fix compiler version display v1.1700000017881393 -> v1.17

* optimize boolean binary operations

* fix unary boolean optimizer

* add boolean, uninit optimizer test

* Use new fmt lib apis

* Fix compiler warning

* really fix warning lol

* Add Executor[Module]::getParam for bools, FindSubstance test
2024-01-20 05:38:25 +01:00

126 lines
3.2 KiB
C++

/** @file
*
* @par History
*/
#include "execmodl.h"
#include <string>
#include "executor.h"
namespace Pol
{
namespace Bscript
{
ExecutorModule::ExecutorModule( const char* moduleName, Executor& iExec )
: exec( iExec ), moduleName( moduleName )
{
}
BObjectImp* ExecutorModule::getParamImp( unsigned param )
{
return exec.getParamImp( param );
}
BObjectImp* ExecutorModule::getParamImp( unsigned param, BObjectImp::BObjectType type )
{
return exec.getParamImp( param, type );
}
bool ExecutorModule::getParamImp( unsigned param, BObjectImp*& imp )
{
imp = exec.getParamImp( param );
return imp != nullptr;
}
const String* ExecutorModule::getStringParam( unsigned param )
{
return exec.getStringParam( param );
}
void* ExecutorModule::getApplicPtrParam( unsigned param, const BApplicObjType* pointer_type )
{
return exec.getApplicPtrParam( param, pointer_type );
}
BApplicObjBase* ExecutorModule::getApplicObjParam( unsigned param,
const BApplicObjType* object_type )
{
return exec.getApplicObjParam( param, object_type );
}
bool ExecutorModule::getStringParam( unsigned param, const String*& pstr )
{
return exec.getStringParam( param, pstr );
}
bool ExecutorModule::getUnicodeStringParam( unsigned param, const String*& pstr )
{
return exec.getUnicodeStringParam( param, pstr );
}
bool ExecutorModule::getRealParam( unsigned param, double& value )
{
return exec.getRealParam( param, value );
}
bool ExecutorModule::getObjArrayParam( unsigned param, ObjArray*& pobjarr )
{
return exec.getObjArrayParam( param, pobjarr );
}
bool ExecutorModule::getParam( unsigned param, int& value )
{
return exec.getParam( param, value );
}
bool ExecutorModule::getParam( unsigned param, int& value, int maxval )
{
return exec.getParam( param, value, maxval );
}
bool ExecutorModule::getParam( unsigned param, int& value, int minval, int maxval )
{
return exec.getParam( param, value, minval, maxval );
}
bool ExecutorModule::getParam( unsigned param, unsigned& value )
{
return exec.getParam( param, value );
}
bool ExecutorModule::getParam( unsigned param, short& value )
{
return exec.getParam( param, value );
}
bool ExecutorModule::getParam( unsigned param, short& value, short maxval )
{
return exec.getParam( param, value, maxval );
}
bool ExecutorModule::getParam( unsigned param, short& value, short minval, short maxval )
{
return exec.getParam( param, value, minval, maxval );
}
bool ExecutorModule::getParam( unsigned param, unsigned short& value )
{
return exec.getParam( param, value );
}
bool ExecutorModule::getParam( unsigned param, unsigned short& value, unsigned short maxval )
{
return exec.getParam( param, value, maxval );
}
bool ExecutorModule::getParam( unsigned param, unsigned short& value, unsigned short minval,
unsigned short maxval )
{
return exec.getParam( param, value, minval, maxval );
}
bool ExecutorModule::getParam( unsigned param, bool& value )
{
return exec.getParam( param, value );
}
const std::string& ExecutorModule::scriptname() const
{
return exec.prog_->name;
}
size_t ExecutorModule::sizeEstimate() const
{
return sizeof( *this );
}
} // namespace Bscript
} // namespace Pol