inkcpp
|
A handle for an ink runner. More...
#include <inkcpp.h>
Public Types | |
typedef InkValue(* | InkExternalFunction) (int argc, const InkValue argv[]) |
Callback for a Ink external function which returns void. | |
typedef void(* | InkExternalFunctionVoid) (int argc, const InkValue argv[]) |
Callback for a Ink external function wihich returns a value. | |
Public Member Functions | |
void | ink_runner_delete (HInkRunner *self) |
Deconstructs the Runner and all frees assoziated resources. | |
HInkSnapshot * | ink_runner_create_snapshot (const HInkRunner *self) |
Creates a snapshot, for later reloading. | |
int | ink_runner_can_continue (const HInkRunner *self) |
Can the runner continue? | |
const char * | ink_runner_get_line (HInkRunner *self) |
Continue execution until the next newline, then allocate a c-style string with the output. | |
int | ink_runner_num_tags (const HInkRunner *self) |
Returns the number of tags on the current line. | |
const char * | ink_runner_tag (const HInkRunner *self, int index) |
Access a tag by index. | |
int | ink_runner_num_knot_tags (const HInkRunner *self) |
Get Number of knot/stitch tags. | |
ink_hash_t | ink_runner_current_knot (const HInkRunner *self) |
Get hash of current knot/stitch name. | |
bool | ink_runner_move_to (HInkRunner *self, ink_hash_t path) |
Moves the runner to the specified path. | |
const char * | ink_runner_knot_tag (const HInkRunner *self, int index) |
int | ink_runner_num_global_tags (const HInkRunner *self) |
Get Number of global tags. | |
const char * | ink_runner_global_tag (const HInkRunner *self, int index) |
int | ink_runner_num_choices (const HInkRunner *self) |
Returns the number of choices currently available. | |
const HInkChoice * | ink_runner_get_choice (const HInkRunner *self, int index) |
Gets a choice. | |
void | ink_runner_choose (HInkRunner *self, int index) |
Make a choice. | |
void | ink_runner_bind_void (HInkRunner *self, const char *function_name, InkExternalFunctionVoid callback, int lookaheadSafe) |
Binds a external function which is called form the runtime, with no return value. | |
void | ink_runner_bind (HInkRunner *self, const char *function_name, InkExternalFunction callback, int lookaheadSafe) |
Binds a external function which is called from the runtime, with a return vallue. | |
A handle for an ink runner.
An independent runner which can execute ink script from a story independent of other runners. Think of the ink story object like an executable file and the runners as 'threads' (not to be confused with ink threads, which are a language feature). Runners track their own instruction pointer, choice list, temporary variables, callstack, etc. They can either be started with their own globals store, or can share one with other runner instances.
Callback for a Ink external function which returns void.
argc | number of arguments |
argv | array containing the arguments |
typedef void(* InkExternalFunctionVoid) (int argc, const InkValue argv[]) |
Callback for a Ink external function wihich returns a value.
argc | number of arguments |
argv | array contaning the arguments |
void ink_runner_bind | ( | HInkRunner * | self, |
const char * | function_name, | ||
InkExternalFunction | callback, | ||
int | lookaheadSafe ) |
Binds a external function which is called from the runtime, with a return vallue.
self | |
function_name | name of external function declared inside ink script |
callback | |
lookaheadSafe | if false stop glue lookahead if encounter this function this prevents double execution of external functions but can lead to missing glues |
void ink_runner_bind_void | ( | HInkRunner * | self, |
const char * | function_name, | ||
InkExternalFunctionVoid | callback, | ||
int | lookaheadSafe ) |
Binds a external function which is called form the runtime, with no return value.
self | |
function_name | declared in ink script |
callback | |
lookaheadSafe | if false stop glue lookahead if encounter this function this prevents double execution of external functions but can lead to missing glues |
int ink_runner_can_continue | ( | const HInkRunner * | self | ) |
Can the runner continue?
Checks if the runner can continue execution. If it can't, we are either at a choice or are out of content.
void ink_runner_choose | ( | HInkRunner * | self, |
int | index ) |
Make a choice.
Takes the choice at the given index and moves the instruction pointer to that branch.
index | index of the choice to make |
self |
HInkSnapshot * ink_runner_create_snapshot | ( | const HInkRunner * | self | ) |
Creates a snapshot, for later reloading.
ink_hash_t ink_runner_current_knot | ( | const HInkRunner * | self | ) |
Get hash of current knot/stitch name.
self |
const HInkChoice * ink_runner_get_choice | ( | const HInkRunner * | self, |
int | index ) |
Gets a choice.
Returns the choice object at a given index
index | index of the choice to access |
self |
const char * ink_runner_get_line | ( | HInkRunner * | self | ) |
const char * ink_runner_global_tag | ( | const HInkRunner * | self, |
int | index ) |
self |
const char * ink_runner_knot_tag | ( | const HInkRunner * | self, |
int | index ) |
self |
bool ink_runner_move_to | ( | HInkRunner * | self, |
ink_hash_t | path ) |
Moves the runner to the specified path.
Clears any execution context and moves the runner to the content at the specified path.
path | path to search and move execution to |
self |
int ink_runner_num_choices | ( | const HInkRunner * | self | ) |
Returns the number of choices currently available.
self |
int ink_runner_num_global_tags | ( | const HInkRunner * | self | ) |
Get Number of global tags.
@info global tags are also assoziated to the first line in the knot/stitch
self |
int ink_runner_num_knot_tags | ( | const HInkRunner * | self | ) |
Get Number of knot/stitch tags.
@info knot/stitch tags are also assoziated to the first line in the knot/stitch
self |
int ink_runner_num_tags | ( | const HInkRunner * | self | ) |
Returns the number of tags on the current line.
Excludes global tags.
const char * ink_runner_tag | ( | const HInkRunner * | self, |
int | index ) |
Access a tag by index.
Note that this method only allows the retrieval of tags attached to the current line. For tags at the top of the script, use get_global_tag()
index | tag id to fetch [0;num_tags()) |
self |