1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Manage to get a working hello world.

This commit is contained in:
Sandu Liviu Catalin 2020-09-06 20:22:43 +03:00
parent be0e5bd6d2
commit cc69b15190
2 changed files with 11 additions and 3 deletions

View File

@ -376,9 +376,13 @@ void Worker::Work()
case Job::Type::Stop:
break;
case Job::Type::Eval:
sq_compilebuffer(m_VM, job->mPayload.data(), job->mPayload.size(), nullptr, SQFalse);
break;
case Job::Type::Eval: {
sq_compilebuffer(m_VM, job->mPayload.data(), job->mPayload.size(), _SC("eval"), SQTrue);
SQInteger top = sq_gettop(m_VM);
sq_pushroottable(m_VM);
sq_call(m_VM, 1, false, true);
sq_settop(m_VM, top);
} break;
case Job::Type::Exec:
break;
@ -396,6 +400,7 @@ void Worker::PrintFunc(HSQUIRRELVM /*vm*/, CSStr msg, ...)
va_start(args, msg);
// Forward the message to the logger
std::vprintf(msg, args);
std::puts("");
// Finalize the variable argument list
va_end(args);
}
@ -408,6 +413,7 @@ void Worker::ErrorFunc(HSQUIRRELVM /*vm*/, CSStr msg, ...)
va_start(args, msg);
// Tell the logger to display debugging information
std::vprintf(msg, args);
std::puts("");
// Finalize the variable argument list
va_end(args);
}

View File

@ -448,6 +448,8 @@ struct Worker
}
// Create the job
std::unique_ptr< Job > job(new Job(std::move(callback)));
// Define type
job->mType = Job::Type::Eval;
// Assign data
job->mPayload.assign(str.mPtr, static_cast< size_t >(str.mLen));
// Submit job