Commit 17b29b22 authored by Niels Möller's avatar Niels Möller
Browse files

* src/command.h (command_2): Made invoke a method, not a function

pointer. Updated users.
(COMMAND_2_INVOKE): New macro.

Rev: src/combinators.c:1.17
Rev: src/command.c:1.43
Rev: src/command.h:1.57
Rev: src/tcpforward_commands.c:1.31
parent 4a9ed676
......@@ -46,7 +46,8 @@ DEFINE_COMMAND(command_I)
/* ((K x) y) == x */
DEFINE_COMMAND2(command_K)
(struct lsh_object *x,
(struct command_2 *s UNUSED,
struct lsh_object *x,
struct lsh_object *y UNUSED,
struct command_continuation *c,
struct exception_handler *e UNUSED)
......
......@@ -135,7 +135,7 @@ do_command_2_invoke(struct command *s, struct lsh_object *a2,
struct exception_handler *e)
{
CAST(command_2_invoke, self, s);
self->f->invoke(self->a1, a2, c, e);
COMMAND_2_INVOKE(self->f, self->a1, a2, c, e);
}
struct command *
......
......@@ -75,6 +75,7 @@
#define COMMAND_SIMPLE_CALL(f, a) \
((f)->call_simple((f), (struct lsh_object *)(a)))
/* FIXME: Delete, use DEFINE_COMMAND instead */
#define STATIC_COMMAND(f) { STATIC_HEADER, f }
#define STATIC_COMMAND_SIMPLE(f) \
......@@ -112,14 +113,16 @@ do_##cname
(name command_2)
(super command)
(vars
(invoke pointer
(function void
"struct lsh_object *a1"
"struct lsh_object *a2"
"struct command_continuation *c"
"struct exception_handler *e"))))
(invoke method void
"struct lsh_object *a1"
"struct lsh_object *a2"
"struct command_continuation *c"
"struct exception_handler *e"))))
*/
#define COMMAND_2_INVOKE(s, a1, a2, c, e) \
((s)->invoke((s), (a1), (a2), (c), (e)))
void
do_command_2(struct command *s,
struct lsh_object *a1,
......@@ -132,7 +135,8 @@ make_command_2_invoke(struct command_2 *f,
#define DEFINE_COMMAND2(cname) \
static void \
do_##cname(struct lsh_object *, \
do_##cname(struct command_2 *, \
struct lsh_object *, \
struct lsh_object *, \
struct command_continuation *, \
struct exception_handler *); \
......
......@@ -43,13 +43,13 @@ extern struct command_2 open_forwarded_tcpip;
extern struct command tcpip_start_io;
extern struct command tcpip_connect_io;
struct collect_info_1 install_direct_tcpip_handler;
struct collect_info_1 install_forwared_tcpip_handler;
struct install_info install_direct_tcpip_handler;
struct install_info install_forwarded_tcpip_handler;
/* FIXME: Should be static? */
struct command make_direct_tcpip_handler;
struct collect_info_1 install_tcpip_forward_handler;
struct install_info install_tcpip_forward_handler;
/* FIXME: Should be static? */
struct command make_tcpip_forward_handler;
......@@ -192,7 +192,8 @@ make_open_tcpip_command(int type, UINT32 initial_window,
}
DEFINE_COMMAND2(open_forwarded_tcpip)
(struct lsh_object *a1,
(struct command_2 *s UNUSED,
struct lsh_object *a1,
struct lsh_object *a2,
struct command_continuation *c,
struct exception_handler *e UNUSED)
......@@ -207,7 +208,8 @@ DEFINE_COMMAND2(open_forwarded_tcpip)
}
DEFINE_COMMAND2(open_direct_tcpip)
(struct lsh_object *a1,
(struct command_2 *s UNUSED,
struct lsh_object *a1,
struct lsh_object *a2,
struct command_continuation *c,
struct exception_handler *e UNUSED)
......@@ -320,7 +322,8 @@ do_format_request_tcpip_forward(struct global_request_command *s,
DEFINE_COMMAND2(remote_listen_command)
(struct lsh_object *a1,
(struct command_2 *s UNUSED,
struct lsh_object *a1,
struct lsh_object *a2,
struct command_continuation *c,
struct exception_handler *e UNUSED)
......@@ -446,25 +449,14 @@ DEFINE_COMMAND(make_tcpip_forward_handler)
&make_tcpip_forward_request(callback)->super);
}
#if 0
static struct command
make_tcpip_forward_handler
= STATIC_COMMAND(do_make_tcpip_forward_handler);
#endif
/* Commands to install handlers */
struct install_info install_direct_tcpip_info_2 =
struct install_info install_direct_tcpip_handler =
STATIC_INSTALL_OPEN_HANDLER(ATOM_DIRECT_TCPIP);
struct collect_info_1 install_direct_tcpip_handler =
STATIC_COLLECT_1(&install_direct_tcpip_info_2.super);
struct install_info install_forwarded_tcpip_info_2 =
struct install_info install_forwarded_tcpip_handler =
STATIC_INSTALL_OPEN_HANDLER(ATOM_FORWARDED_TCPIP);
struct collect_info_1 install_forwarded_tcpip_handler =
STATIC_COLLECT_1(&install_forwarded_tcpip_info_2.super);
/* Server side callbacks */
......@@ -492,12 +484,9 @@ make_direct_tcpip_hook(struct io_backend *backend)
return res;
}
struct install_info install_tcpip_forward_info_2 =
struct install_info install_tcpip_forward_handler =
STATIC_INSTALL_GLOBAL_HANDLER(ATOM_TCPIP_FORWARD);
struct collect_info_1 install_tcpip_forward_handler =
STATIC_COLLECT_1(&install_tcpip_forward_info_2.super);
/* GABA:
(expr
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment