-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathremote.tbl
84 lines (71 loc) · 2.56 KB
/
remote.tbl
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// ****************************************************************************
// remote.tbl ELFE project
// ****************************************************************************
//
// File Description:
//
// Send commands to a remote host
//
//
//
//
//
//
//
//
// ****************************************************************************
// (C) 2015 Christophe de Dinechin <[email protected]>
// (C) 2015 Taodyne SAS
// ****************************************************************************
// WARNING: In all the following, we do a two-step evaluation, e.g. we use
// int result = foo(...);
// R_INT(result);
// instead of the simpler
// R_INT(foo(...))
//
// This is intentional and necessary. The reason is that a macro like R_INT
// does a 'new Integer(arg)', which some compilers will optimize by splitting
// it into an 'operator new' followed by the evaluation of 'arg'. In our case,
// the called function foo(...) often does various evaluations, e.g as a
// result of calling elfe_parse_tree. These evaluations may cause multiple
// garbage collections, which may end up cleaning up the block allocated
// by 'operator new' before we even began using it!
//
// This is an issue with the garbage collector that will need fixing, but
// until it is addressed, the two step evaluation is a requirement.
FUNCTION(tell, integer,
PARM(host, text)
PARM(code, tree),
int rc = elfe_tell(ELFE_CONTEXT, host, &code);
R_INT(rc));
FUNCTION(ask, tree,
PARM(host, text)
PARM(code, tree),
Tree_p rc = elfe_ask(ELFE_CONTEXT, host, &code);
RESULT(rc));
FUNCTION(invoke, tree,
PARM(host, text)
PARM(code, tree),
Tree_p rc = elfe_invoke(ELFE_CONTEXT, host, &code);
RESULT(rc));
FUNCTION(reply, integer,
PARM(code, tree),
int reply = elfe_reply(ELFE_CONTEXT, &code);
R_INT(reply));
FUNCTION(listen_on, integer,
PARM(port, integer),
int rc = elfe_listen(ELFE_CONTEXT, 0, port);
R_INT(rc));
FUNCTION(listen, integer, ,
int rc = elfe_listen(ELFE_CONTEXT, 0);
R_INT(rc));
FUNCTION(listen_forking, integer, ,
int rc = elfe_listen(ELFE_CONTEXT, MAIN->options.listen_forks);
R_INT(rc));
FUNCTION(listen_hook, tree,
PARM(hook, tree),
RESULT(elfe_listen_hook(&hook)));
NAME_FN(ListenReceived, tree, "listen_received",
RESULT(elfe_listen_received()));
NAME_FN(GetPid, integer, "process_id",
R_INT(getpid()));