2016-01-28 14:52:40 +01:00
|
|
|
/** @file
|
|
|
|
|
*
|
|
|
|
|
* @par History
|
|
|
|
|
*/
|
2016-02-11 22:54:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "basiciomod.h"
|
2023-10-18 15:18:06 +02:00
|
|
|
#include "bscript/berror.h"
|
|
|
|
|
#include "bscript/impstr.h"
|
|
|
|
|
#include "clib/logfacility.h"
|
|
|
|
|
#include "plib/systemstate.h"
|
2018-01-29 21:55:48 +01:00
|
|
|
|
2019-11-10 22:04:08 +01:00
|
|
|
#include <module_defs/basicio.h>
|
2016-02-11 22:54:43 +01:00
|
|
|
|
2023-10-18 15:18:06 +02:00
|
|
|
namespace Pol::Module
|
2016-02-19 19:26:35 +01:00
|
|
|
{
|
2016-12-14 21:50:23 +01:00
|
|
|
BasicIoExecutorModule::BasicIoExecutorModule( Bscript::Executor& exec )
|
2020-02-08 09:21:35 +01:00
|
|
|
: Bscript::TmplExecutorModule<BasicIoExecutorModule, Bscript::ExecutorModule>( exec )
|
2016-12-14 21:50:23 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-17 22:37:26 +02:00
|
|
|
Bscript::BObjectImp* BasicIoExecutorModule::mf_Print()
|
2016-02-19 19:26:35 +01:00
|
|
|
{
|
2023-10-18 15:18:06 +02:00
|
|
|
const Bscript::String* color;
|
|
|
|
|
if ( !exec.getStringParam( 1, color ) )
|
|
|
|
|
return new Bscript::BError( "Invalid parameter type" );
|
2024-07-16 12:41:55 +02:00
|
|
|
|
|
|
|
|
const auto& message = exec.getParamImp( 0 )->getStringRep();
|
|
|
|
|
|
2023-10-18 15:18:06 +02:00
|
|
|
if ( Plib::systemstate.config.enable_colored_output && color->length() )
|
|
|
|
|
{
|
2024-07-16 12:41:55 +02:00
|
|
|
INFO_PRINTLN( "{}{}{}", color->value(), message, Clib::Logging::CONSOLE_RESET_COLOR );
|
2023-10-18 15:18:06 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-07-16 12:41:55 +02:00
|
|
|
INFO_PRINTLN( message );
|
2023-10-18 15:18:06 +02:00
|
|
|
}
|
2024-07-16 12:41:55 +02:00
|
|
|
|
|
|
|
|
exec.print_to_debugger( message );
|
|
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
return new Bscript::UninitObject;
|
|
|
|
|
}
|
2023-10-18 15:18:06 +02:00
|
|
|
} // namespace Pol::Module
|