Fun
0.41.5
The programming language that makes You have fun
Main Page
Data Structures
Files
File List
Globals
Loading...
Searching...
No Matches
src
vm
xml
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 */
37
case
OP_XML_NAME
: {
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);
42
free_value
(
vh
);
43
const
char
*
name
= (
n
&&
n
->name) ? (
const
char
*)
n
->name :
""
;
44
push_value
(vm,
make_string
(
name
));
45
#else
46
Value
drop = pop_value(vm);
47
free_value
(drop);
48
push_value
(vm,
make_string
(
""
));
49
#endif
50
break
;
51
}
OP_XML_NAME
@ OP_XML_NAME
Definition
bytecode.h:216
name
const char * name
Definition
env.c:29
n
int n
Definition
insert.c:41
push_value
push_value(vm, make_string(""))
free_value
free_value(drop)
Value
Tagged union representing a Fun value.
Definition
value.h:68
vh
Value vh
Definition
stubs.c:44
make_string
Value make_string(const char *s)
Construct a string Value by duplicating the given C string.
Definition
value.c:95
VAL_INT
@ VAL_INT
Definition
value.h:51
Generated on
for Fun by
1.16.1