search for: iteri

Displaying 20 results from an estimated 142 matches for "iteri".

Did you mean: iter
2009 Sep 11
2
[PATCH] generator.ml: Fix string list memory leak
...t; int %s;\n" n | Int n -> pr " int %s;\n" n ) (snd style); @@ -6364,6 +6364,20 @@ and generate_fish_cmds () = generate_c_call_args ~handle:"g" style; pr ";\n"; + (* XXX: There must be a cleaner way to write this *) + iteri ( + fun i -> + function + | StringList name | DeviceList name -> + pr " char **%s_i = %s;\n" name name; + pr " while(*%s_i) {\n" name; + pr " free(*%s_i);\n" name; + pr "...
2013 Nov 06
2
Re: Problem using virt-sysprep with RBD images
...[2]: Entering directory `/root/libguestfs-1.25.6/builder' ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml -o builder.cmx File "builder.ml", line 53, characters 4-14: Error: Unbound value List.iteri make[2]: *** [builder.cmx] Error 2 make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/libguestfs-1.25.6' make: *** [all] Error 2 Can you provide some assistance resolving this compile error please? Is there p...
2014 Oct 10
0
[PATCH 3/3] builder: use the JSON module
...tf_int64 key = function - | None -> () - | Some n -> - printf " \"%s\": \"%Ld\",\n" key n in - let json_optional_printf_stringlist key = function - | None -> () - | Some l -> - printf " \"%s\": [" key; - iteri ( - fun i alias -> - printf " \"%s\"%s" alias (trailing_comma i (List.length l)) - ) l; - printf " ],\n" in - let print_notes = function - | [] -> () - | notes -> - printf " \"notes\": {\n"; - i...
2013 Nov 06
0
Re: Problem using virt-sysprep with RBD images
.../root/libguestfs-1.25.6/builder' > ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I > ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml -o > builder.cmx > File "builder.ml", line 53, characters 4-14: > Error: Unbound value List.iteri > make[2]: *** [builder.cmx] Error 2 > make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/root/libguestfs-1.25.6' > make: *** [all] Error 2 Hmm, this is actually another bug :-( The attached pat...
2017 Oct 08
0
[PATCH v2 1/4] common/mlstdutils: Extend the List module.
...ns on lists which are not provided by the standard library. As with Char and String, let's extend List to add these new functions to a List pseudo-module (really Std_utils.List, but called List when you ‘open Std_utils’). The initial exported functions are all List functions from OCaml 3.11 + iteri + mapi. We can add other functions as needed. --- common/mlstdutils/std_utils.ml | 4 ++++ common/mlstdutils/std_utils.mli | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml index fca76c...
2017 Nov 07
1
Re: [PATCH v2 1/4] common/mlstdutils: Extend the List module.
...ided by > the standard library. As with Char and String, let's extend List to > add these new functions to a List pseudo-module (really > Std_utils.List, but called List when you ‘open Std_utils’). > > The initial exported functions are all List functions from OCaml 3.11 > + iteri + mapi. We can add other functions as needed. > --- My worry about this is that: - OCaml does not have OOTB support for conditional code depending on the version - the interface of the List module would get "frozen" this way, and overrides the module in the standard library then...
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...erences this type. + *) + pr "static value __attribute__ ((unused))\n"; + pr "Val_%s (int i)\n" enum_prefix; + pr "{\n"; + pr " CAMLparam0 ();\n"; + pr " CAMLlocal1 (rv);\n"; + pr "\n"; + pr " switch (i) {\n"; + List.iteri ( + fun i (enum, _) -> + pr " case LIBNBD_%s_%s: rv = Val_int (%d); break;\n" enum_prefix enum i + ) enums; + (* Possible if newer libnbd returns value not present in older compilation *) + pr " default: abort ();\n"; + pr " }\n"; + pr "\n&quo...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...Caml %s.t. */\n" enum_prefix; + pr "static value\n"; + pr "Val_%s (int i)\n" enum_prefix; + pr "{\n"; + pr " CAMLparam0 ();\n"; + pr " CAMLlocal1 (rv);\n"; + pr "\n"; + pr " switch (i) {\n"; + List.iteri ( + fun i (enum, _) -> + pr " case LIBNBD_%s_%s: rv = Val_int (%d); break;\n" enum_prefix enum i + ) enums; + pr " default:\n"; + pr " rv = caml_alloc (1, 0); /* UNKNOWN of int */\n"; + pr " Store_field (rv, 0, Val_int (i));\n&...
2020 Sep 07
4
[libnbd PATCH v2 0/3] Improve type-safety of ocaml/golang getters
Well, the golang changes (patch 1 and 2/3 of v1) were already committed, all that was left was the OCaml changes. I'm a lot happier with how things turned out with an UNKNOWN constructor in the OCaml variants. Eric Blake (3): tests: Enhance coverage of enum/flag range checking ocaml: Support unknown values for Enum/Flags ocaml: Typesafe returns for REnum/RFlags generator/OCaml.ml
2014 Jan 16
0
[PATCH 3/3] builder: add a JSON output for --list
..._int64 key value = + match value with + | None -> () + | Some n -> + printf " \"%s\": \"%Ld\",\n" key n in + + printf "{\n"; + printf " \"version\": %d,\n" 1; + printf " \"sources\": [\n"; + iteri ( + fun i (source, fingerprint) -> + printf " {\n"; + printf " \"uri\": \"%s\",\n" source; + printf " \"fingerprint\": \"%s\"\n" fingerprint; + printf " }%s\n" (trailing_comma i (List.l...
2009 Aug 17
1
two more warning-avoidance patches
...t test_name cmd = fun i str -> pr " const char *%s_%d = \"%s\";\n" n i (c_quote str); ) strs; - pr " const char *%s[] = {\n" n; + pr " const char *const %s[] = {\n" n; iteri ( fun i _ -> pr " %s_%d,\n" n i ) strs; @@ -5912,7 +5912,7 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd = | FileIn _, arg | FileOut _, arg -> pr ", \"%s\"" (c_quote arg)...
2017 May 04
1
[PATCH] perl: drop %guestfs_introspection stuff
...-> pr "[ '%s', 'int', %d ]" n i - | Int64 n -> pr "[ '%s', 'int64', %d ]" n i - | Pointer (t, n) -> pr "[ '%s', 'pointer(%s)', %d ]" n t i - in - pr " args => [\n"; - iteri (fun i arg -> - pr " "; - pr_type i arg; - pr ",\n" - ) args; - pr " ],\n"; - if optargs <> [] then ( - pr " optargs => {\n"; - iteri (fun i arg -> - pr " %s =>...
2014 Oct 10
4
[PATCH 1/3] Move JSON to mllib
Move the simple OCaml JSON writer to mllib, so that can be enhanced and used also outside v2v. --- mllib/JSON.ml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ mllib/JSON.mli | 26 ++++++++++++++++++++++++++ mllib/Makefile.am | 5 ++++- po/POTFILES-ml | 2 +- v2v/JSON.ml | 53 ----------------------------------------------------- v2v/JSON.mli | 26
2019 Feb 25
0
[PATCH 3/3] v2v: add -o json output mode
...| BusSlotRemovable { s_removable_type = Floppy } -> + let floppy = [ + "type", JSON.String "floppy"; + "dev", JSON.String (drive_prefix ^ drive_name i); + ] in + + List.push_back removables (JSON.Dict floppy) + in + + Array.iteri (iter_bus "virtio" "vd") target_buses.target_virtio_blk_bus; + Array.iteri (iter_bus "ide" "hd") target_buses.target_ide_bus; + Array.iteri (iter_bus "scsi" "sd") target_buses.target_scsi_bus; + Array.iteri (iter_bus "floppy&...
2019 Mar 29
0
[PATCH v2 3/3] v2v: add -o json output mode
...| BusSlotRemovable { s_removable_type = Floppy } -> + let floppy = [ + "type", JSON.String "floppy"; + "dev", JSON.String (drive_prefix ^ drive_name i); + ] in + + List.push_back removables (JSON.Dict floppy) + in + + Array.iteri (iter_bus "virtio" "vd") target_buses.target_virtio_blk_bus; + Array.iteri (iter_bus "ide" "hd") target_buses.target_ide_bus; + Array.iteri (iter_bus "scsi" "sd") target_buses.target_scsi_bus; + Array.iteri (iter_bus "floppy&...
2023 Mar 10
1
[V2V PATCH v3 1/6] Revert "Remove guestcaps_block_type Virtio_SCSI"
...convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestca...
2023 Mar 07
1
[V2V PATCH v2 1/5] Revert "Remove guestcaps_block_type Virtio_SCSI"
...convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestca...
2018 Feb 18
0
[PATCH 2/3] v2v: ovf: Create OVF more aligned with the standard
...["ovf:Envelope"; "Content"; "Section"] in + try find_node_by_attr sections ("xsi:type", "ovf:VirtualHardwareSection_Type") + with Not_found -> assert false in (* Iterate over the disks, adding them to the OVF document. *) List.iteri ( @@ -489,7 +523,12 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = let is_bootable_drive = i == 0 in let boot_order = i+1 in - let fileref = sprintf "%s/%s" image_uuid vol_uuid in + let fileref = + if rhv_export_flavor...
2023 Mar 13
1
[V2V PATCH v2 1/5] Revert "Remove guestcaps_block_type Virtio_SCSI"
...t; @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = > let bus = > match guestcaps.gcaps_block_bus with > | Virtio_blk -> virtio_blk_bus > + | Virtio_SCSI -> scsi_bus > | IDE -> ide_bus in > List.iteri ( > fun i d -> > diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml > index 5e444868..f0b32e01 100644 > --- a/lib/create_ovf.ml > +++ b/lib/create_ovf.ml > @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format > "ovf:disk-interfa...
2013 Nov 06
3
Re: Problem using virt-sysprep with RBD images
...builder' > > ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I > > ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml-o > > builder.cmx > > File "builder.ml", line 53, characters 4-14: > > Error: Unbound value List.iteri > > make[2]: *** [builder.cmx] Error 2 > > make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' > > make[1]: *** [all-recursive] Error 1 > > make[1]: Leaving directory `/root/libguestfs-1.25.6' > > make: *** [all] Error 2 > > Hmm, this is actually...