14 #include "../bscript/berror.h" 15 #include "../bscript/eprog.h" 16 #include "../bscript/executor.h" 17 #include "../clib/clib.h" 18 #include "../clib/logfacility.h" 25 using namespace Bscript;
28 if ( scriptname.find(
".ecl" ) == std::string::npos )
30 sd.config( scriptname, pkg,
"",
true );
53 if ( stricmp( exportedfunc->
name.c_str(), name.c_str() ) == 0 )
55 if ( args != exportedfunc->
nargs )
58 << exportedfunc->
nargs <<
" parameters, expected " << args <<
"\n";
61 PC = exportedfunc->
PC;
74 if ( stricmp( exportedfunc->
name.c_str(),
name ) == 0 )
76 if ( args != exportedfunc->
nargs )
79 << exportedfunc->
nargs <<
" parameters, expected " << args <<
"\n";
82 PC = exportedfunc->
PC;
125 catch ( std::exception& )
164 catch ( std::exception& )
202 catch ( std::exception& )
239 catch ( std::exception& )
276 catch ( std::exception& )
315 catch ( std::exception& )
347 ret = pLong->
value();
361 catch ( std::exception& )
394 ret = pLong->
value();
408 catch ( std::exception& )
425 size_t n = pmore.size();
426 for (
size_t i = 0; i < n; ++i )
436 ret =
new BError(
"Error during execution" );
438 ret =
new BError(
"There was no return value??" );
450 catch ( std::exception& )
452 return new BError(
"Exception during execution" );
467 size_t n = pmore.size();
468 for (
size_t i = 0; i < n; ++i )
477 ret =
new BError(
"Error during execution" );
479 ret =
new BError(
"There was no return value??" );
491 catch ( std::exception& )
493 return BObject(
new BError(
"Exception during execution" ) );
515 ret =
new BError(
"Error during execution" );
517 ret =
new BError(
"There was no return value??" );
529 catch ( std::exception& )
531 return BObject(
new BError(
"Exception during execution" ) );
553 ret =
new BError(
"Error during execution" );
555 ret =
new BError(
"There was no return value??" );
567 catch ( std::exception& )
569 return BObject(
new BError(
"Exception during execution" ) );
595 if ( backup.
PC != 0 )
603 if ( backup.
Locals.get() != nullptr )
void SaveStack(Bscript::BackupStruct &backup)
const EScriptProgram * prog() const
std::string call_string(unsigned PC, Bscript::BObjectImp *p0, Bscript::BObjectImp *p1)
ValueStackCont ValueStack
const std::string & scriptname() const
ValueStackCont ValueStack
bool isa(BObjectType type) const
Bscript::BObject call_object(unsigned PC, Bscript::BObjectImp *p0, Bscript::BObjectImp *p1)
std::vector< EPExportedFunction > exported_functions
std::vector< BObjectRef > BObjectRefVec
size_t estimatedSize() const
bool call(unsigned PC, Bscript::BObjectImp *p0)
void LoadStack(Bscript::BackupStruct &backup)
const std::string & name() const
void pushArg(BObjectImp *arg)
bool FindExportedFunction(const std::string &name, unsigned args, unsigned &PC) const
virtual size_t sizeEstimate() const POL_OVERRIDE
size_t estimateSize() const
ExportScript(const Plib::Package *pkg, std::string scriptname)
std::vector< ref_ptr< BObjectImp > > BObjectImpRefVec
void initForFnCall(unsigned in_PC)
std::unique_ptr< BObjectRefVec > Locals
BObjectImp * run_executor_to_completion(UOExecutor &ex, const ScriptDef &script)
int call_long(unsigned PC, Bscript::BObjectImp *p0)