1#define PHASOR_FFI_BUILD_DLL
19 int fd = open(path, flags, 0666);
37 char *buf = (
char *)malloc(count + 1);
40 ssize_t r = read(fd, buf, count);
56 ssize_t r = write(fd,
s, strlen(
s));
100 char **args = (
char **)malloc((argcnt + 1) *
sizeof(
char *));
101 char **envs = (
char **)malloc((envcnt + 1) *
sizeof(
char *));
102 for (
size_t i = 0; i < argcnt; i++)
105 for (
size_t i = 0; i < envcnt; i++)
109 int r = execve(path, args, envs);
122 pid_t r = waitpid(pid, &status, options);
140 unsigned int r = sleep(sec);
150 int r = nanosleep(&req, &rem);
static bool phasor_is_string(PhasorValue val)
static const char * phasor_to_string(PhasorValue val)
static int64_t phasor_to_int(PhasorValue val)
static PhasorValue phasor_make_array(const PhasorValue *elements, size_t count)
static PhasorValue phasor_make_string(const char *s)
static bool phasor_is_int(PhasorValue val)
static bool phasor_is_array(PhasorValue val)
static PhasorValue phasor_make_int(int64_t i)
struct PhasorVM PhasorVM
Phasor Virtual Machine pointer.
#define PHASOR_FFI_EXPORT
PHASOR_FFI_EXPORT void phasor_plugin_entry(const PhasorAPI *api, PhasorVM *vm)
The one and only entry point for a Phasor plugin.
static PhasorValue phasor_execve(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_close(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_waitpid(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_sleep(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_clock_gettime(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_kill(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_fork(PhasorVM *, int, const PhasorValue *)
static PhasorValue phasor_nanosleep(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_rmdir(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_open(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_read(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_unlink(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_mkdir(PhasorVM *, int argc, const PhasorValue *argv)
static PhasorValue phasor_write(PhasorVM *, int argc, const PhasorValue *argv)
The collection of API functions that the Phasor host provides to the plugin.
PhasorRegisterFunction register_function
Registers a native C function with the given name.
Represents a value in the Phasor VM.
struct PhasorValue::@257106260015165034006071221344325333366100147341::@324103060207145140324203224012174236216253240107 a
const PhasorValue * elements
union PhasorValue::@257106260015165034006071221344325333366100147341 as