Displaying 3 results from an estimated 3 matches for "to_from".
2020 Sep 01
3
Re: [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
On 9/1/20 8:25 AM, Eric Blake wrote:
> Fairly straightforward. I'd love for type export to be a bit more
> flexible to make description optional, but could not figure out how to
> decode that from the C side of things, so for now this just requires
> the caller to supply a description for all exports during
> .list_exports.
>
Maybe I did figure it out after all, although
2020 Sep 01
0
Re: [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...as type ‘string option’ */;
if (v == Val_int(0)) /* It's None */
printf ("None\n");
else {
/* It's Some string, set sv to the string value */
value sv = Field (v, 0);
printf ("Some %s\n", String_val (sv));
}
The weird casting macros have the form: To_from()
Also that String_val is only valid for a short period of time,
basically until the next OCaml allocation in the current thread.
> +++ w/plugins/ocaml/ocaml.c
> @@ -332,11 +332,12 @@ list_exports_wrapper (int readonly, int
> is_tls, struct nbdkit_exports *exports)
>
> /* Conve...
2020 Sep 01
1
Re: [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...t(0)) /* It's None */
> printf ("None\n");
> else {
> /* It's Some string, set sv to the string value */
> value sv = Field (v, 0);
> printf ("Some %s\n", String_val (sv));
> }
>
> The weird casting macros have the form: To_from()
>
> Also that String_val is only valid for a short period of time,
> basically until the next OCaml allocation in the current thread.
That's helpful, as well.
>
>> +++ w/plugins/ocaml/ocaml.c
>> @@ -332,11 +332,12 @@ list_exports_wrapper (int readonly, int
>>...