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

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

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

Go to the source code of this file.

Functions

 if (!s) s
 push_value (vm, make_string(s))

Variables

case OP_RUST_HELLO
 break

Detailed Description

Implements the OP_RUST_HELLO opcode (conditional build).

This opcode demonstrates calling into a Rust function from the VM. When FUN_WITH_RUST is enabled at build time, it retrieves a greeting string from Rust and pushes it as a VAL_STRING onto the VM stack. When Rust support is disabled, a runtime error is raised and Nil is pushed to keep stack consistency.

OP_RUST_HELLO: () -> string | Nil

Behavior (FUN_WITH_RUST=ON):

  • Does not pop any values.
  • Calls fun_rust_get_string() and pushes the returned C string as a VAL_STRING. If Rust returns NULL, an empty string is used instead.

Behavior (FUN_WITH_RUST=OFF):

  • Raises a runtime error indicating missing Rust support.
  • Pushes Nil to maintain stack discipline.

Definition in file hello.c.

Function Documentation

◆ if()

if ( ! s)

Definition at line 40 of file make_array.c.

◆ push_value()

push_value ( vm ,
make_string(s)  )

Variable Documentation

◆ break

break

Definition at line 41 of file hello.c.

◆ OP_RUST_HELLO

case OP_RUST_HELLO

Definition at line 32 of file hello.c.