Fun 0.41.5
The programming language that makes you have fun!
Loading...
Searching...
No Matches
set_exit.c File Reference

Implements the OP_RUST_SET_EXIT opcode (conditional build). More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 push_value (vm, make_nil())

Variables

case OP_RUST_SET_EXIT
int rc = fun_op_rset_exit(vm)
 break

Detailed Description

Implements the OP_RUST_SET_EXIT opcode (conditional build).

Pops an integer exit code and delegates to a Rust helper to store it into vm.exit_code. Pushes Nil afterwards. When Rust support is disabled, the argument is still popped/freed, a runtime error is raised, and Nil is pushed to maintain stack discipline.

OP_RUST_SET_EXIT: (code:int) -> Nil

Behavior (FUN_WITH_RUST=ON):

  • Expects an integer on the stack (provided by previous opcodes).
  • Calls fun_op_rset_exit(vm) which pops the int and writes vm->exit_code.
  • Pushes Nil.

Behavior (FUN_WITH_RUST=OFF):

  • Pops and frees one value to preserve stack discipline.
  • Raises a runtime error indicating missing Rust support.
  • Pushes Nil.

Definition in file set_exit.c.

Function Documentation

◆ push_value()

push_value ( vm ,
make_nil()  )

Variable Documentation

◆ break

break

Definition at line 48 of file set_exit.c.

◆ OP_RUST_SET_EXIT

case OP_RUST_SET_EXIT

Definition at line 32 of file set_exit.c.

◆ rc

void rc = fun_op_rset_exit(vm)

Definition at line 37 of file set_exit.c.