Let the host application control how System prints text.

This commit is contained in:
Bob Nystrom
2015-09-15 23:01:43 -07:00
parent 58e4d26648
commit efceee4320
5 changed files with 46 additions and 60 deletions
+6
View File
@@ -145,6 +145,11 @@ static WrenForeignClassMethods bindForeignClass(
return methods;
}
static void write(WrenVM* vm, const char* text)
{
printf("%s", text);
}
static void initVM()
{
WrenConfiguration config;
@@ -153,6 +158,7 @@ static void initVM()
config.bindForeignMethodFn = bindForeignMethod;
config.bindForeignClassFn = bindForeignClass;
config.loadModuleFn = readModule;
config.writeFn = write;
// Since we're running in a standalone process, be generous with memory.
config.initialHeapSize = 1024 * 1024 * 100;