~lattis/muon

ref: f9a8cbad39b665a9496cd3adb4756e85ee5ec97c muon/include/functions/common.h -rw-r--r-- 926 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
#ifndef MUON_FUNCTIONS_COMMON_H
#define MUON_FUNCTIONS_COMMON_H

#include "lang/parser.h"
#include "lang/workspace.h"

typedef bool (*func_impl)(struct workspace *wk, uint32_t recvr, uint32_t args_node, uint32_t *obj);

struct func_impl_name {
	const char *name;
	func_impl func;
};

struct args_norm { enum obj_type type; uint32_t val, node; bool set; };
struct args_kw { const char *key; enum obj_type type; uint32_t val, node; bool set; bool required; };

bool todo(struct workspace *wk, uint32_t rcvr_id, uint32_t args_node, uint32_t *obj);
bool func_lookup(const struct func_impl_name *impl_tbl, const char *name, func_impl *res);

bool interp_args(struct workspace *wk, uint32_t args_node,
	struct args_norm positional_args[],
	struct args_norm optional_positional_args[],
	struct args_kw keyword_args[]);
bool builtin_run(struct workspace *wk, bool have_rcvr, uint32_t rcvr_id, uint32_t node_id, uint32_t *obj);
#endif