Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
echo.c File Reference

Implements the OP_ECHO opcode for printing without a trailing newline. More...

Go to the source code of this file.

Functions

 free_value (v)
 if (vm->output_count< OUTPUT_SIZE)
 fprintf (stderr, "Runtime error: output buffer overflow\n")
 exit (1)

Variables

case OP_ECHO
Value snap = deep_copy_value(&v)
 else
 break

Detailed Description

Implements the OP_ECHO opcode for printing without a trailing newline.

This snippet is included into the VM dispatch loop and handles OP_ECHO. It pops the top value from the stack and appends it to the VM's output buffer but marks the entry as partial so that subsequent OP_PRINT may continue the same line.

Stack contract:

  • Pops: value (any)
  • Pushes: (none)

Definition in file echo.c.

Function Documentation

◆ exit()

exit(1)

◆ fprintf()

fprintf(stderr,
"Runtime error: output buffer overflow\n" )

◆ free_value()

free_value(v)

◆ if()

if()

Definition at line 30 of file echo.c.

Variable Documentation

◆ break

break

Definition at line 40 of file echo.c.

◆ else

else
Initial value:
{
Value snap
Definition echo.c:28
void free_value(Value v)
Free dynamic storage owned by a Value.
Definition value.c:517

Definition at line 35 of file echo.c.

◆ OP_ECHO

case OP_ECHO

Definition at line 26 of file echo.c.

◆ snap

Definition at line 28 of file echo.c.