search for: print_ocaml_bind

Displaying 20 results from an estimated 66 matches for "print_ocaml_bind".

2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...| Closure _ | Flags _ | Mutable _ | Path _ | SockAddrAndLen _ | StringList _ - | UInt _ | UInt32 _ -> assert false + | UInt32 _ -> assert false ) cbargs; pr " }\n"; pr "\n"; @@ -4600,8 +4602,8 @@ let print_ocaml_binding (name, { args; ret }) = List.map ( function | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | Int n | Int64 n - | Mutable (Int n) | String n | UInt64 n -> + | Int n | Int64 n + | Mutable (Int n) | String n | UInt n |...
2019 Jun 29
0
[libnbd PATCH 3/6] generator: Allow Int64 in callbacks
...BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _ - | Flags _ | Int64 _ | Mutable _ + | Flags _ | Mutable _ | Path _ | SockAddrAndLen _ | StringList _ | UInt _ | UInt32 _ -> assert false ) args; @@ -4345,13 +4347,14 @@ let print_ocaml_binding (name, { args; ret }) = List.map ( function | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | Int n | Mutable (Int n) | Opaque n | String n | UInt64 n -> + | Int n | Int64 n + | Mutable (Int n) | Opaque n | String n | UInt64 n -&g...
2019 Jun 21
0
[libnbd PATCH v2 1/5] generator: Allow Int in callbacks
...ackPersist _ - | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ + | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ | UInt _ | UInt32 _ -> assert false ) args; pr " return ret;\n"; @@ -3985,13 +3989,13 @@ let print_ocaml_binding (name, { args; ret }) = List.map ( function | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | String n | UInt64 n | Opaque n -> + | Int n | Opaque n | String n | UInt64 n -> n ^ "v" (* The following n...
2019 Jun 18
0
[libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...to represent enums? *) pr "\n"; pr "\ @@ -4040,6 +4069,7 @@ let () = List.iter ( fun (n, i) -> pr "let %s = %d_l\n" (String.lowercase_ascii n) i ) constants; + (* how to represent enums? *) pr "\n"; pr "\ @@ -4092,7 +4122,7 @@ let print_ocaml_binding (name, { args; ret }) = List.map ( function | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | Int n | Opaque n | String n | UInt64 n -> + | Int n | Opaque n | ReadStatus n | String n | UInt64 n -> n ^ "v"...
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...4670,7 +4637,6 @@ let rec name_of_ocaml_arg = function | Flags n -> n | Int n -> n | Int64 n -> n - | Mutable arg -> name_of_ocaml_arg (OCamlArg arg) | Path n -> n | SockAddrAndLen (n, len) -> n | String n -> n @@ -4839,23 +4805,17 @@ let print_ocaml_binding (name, { args; ret }) = let argnames = List.map ( function - | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | Int n | Int64 n - | Mutable (Int n) | String n | UInt n | UInt64 n -> + | CBArrayAndLen (UInt32 n, _) | CBBytesIn...
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...(* XXX not impl *) | OCamlArg (Path _) -> "string" | OCamlArg (SockAddrAndLen _) -> "string" (* XXX not impl *) | OCamlArg (String _) -> "string" @@ -4574,22 +4577,13 @@ external close : t -> unit = \"nbd_internal_ocaml_nbd_close\" let print_ocaml_binding (name, { args; ret }) = (* Functions with a callback parameter require special handling. *) - let find_callback opaque_id = - try - List.find ( - function - | Callback (_, args) | CallbackPersist (_, args) -> - List.mem (Opaque opaque_id) args - | _...
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
In this patch series we use the newly introduced free callback on the completion function to dererence the OCaml NBD.Buffer. I will make the same kind of change for Python later in a separate series. The completion function is always called at the C level, even if the OCaml program didn't use the optional argument. That's because the free callback doesn't run otherwise. There is a
2019 Jul 16
3
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
Posting now that I got something to compile (at the expense of breaking OCaml bindings), but I'm open to ideas on how to improve it. Eric Blake (2): generator: Tweak print_c_arg_list to take alternate first arg RFC: generator: Handle shared callbacks in Python generator/generator | 556 ++++++++++++++++++++++---------------------- 1 file changed, 280 insertions(+), 276 deletions(-) --
2019 Jun 20
1
Re: [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...; ) constants; > + (* how to represent enums? *) Something like: type name_of_the_enum = | CaseA | CaseB You have to at least make sure the first letter is a capital (or capitalize it) unfortunately. > pr "\n"; > > pr "\ > @@ -4092,7 +4122,7 @@ let print_ocaml_binding (name, { args; ret }) = > List.map ( > function > | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) > - | Int n | Opaque n | String n | UInt64 n -> > + | Int n | Opaque n | ReadStatus n | String n | UInt64 n -> >...
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...| OCamlArg (Mutable arg) -> ocaml_arg_to_string (OCamlArg arg) ^ " ref" | OCamlArg (Opaque n) -> sprintf "'%s" n | OCamlArg (Path _) -> "string" | OCamlArg (SockAddrAndLen _) -> "string" (* XXX not impl *) @@ -3985,13 +4020,13 @@ let print_ocaml_binding (name, { args; ret }) = List.map ( function | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | String n | UInt64 n | Opaque n -> + | String n | UInt64 n | Opaque n | Mutable (Int n) -> n ^ "v" (* The f...
2019 Aug 12
0
[PATCH libnbd 5/7] ocaml: Use free callback to free closure root, instead of valid_flag == FREE.
...use a free callback to free each closure root. --- generator/generator | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/generator/generator b/generator/generator index 92ce170..109fad6 100755 --- a/generator/generator +++ b/generator/generator @@ -5239,9 +5239,6 @@ let print_ocaml_binding (name, { args; optargs; ret }) = pr " caml_enter_blocking_section ();\n"; pr " }\n"; pr "\n"; - pr " if (valid_flag & LIBNBD_CALLBACK_FREE)\n"; - pr " free_root (NULL, user_data);\n"; - pr &quot...
2019 Aug 09
4
[PATCH libnbd 0/2] generator: Preparatory changes to the generator.
These are some simplifications to the generator. They don't probably make much sense on their own, but they are preparatory to better handling of enums, and or'd lists of flags. Rich.
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...callback. This is because we may need to unregister an\n"; + pr " * associated persistent buffer.\n"; + pr " */\n"; + pr " if (data->fnv == 0)\n"; + pr " CAMLreturnT (int, 0);\n"; List.iter ( function @@ -5079,19 +5080,19 @@ let print_ocaml_binding (name, { args; optargs; ret }) = List.iter ( function | OClosure { cbname } -> - pr " nbd_%s_callback %s_callback = {0};\n" cbname cbname; + pr " nbd_%s_callback %s_callback;\n" cbname cbname; + pr " struct user_data *%s_user_data = a...
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
...Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ > + | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ > | UInt _ | UInt32 _ -> assert false > ) args; > pr " return ret;\n"; > @@ -3989,13 +4078,13 @@ let print_ocaml_binding (name, { args; ret }) = > List.map ( > function > | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) > - | String n | UInt64 n | Opaque n -> > + | Int n | Opaque n | String n | UInt64 n -> > n ^ "v"...
2019 Aug 10
0
[PATCH libnbd 3/9] generator: Add Enum type for enumerated types / unions.
...;\n"; + pr " CAMLreturnT (int, r);\n"; + pr "}\n"; + pr "\n" + let print_ocaml_flag_val { flag_prefix; flags } = pr "/* Convert OCaml %s.t list to uint32_t bitmask. */\n" flag_prefix; pr "static uint32_t\n"; @@ -5097,6 +5193,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) = pr " *%s_user_data = %sv;\n" cbname cbname; pr " caml_register_generational_global_root (%s_user_data);\n" cbname; pr " const void *%s_callback = %s_%s_wrapper;\n" cbname name cbname + | Enum (n, { enum_...
2019 Aug 10
0
[PATCH libnbd 6/9] generator: Add non-optional Flags type.
...Path _ -> "string" @@ -4753,6 +4771,7 @@ let ocaml_name_of_arg = function | BytesPersistOut (n, len) -> n | Closure { cbname } -> cbname | Enum (n, _) -> n + | Flags (n, _) -> n | Int n -> n | Int64 n -> n | Path n -> n @@ -5212,6 +5231,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) = pr " const void *%s_callback = %s_%s_wrapper;\n" cbname name cbname | Enum (n, { enum_prefix }) -> pr " int %s = %s_val (%sv);\n" n enum_prefix n + | Flags (n, { flag_prefix }) -> + pr " uint32_t %s...
2019 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...BytesOut _ + | ArrayAndLen _ | Bool _ | BytesOut _ | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _ | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ | UInt _ | UInt32 _ -> assert false @@ -3899,10 +3932,11 @@ let print_ocaml_binding (name, { args; ret }) = let argnames = List.map ( function - | ArrayAndLen (UInt32 n, _) | String n | UInt64 n | Opaque n -> + | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) + | String n | UInt64 n | Opaque n -> n ^ &...
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...ackPersist _ - | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ + | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ | UInt _ | UInt32 _ -> assert false ) args; pr " return ret;\n"; @@ -3989,13 +4078,13 @@ let print_ocaml_binding (name, { args; ret }) = List.map ( function | ArrayAndLen (UInt32 n, _) | BytesIn (n, _) - | String n | UInt64 n | Opaque n -> + | Int n | Opaque n | String n | UInt64 n -> n ^ "v" (* The following n...
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. Rich.
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...BytesOut (n, len) -> n | BytesPersistIn (n, len) -> n | BytesPersistOut (n, len) -> n - | Closure (_, closures) -> assert false + | Closure (_, { cbname }) -> cbname | Flags n -> n | Int n -> n | Int64 n -> n @@ -4705,42 +4644,31 @@ let print_ocaml_binding (name, { args; ret }) = (* Functions with a callback parameter require special handling. *) List.iter ( function - | Closure (persistent, cls) -> - pr "struct %s_user_data {\n" name; - List.iter (fun { cbname } -> pr " value %s;\n" cbname) cls...