X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=tests%2Fsqlite%2Fsqlite.psi;h=4bc8059823560ab73e236d0370fe67cd6aa7a5e7;hp=23669d6eb4501530ff4adfdbfd548ac8a7ad2842;hb=4fd6435041048363289eb7b9243cee39b6901e4e;hpb=eb8dda8a98e6a1623406175374d7c199bf27860c diff --git a/tests/sqlite/sqlite.psi b/tests/sqlite/sqlite.psi index 23669d6..4bc8059 100644 --- a/tests/sqlite/sqlite.psi +++ b/tests/sqlite/sqlite.psi @@ -12,7 +12,7 @@ function sqlite3\errstr(int $errno) : string { } /* obviously fake, we ever always need a pointer to it */ -struct sqlite3::(8, 8); +struct sqlite3; typedef struct sqlite3 sqlite3; @@ -42,23 +42,16 @@ function sqlite3\open(string $uri, object &$db) : int { 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); +extern int sqlite3_exec(sqlite3 *db, const char *sql, sqlite3_callback cb, void *data, char **errmsg); function sqlite3\exec(object $db, string $sql, callable $cb, mixed $cd, string &$error = null) : int { let db = objval($db); let sql = strval($sql); - let callback = callback intval( + let cb = callback intval( $cb( zval(data), to_int(argc), - to_array(argv, argc, to_string(argv)), - to_array(cols, argc, to_string(cols)) + to_array(*argv, argc, to_string(*argv)), + to_array(*cols, argc, to_string(*cols)) ) ); let data = zval($cd);