Phasor 2.2.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
PhasorFFI.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for PhasorFFI.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PhasorValue
struct  PhasorAPI

Macros

#define PHASOR_FFI_EXPORT

Typedefs

typedef struct PhasorVM PhasorVM
typedef struct PhasorValue PhasorValue
typedef PhasorValue(* PhasorNativeFunction) (PhasorVM *vm, int argc, const PhasorValue *argv)
typedef void(* PhasorRegisterFunction) (PhasorVM *vm, const char *name, PhasorNativeFunction func)

Enumerations

enum  PhasorValueType {
  PHASOR_TYPE_NULL , PHASOR_TYPE_BOOL , PHASOR_TYPE_INT , PHASOR_TYPE_FLOAT ,
  PHASOR_TYPE_STRING , PHASOR_TYPE_ARRAY
}

Functions

static PhasorValue phasor_make_null ()
static PhasorValue phasor_make_bool (bool b)
static PhasorValue phasor_make_int (int64_t i)
static PhasorValue phasor_make_float (double f)
static PhasorValue phasor_make_string (const char *s)
static PhasorValue phasor_make_array (const PhasorValue *elements, size_t count)
static bool phasor_is_null (PhasorValue val)
static bool phasor_is_bool (PhasorValue val)
static bool phasor_is_int (PhasorValue val)
static bool phasor_is_float (PhasorValue val)
static bool phasor_is_string (PhasorValue val)
static bool phasor_is_array (PhasorValue val)
static bool phasor_is_number (PhasorValue val)
static bool phasor_to_bool (PhasorValue val)
static int64_t phasor_to_int (PhasorValue val)
static double phasor_to_float (PhasorValue val)
static const char * phasor_to_string (PhasorValue val)
PHASOR_FFI_EXPORT void phasor_plugin_entry (const PhasorAPI *api, PhasorVM *vm)
 The one and only entry point for a Phasor plugin.

Macro Definition Documentation

◆ PHASOR_FFI_EXPORT

#define PHASOR_FFI_EXPORT

Definition at line 34 of file PhasorFFI.h.

Typedef Documentation

◆ PhasorNativeFunction

typedef PhasorValue(* PhasorNativeFunction) (PhasorVM *vm, int argc, const PhasorValue *argv)

Definition at line 148 of file PhasorFFI.h.

◆ PhasorRegisterFunction

typedef void(* PhasorRegisterFunction) (PhasorVM *vm, const char *name, PhasorNativeFunction func)

Definition at line 151 of file PhasorFFI.h.

◆ PhasorValue

typedef struct PhasorValue PhasorValue

Definition at line 57 of file PhasorFFI.h.

◆ PhasorVM

typedef struct PhasorVM PhasorVM

Definition at line 42 of file PhasorFFI.h.

Enumeration Type Documentation

◆ PhasorValueType

Enumerator
PHASOR_TYPE_NULL 
PHASOR_TYPE_BOOL 
PHASOR_TYPE_INT 
PHASOR_TYPE_FLOAT 
PHASOR_TYPE_STRING 
PHASOR_TYPE_ARRAY 

Definition at line 45 of file PhasorFFI.h.

Function Documentation

◆ phasor_is_array()

bool phasor_is_array ( PhasorValue val)
inlinestatic

Definition at line 129 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_is_bool()

bool phasor_is_bool ( PhasorValue val)
inlinestatic

Definition at line 125 of file PhasorFFI.h.

◆ phasor_is_float()

bool phasor_is_float ( PhasorValue val)
inlinestatic

Definition at line 127 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_is_int()

bool phasor_is_int ( PhasorValue val)
inlinestatic

Definition at line 126 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_is_null()

bool phasor_is_null ( PhasorValue val)
inlinestatic

Definition at line 124 of file PhasorFFI.h.

◆ phasor_is_number()

bool phasor_is_number ( PhasorValue val)
inlinestatic

Definition at line 130 of file PhasorFFI.h.

Here is the call graph for this function:

◆ phasor_is_string()

bool phasor_is_string ( PhasorValue val)
inlinestatic

Definition at line 128 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_array()

PhasorValue phasor_make_array ( const PhasorValue * elements,
size_t count )
inlinestatic

Definition at line 115 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_bool()

PhasorValue phasor_make_bool ( bool b)
inlinestatic

Definition at line 87 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_float()

PhasorValue phasor_make_float ( double f)
inlinestatic

Definition at line 101 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_int()

PhasorValue phasor_make_int ( int64_t i)
inlinestatic

Definition at line 94 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_null()

PhasorValue phasor_make_null ( )
inlinestatic

Definition at line 81 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_string()

PhasorValue phasor_make_string ( const char * s)
inlinestatic

Definition at line 108 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_plugin_entry()

PHASOR_FFI_EXPORT void phasor_plugin_entry ( const PhasorAPI * api,
PhasorVM * vm )

The one and only entry point for a Phasor plugin.

A Phasor-compatible shared library MUST export a C function with this exact signature. The Phasor host will call this function when the plugin is loaded, providing the plugin with a pointer to the host's API functions and the current VM instance.

Parameters
apiA pointer to a struct containing function pointers that the plugin can use to interact with the host (e.g., register functions).
vmAn opaque pointer to the VM instance. This should be passed back to any API functions that require it.

Definition at line 150 of file posix_bindings.c.

Here is the call graph for this function:

◆ phasor_to_bool()

bool phasor_to_bool ( PhasorValue val)
inlinestatic

Definition at line 134 of file PhasorFFI.h.

◆ phasor_to_float()

double phasor_to_float ( PhasorValue val)
inlinestatic

Definition at line 136 of file PhasorFFI.h.

Here is the call graph for this function:

◆ phasor_to_int()

int64_t phasor_to_int ( PhasorValue val)
inlinestatic

Definition at line 135 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_to_string()

const char * phasor_to_string ( PhasorValue val)
inlinestatic

Definition at line 140 of file PhasorFFI.h.

Here is the caller graph for this function: