initial commit
This commit is contained in:
commit
b6c60365ab
67 changed files with 17447 additions and 0 deletions
71
src/logic/wren/module/os.c
Normal file
71
src/logic/wren/module/os.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
#include "os.h"
|
||||
#include "wren.h"
|
||||
|
||||
#if __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
int numArgs;
|
||||
const char** args;
|
||||
|
||||
void osSetArguments(int argc, const char* argv[])
|
||||
{
|
||||
numArgs = argc;
|
||||
args = argv;
|
||||
}
|
||||
|
||||
void platformName(WrenVM* vm)
|
||||
{
|
||||
wrenEnsureSlots(vm, 1);
|
||||
|
||||
#ifdef _WIN32
|
||||
wrenSetSlotString(vm, 0, "Windows");
|
||||
#elif __APPLE__
|
||||
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
|
||||
wrenSetSlotString(vm, 0, "iOS");
|
||||
#elif TARGET_OS_MAC
|
||||
wrenSetSlotString(vm, 0, "OS X");
|
||||
#else
|
||||
wrenSetSlotString(vm, 0, "Unknown");
|
||||
#endif
|
||||
#elif __linux__
|
||||
wrenSetSlotString(vm, 0, "Linux");
|
||||
#elif __unix__
|
||||
wrenSetSlotString(vm, 0, "Unix");
|
||||
#elif defined(_POSIX_VERSION)
|
||||
wrenSetSlotString(vm, 0, "POSIX");
|
||||
#else
|
||||
wrenSetSlotString(vm, 0, "Unknown");
|
||||
#endif
|
||||
}
|
||||
|
||||
void platformIsPosix(WrenVM* vm)
|
||||
{
|
||||
wrenEnsureSlots(vm, 1);
|
||||
|
||||
#ifdef _WIN32
|
||||
wrenSetSlotBool(vm, 0, false);
|
||||
#elif __APPLE__
|
||||
wrenSetSlotBool(vm, 0, true);
|
||||
#elif __linux__
|
||||
wrenSetSlotBool(vm, 0, true);
|
||||
#elif __unix__
|
||||
wrenSetSlotBool(vm, 0, true);
|
||||
#elif defined(_POSIX_VERSION)
|
||||
wrenSetSlotBool(vm, 0, true);
|
||||
#else
|
||||
wrenSetSlotString(vm, 0, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void processAllArguments(WrenVM* vm)
|
||||
{
|
||||
wrenEnsureSlots(vm, 2);
|
||||
wrenSetSlotNewList(vm, 0);
|
||||
|
||||
for (int i = 0; i < numArgs; i++)
|
||||
{
|
||||
wrenSetSlotString(vm, 1, args[i]);
|
||||
wrenInsertInList(vm, 0, -1, 1);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue