parser: consolidate tokens
[m6w6/ext-psi] / tests / ndbm / ndbm.psi
1 function psi\dbm_open(string $file, int $open_flags, int $file_mode) : object {
2 let file = pathval($file);
3 let open_flags = intval($open_flags);
4 let file_mode = intval($file_mode);
5 return to_object(dbm_open);
6 }
7
8 function psi\dbm_store(object $db, string $key, string $data, int $mode) : int {
9 let db = objval($db);
10 let key = arrval($key,
11 dptr = strval($0),
12 dsize = strlen($0)
13 );
14 let content = arrval($data,
15 dptr = strval($0),
16 dsize = strlen($0)
17 );
18 let store_mode = intval($mode);
19 return to_int(dbm_store);
20 }
21
22 function psi\dbm_fetch(object $db, array $key) : array {
23 let db = objval($db);
24 let key = arrval($key,
25 dptr = strval($dptr),
26 dsize = intval($dsize)
27 );
28 return to_array(dbm_fetch,
29 to_int(dsize),
30 to_string(dptr, dsize)
31 );
32 }
33
34 function psi\dbm_close(object $db) : void {
35 let db = objval($db);
36 return void(dbm_close);
37 }