Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
set_exit.c
Go to the documentation of this file.
1/*
2 * This file is part of the Fun programming language.
3 * https://fun-lang.xyz/
4 *
5 * Copyright 2026 Johannes Findeisen <you@hanez.org>
6 * Licensed under the terms of the Apache-2.0 license.
7 * https://opensource.org/license/apache-2-0
8 */
9
19
34#ifdef FUN_WITH_RUST
35 extern int fun_op_rset_exit(VM * vm);
36 /* Expect an integer on the stack already (produced by prior ops) */
37 /* fun_op_rset_exit will pop it and store into vm.exit_code */
38 int rc = fun_op_rset_exit(vm);
39 (void)rc;
40 /* push Nil as a conventional result */
41 push_value(vm, make_nil());
42#else
43 /* pop and ignore to keep stack sane */
44 Value v = pop_value(vm);
46 vm_raise_error(vm, "RUST_SET_EXIT requires FUN_WITH_RUST=ON at build time");
48#endif
49 break;
50}
@ OP_RUST_SET_EXIT
Definition bytecode.h:282
Value v
Definition cast.c:22
int rc
push_value(vm, make_nil())
vm_raise_error(vm, "RUST_SET_EXIT requires FUN_WITH_RUST=ON at build time")
free_value(v)
The Fun virtual machine state.
Definition vm.h:110
Tagged union representing a Fun value.
Definition value.h:68
Value make_nil(void)
Construct a nil Value.
Definition value.c:126
int fun_op_rset_exit(VM *vm)