Commit 0adbe0c2 authored by Niels Möller's avatar Niels Möller
Browse files

* src/command.h (command_simple): New class. Like command, but can

return a value immediately, rather than using a continuation
function.

Rev: src/command.c:1.3
Rev: src/command.h:1.5
parent 9a47356e
......@@ -69,8 +69,14 @@ static int do_command_I(struct command *ignored UNUSED,
return COMMAND_RETURN(c, arg);
}
struct command command_I =
{ STATIC_HEADER, do_command_I };
static struct lsh_object *do_simple_I(struct command_simple *ignored UNUSED,
struct lsh_object *arg)
{
return arg;
}
struct command_simple command_I =
{ { STATIC_HEADER, do_command_I} do_simple_I };
/* ((S f) g)x == (f x)(g x) */
......
......@@ -53,8 +53,19 @@
"struct command_continuation *c")))
*/
/* CLASS:
(class
(name command_simple)
(super command)
(vars
;; Like call, but returns the value immediately rather than
;; using a continuation function
(call_simple method "struct lsh_object *" "struct lsh_object *")))
*/
#define COMMAND_CALL(f, a, c) ((f)->call((f), (a), (c)))
#define COMMAND_RETURN(r, v) ((r)->c((r), (struct lsh_object *) (v)))
#define COMMAND_SIMPLE(f, a) ((f)->call_simple((f), (a)))
/* CLASS:
(class
......
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