#pragma once #include "lua_parallel.h" // Platform-related code // Provided variables; // platform.os: string // platform.arch: string // platform.call_convention: string // platform.isa_exts: table int luaopen_platform(lua_State* L); // Returns the exit code of the command as well as a string of its stdout // int, string, string function platform.exec(cmd: string, args: array) int lua_platform_exec(lua_State* L); // Executes a command asynchronosly, returning a promise to the functions return values // promise, promise, promise function platform.exec_async(cmd: string, args: array) int lua_platform_exec_async(lua_State* L); // Executes a command asynchronosly, calling a callback on its completion with its error code and // overall stdout and another callback on each token read from its stdout // function platform.exec_async_cb(cmd: string, // function on_complete(cmd: string, exit_code: int, overall_output: string), // function on_stdout(cmd: string, overall_output: string, delta_output: string) // function on_stderr(cmd: string, overall_output: string, delta_output: string) // ) int lua_platform_exec_async_cb(lua_State* L); // Executes the same command up to N times in parallel, iterating through the args provided until all arguments have been used // array[promise, promise, promise] function platform.exec_parallel_async(cmd: string, N: int, args: array>) int lua_platform_exec_parallel_async(lua_State* L); // array, array, array function platform.exec_parallel(cmd: string, N: int, args: array>) int lua_platform_exec_parallel(lua_State* L);