PorygonLang/src/ScriptOptions.cpp

21 lines
756 B
C++
Raw Normal View History

#include <iostream>
#include "ScriptOptions.hpp"
#include "Utilities/StringUtils.hpp"
Porygon::ScriptOptions Porygon::ScriptOptions::DefaultScriptOptions;
std::streambuf* Porygon::ScriptOptions::_printBuffer = std::cout.rdbuf();
std::ostream* Porygon::ScriptOptions::_printStream = new std::ostream(Porygon::ScriptOptions::_printBuffer);
static void DefaultPrint(const char16_t* s){
Porygon::ScriptOptions::GetDefaultScriptOptions()->GetPrintStream() << Porygon::Utilities::StringUtils::FromUTF8(s) << std::endl;
}
void (*Porygon::ScriptOptions::_print)(const char16_t*) = DefaultPrint;
extern "C"{
void SetDefaultPrintFunc(void (*func)(const char16_t*)){
Porygon::ScriptOptions::GetDefaultScriptOptions()->SetPrintFunc(func);
}
}