1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Clean up function creation API and epilogue generation.

This commit is contained in:
Stephen Dolan
2012-11-26 00:39:01 +00:00
parent 924aeda504
commit 3e3fe51959
5 changed files with 38 additions and 47 deletions

View File

@@ -252,32 +252,24 @@ static void f_type(jv input[], jv output[]) {
}
static block j_empty() {
return gen_op_block_defn(CLOSURE_CREATE, "empty", gen_op_simple(BACKTRACK));
return gen_function("empty", gen_op_simple(BACKTRACK));
}
static block j_false() {
return gen_op_block_defn(CLOSURE_CREATE, "false",
block_join(gen_op_const(LOADK, jv_false()),
gen_op_simple(RET)));
return gen_function("false", gen_op_const(LOADK, jv_false()));
}
static block j_true() {
return gen_op_block_defn(CLOSURE_CREATE, "true",
block_join(gen_op_const(LOADK, jv_true()),
gen_op_simple(RET)));
return gen_function("true", gen_op_const(LOADK, jv_true()));
}
static block j_null() {
return gen_op_block_defn(CLOSURE_CREATE, "null",
block_join(gen_op_const(LOADK, jv_null()),
gen_op_simple(RET)));
return gen_function("null", gen_op_const(LOADK, jv_null()));
}
static block j_not() {
return gen_op_block_defn(CLOSURE_CREATE, "not",
block_join(gen_condbranch(gen_op_const(LOADK, jv_false()),
gen_op_const(LOADK, jv_true())),
gen_op_simple(RET)));
return gen_function("not", gen_condbranch(gen_op_const(LOADK, jv_false()),
gen_op_const(LOADK, jv_true())));
}
static struct cfunction function_list[] = {