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

VM opcode snippet for XML node name retrieval. More...

Go to the source code of this file.

Functions

 free_value (drop)
 push_value (vm, make_string(""))

Variables

case OP_XML_NAME
 break

Detailed Description

VM opcode snippet for XML node name retrieval.

This file is included into the main VM dispatch switch in vm.c and implements the OP_XML_NAME instruction.

Opcode: OP_XML_NAME

  • Stack effect: pop (int node_handle) → push (string name)
  • Success: pushes the element/node name as a string. If the node has no name, an empty string is pushed.
  • Errors/edge cases: if the handle is invalid or the node cannot be retrieved, an empty string is pushed. The instruction does not throw.
  • Gating: When FUN_WITH_XML2 is not enabled at build time, the operand is still popped and an empty string is pushed.

Notes

  • Node handles are small positive integers managed by the XML handle registry defined in the xml2 extension (see extensions/xml2.c).
  • The pushed string is a new VM value; ownership is transferred to the VM stack as usual.

Example // ... stack: [ node_handle ] OP_XML_NAME // → [ "book" ]

Definition in file name.c.

Function Documentation

◆ free_value()

free_value(drop)

◆ push_value()

push_value(vm,
make_string("") )

Variable Documentation

◆ break

break

Definition at line 50 of file name.c.

◆ OP_XML_NAME

case OP_XML_NAME

Definition at line 37 of file name.c.