~lattis/muon

ref: f9a8cbad39b665a9496cd3adb4756e85ee5ec97c muon/src/functions/machine.c -rw-r--r-- 805 bytes
f9a8cbadStone Tickle print stdout/stderr of failing test 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "posix.h"

#include "functions/common.h"
#include "functions/machine.h"
#include "lang/interpreter.h"
#include "log.h"

static bool
func_machine_system(struct workspace *wk, uint32_t rcvr, uint32_t args_node, uint32_t *obj)
{
	if (!interp_args(wk, args_node, NULL, NULL, NULL)) {
		return false;
	}

	make_obj(wk, obj, obj_string)->dat.str = wk_str_push(wk, "linux");

	return true;
}

static bool
func_machine_endian(struct workspace *wk, uint32_t rcvr, uint32_t args_node, uint32_t *obj)
{
	if (!interp_args(wk, args_node, NULL, NULL, NULL)) {
		return false;
	}

	make_obj(wk, obj, obj_string)->dat.str = wk_str_push(wk, "little");

	return true;
}

const struct func_impl_name impl_tbl_machine[] = {
	{ "system", func_machine_system },
	{ "endian", func_machine_endian },
	{ NULL, NULL },
};