Virtual Machine Functions
Embryo

Functions that deal with creating and destroying virtual machine sessions for a given program. More...

## Functions

EAPI void | embryo_program_vm_reset (Embryo_Program *ep)
| Resets the current virtual machine session of the given program.
EAPI void | embryo_program_vm_push (Embryo_Program *ep)
| Starts a new virtual machine session for the given program.
EAPI void | embryo_program_vm_pop (Embryo_Program *ep)
| Frees the current virtual machine session associated with the given program.

## Detailed Description

Functions that deal with creating and destroying virtual machine sessions for a given program.

A given embryo program can have multiple virtual machine sessions running. This is useful when you have a native call that in turn calls a function in the embryo program. The native call can start a new virtual machine session to run the function it needs. Once completed, the session can be popped off the program's stack, and the native call can return its value to the old session.

A new virtual machine session is created by pushing a new virtual machine onto the session stack of a program using embryo_program_vm_push. The current virtual machine session can be destroyed by calling embryo_program_vm_pop.

## Function Documentation

## embryo_program_vm_reset()

EAPI void embryo_program_vm_reset | ( | Embryo_Program * | ep | ) |

Resets the current virtual machine session of the given program.

Parameters

  ep | The given program.

Referenced by embryo_program_vm_push().

## embryo_program_vm_push()

EAPI void embryo_program_vm_push | ( | Embryo_Program * | ep | ) |

Starts a new virtual machine session for the given program.

See Virtual Machine Functions for more information about how this works.

Parameters

  ep | The given program.

References embryo_program_vm_reset().

## embryo_program_vm_pop()

EAPI void embryo_program_vm_pop | ( | Embryo_Program * | ep | ) |

Frees the current virtual machine session associated with the given program.

See Virtual Machine Functions for more information about how this works. Note that you will need to retrieve any return data or data on the stack before you pop.

Parameters

  ep | The given program.