Phasor 3.3.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
 Represents a value in the Phasor VM. More...
struct  PhasorAPI
 The collection of API functions that the Phasor host provides to the plugin. More...

Macros

#define PHASOR_FFI_EXPORT

Typedefs

typedef struct PhasorVM PhasorVM
 Phasor Virtual Machine pointer.
typedef struct PhasorValue PhasorValue
 Forward declare for self-reference in the union.
typedef PhasorValue(* PhasorNativeFunction) (PhasorVM *vm, int argc, const PhasorValue *argv)
 Signature for a native C function that can be registered with the Phasor VM.
typedef void(* PhasorRegisterFunction) (PhasorVM *vm, const char *name, PhasorNativeFunction func)
 Function pointer type for the function that registers a native function with the VM.

Enumerations

enum  PhasorValueType {
  PHASOR_TYPE_NULL , PHASOR_TYPE_BOOL , PHASOR_TYPE_INT , PHASOR_TYPE_FLOAT ,
  PHASOR_TYPE_STRING , PHASOR_TYPE_ARRAY
}
 PhasorValue types. More...

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 50 of file PhasorFFI.h.

Typedef Documentation

◆ PhasorNativeFunction

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

Signature for a native C function that can be registered with the Phasor VM.

Definition at line 204 of file PhasorFFI.h.

◆ PhasorRegisterFunction

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

Function pointer type for the function that registers a native function with the VM.

Definition at line 207 of file PhasorFFI.h.

◆ PhasorValue

typedef struct PhasorValue PhasorValue

Forward declare for self-reference in the union.

Definition at line 75 of file PhasorFFI.h.

◆ PhasorVM

typedef struct PhasorVM PhasorVM

Phasor Virtual Machine pointer.

Definition at line 59 of file PhasorFFI.h.

Enumeration Type Documentation

◆ PhasorValueType

PhasorValue types.

Enumerator
PHASOR_TYPE_NULL 
PHASOR_TYPE_BOOL 
PHASOR_TYPE_INT 
PHASOR_TYPE_FLOAT 
PHASOR_TYPE_STRING 
PHASOR_TYPE_ARRAY 

Definition at line 62 of file PhasorFFI.h.

Function Documentation

◆ phasor_is_array()

bool phasor_is_array ( PhasorValue val)
inlinestatic

Definition at line 169 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 153 of file PhasorFFI.h.

◆ phasor_is_float()

bool phasor_is_float ( PhasorValue val)
inlinestatic

Definition at line 161 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 157 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 149 of file PhasorFFI.h.

◆ phasor_is_number()

bool phasor_is_number ( PhasorValue val)
inlinestatic

Definition at line 173 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 165 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 139 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 107 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 123 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 115 of file PhasorFFI.h.

Here is the caller graph for this function:

◆ phasor_make_null()

PhasorValue phasor_make_null ( )
inlinestatic

Definition at line 100 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 131 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 40 of file main.c.

Here is the call graph for this function:

◆ phasor_to_bool()

bool phasor_to_bool ( PhasorValue val)
inlinestatic

Definition at line 180 of file PhasorFFI.h.

◆ phasor_to_float()

double phasor_to_float ( PhasorValue val)
inlinestatic

Definition at line 188 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 184 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 194 of file PhasorFFI.h.

Here is the caller graph for this function: