aboutsummaryrefslogtreecommitdiffstats
path: root/lib/nt_ffi.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-05-30 02:52:21 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-06-13 00:28:12 +0000
commit52d8859ee6b2176ca13c3ea6c79d1c8b251658d5 (patch)
tree98d741d9695e54cb001af8fbf97f0825855d7a93 /lib/nt_ffi.ml
parent57b55b51ee6a1d4678ba37e4631d61a248411ff2 (diff)
downloadSakura-52d8859ee6b2176ca13c3ea6c79d1c8b251658d5.tar.gz
Sakura-52d8859ee6b2176ca13c3ea6c79d1c8b251658d5.zip
`Project` plan node
Diffstat (limited to 'lib/nt_ffi.ml')
-rw-r--r--lib/nt_ffi.ml20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/nt_ffi.ml b/lib/nt_ffi.ml
index bfbdf65..5937375 100644
--- a/lib/nt_ffi.ml
+++ b/lib/nt_ffi.ml
@@ -151,6 +151,9 @@ let rnt_plan_take source limit =
setf (plan &-> pa_take) pat_limit limit;
rnt_plan_assemble plan
+let rnt_plan_project =
+ fn "rnt_plan_project" (ptr void @-> ptr (ptr char) @-> returning (ptr void))
+
let rnt_plan_free =
fn "rnt_plan_free" (ptr void @-> returning void)
@@ -192,6 +195,23 @@ let with_out_string (f : char ptr ptr -> int) : int * string option =
if is_null p then (rc, None)
else (rc, Some (consume_cstring p))
+let with_strings_as_char_array
+ (strings : string list)
+ (body : char ptr ptr -> 'a)
+ : 'a =
+ let arr =
+ CArray.make
+ ~initial:(from_voidp char null)
+ (ptr char)
+ (1 + List.length strings)
+ in
+ List.iteri
+ (fun i s -> CArray.set arr i (Ctypes_std_views.char_ptr_of_string s))
+ strings;
+ body (CArray.start arr)
+ (* let pp = allocate (ptr (ptr char)) (from_voidp (ptr char) null) in *)
+
+
(* Converts a void* (returned from open_handle / cursor_open) to nativeint.
Returns None when the pointer is NULL (failure). *)
let ptr_to_opt (p : unit ptr) : nativeint option =