diff options
author | Nicolas Williams <nico@cryptonector.com> | 2014-07-07 22:49:46 -0500 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2014-07-07 23:37:42 -0500 |
commit | d8672e1b2a004c70e1a7a60e58f68ac5d29fe7dc (patch) | |
tree | 27dd1893f6793e6901028af917339d9e3cfe7a68 /execute.c | |
parent | a68958e5dcfee19478c1812ea73b01625c734029 (diff) |
Make C-coded built-ins take `jq_state *` argument
Diffstat (limited to 'execute.c')
-rw-r--r-- | execute.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -650,17 +650,17 @@ jv jq_next(jq_state *jq) { in[i] = stack_pop(jq); } struct cfunction* function = &frame_current(jq)->bc->globals->cfunctions[*pc++]; - typedef jv (*func_1)(jv); - typedef jv (*func_2)(jv,jv); - typedef jv (*func_3)(jv,jv,jv); - typedef jv (*func_4)(jv,jv,jv,jv); - typedef jv (*func_5)(jv,jv,jv,jv,jv); + typedef jv (*func_1)(jq_state*,jv); + typedef jv (*func_2)(jq_state*,jv,jv); + typedef jv (*func_3)(jq_state*,jv,jv,jv); + typedef jv (*func_4)(jq_state*,jv,jv,jv,jv); + typedef jv (*func_5)(jq_state*,jv,jv,jv,jv,jv); switch (function->nargs) { - case 1: top = ((func_1)function->fptr)(in[0]); break; - case 2: top = ((func_2)function->fptr)(in[0], in[1]); break; - case 3: top = ((func_3)function->fptr)(in[0], in[1], in[2]); break; - case 4: top = ((func_4)function->fptr)(in[0], in[1], in[2], in[3]); break; - case 5: top = ((func_5)function->fptr)(in[0], in[1], in[2], in[3], in[4]); break; + case 1: top = ((func_1)function->fptr)(jq, in[0]); break; + case 2: top = ((func_2)function->fptr)(jq, in[0], in[1]); break; + case 3: top = ((func_3)function->fptr)(jq, in[0], in[1], in[2]); break; + case 4: top = ((func_4)function->fptr)(jq, in[0], in[1], in[2], in[3]); break; + case 5: top = ((func_5)function->fptr)(jq, in[0], in[1], in[2], in[3], in[4]); break; // FIXME: a) up to 7 arguments (input + 6), b) should assert // because the compiler should not generate this error. default: return jv_invalid_with_msg(jv_string("Function takes too many arguments")); |