#include <stdarg.h>
#include <stdio.h>
-#include "physfs/ifile_stream.hpp"
+#include "physfs/buffered_ifile_stream.hpp"
#include "scripting/squirrel_error.hpp"
#include "scripting/wrapper.hpp"
#include "squirrel_util.hpp"
namespace {
-void printfunc(HSQUIRRELVM, const char* str, ...)
+#ifdef __clang__
+__attribute__((__format__ (__printf__, 2, 0)))
+#endif
+void printfunc(HSQUIRRELVM, const char* fmt, ...)
{
char buf[4096];
va_list arglist;
- va_start(arglist, str);
- vsnprintf(buf, sizeof(buf), str, arglist);
- ConsoleBuffer::output << (const char*) buf << std::flush;
+ va_start(arglist, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, arglist);
+ ConsoleBuffer::output << "[SQUIRREL] " << (const char*) buf << std::flush;
va_end(arglist);
}
// try to load default script
try {
std::string filename = "scripts/default.nut";
- IFileStream stream(filename);
- scripting::compile_and_run(global_vm, stream, filename);
+ BufferedIFileStream* buffered_stream = new BufferedIFileStream(filename);
+ IFileStream* stream = buffered_stream->get_stream();
+ scripting::compile_and_run(global_vm, *stream, filename);
} catch(std::exception& e) {
log_warning << "Couldn't load default.nut: " << e.what() << std::endl;
}
global_vm = NULL;
}
-
+
void
Scripting::update_debugger()
{