static inline void dump_decl_arg(int fd, decl_arg *a) {
dump_decl_type(fd, a->type);
- dprintf(fd, " ");
- dump_decl_var(fd, a->var);
+ if (a->type->type != PSI_T_FUNCTION) {
+ dprintf(fd, " ");
+ dump_decl_var(fd, a->var);
+ }
}
static inline void dump_level(int fd, unsigned level) {
for (j = 0; j < func->args->count; ++j) {
impl_arg *iarg = func->args->args[j];
- dprintf(fd, "%s%s %s$%s",
+ dprintf(fd, "%s%s %s%s",
j ? ", " : "",
iarg->type->name,
iarg->var->reference ? "&" : "",
if (func->args->vararg.name) {
impl_arg *vararg = func->args->vararg.name;
- dprintf(fd, ", %s %s...$%s",
+ dprintf(fd, ", %s %s...%s",
vararg->type->name,
vararg->var->reference ? "&" : "",
vararg->var->name);
dump_num_exp(fd, let->val->data.alloc->size);
dprintf(fd, ")");
break;
+ case PSI_LET_CALLBACK:
+ dprintf(fd, "callback %s(%s(", let->val->data.callback->func->name,
+ let->val->data.callback->func->var->name);
+ if (let->val->data.callback->args) {
+ size_t i, c = let->val->data.callback->args->count;
+
+ dprintf(fd, "\n");
+ for (i = 0; i < c; ++i) {
+ set_value *set = let->val->data.callback->args->vals[i];
+ dump_impl_set_value(fd, set, 2, i + 1 == c);
+ }
+ dprintf(fd, "\t");
+ }
+ dprintf(fd, "));");
+ break;
case PSI_LET_FUNC:
- dprintf(fd, "%s($%s)", let->val->data.func->name,
+ dprintf(fd, "%s(%s)", let->val->data.func->name,
let->val->data.func->var->name);
break;
case PSI_LET_NUMEXP:
}
static inline void dump_impl_set_stmt(int fd, set_stmt *set) {
- dprintf(fd, "\tset $%s = ", set->var->name);
+ dprintf(fd, "\tset %s = ", set->var->name);
dump_impl_set_value(fd, set->val, 1, 0);
}
typedef int (*sqlite3_callback)(void *data, int argc, char** argv, char** cols);
-/*
- * C calls into us, so we have to have a way to define how the callback
- * arguments have to be marshaled for the userland callback, i.e. from
- * native C types to ZE zvals /and/ how the userland return value has
- * to be marshaled to a native type. All in all, the opposite of function impls.
- */
-
extern int sqlite3_exec(sqlite3 *db, const char *sql, sqlite3_callback callback, void *data, char **errmsg);
function sqlite3\exec(object $db, string $sql, callable $cb, mixed $cd, string &$error = null) : int {
let db = objval($db);