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...

Go to the source code of this file.

Functions

 free_value (v)
 vm_raise_error (vm, "RUST_SET_EXIT requires FUN_WITH_RUST=ON at build time")
 push_value (vm, make_nil())

Variables

case OP_RUST_SET_EXIT
 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.

Definition in file set_exit.c.

Function Documentation

◆ free_value()

free_value(v)

◆ push_value()

push_value(vm,
make_nil() )

◆ vm_raise_error()

vm_raise_error(vm)

Variable Documentation

◆ break

break

Definition at line 49 of file set_exit.c.

◆ OP_RUST_SET_EXIT

case OP_RUST_SET_EXIT

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 at line 33 of file set_exit.c.