Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
name.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 2025 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
36/* OP_XML_NAME: pops node handle; pushes string */
38#ifdef FUN_WITH_XML2
39 Value vh = pop_value(vm);
40 int h = (vh.type == VAL_INT) ? (int)vh.i : 0;
41 xmlNodePtr n = xml_node_get(h);
43 const char *name = (n && n->name) ? (const char *)n->name : "";
45#else
46 Value drop = pop_value(vm);
47 free_value(drop);
49#endif
50 break;
51}
@ OP_XML_NAME
Definition bytecode.h:216
const char * name
Definition env.c:29
int n
Definition insert.c:41
push_value(vm, make_string(""))
free_value(drop)
Tagged union representing a Fun value.
Definition value.h:68
Value vh
Definition stubs.c:44
Value make_string(const char *s)
Construct a string Value by duplicating the given C string.
Definition value.c:95
@ VAL_INT
Definition value.h:51