search for: caml_named_value

Displaying 20 results from an estimated 42 matches for "caml_named_value".

2019 Sep 05
1
[PATCH] ocaml: Change calls to caml_named_value() to cope with const value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is declared const. Based on Pino Toscano's original patch to ocaml-augeas. --- common/mlpcre/pcre-c.c | 3 +-- common/mltools/uri-c.c | 6 ++---- common/mlvisit/visit-c.c | 4 +--- generator/daemon.ml | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/common/mlpc...
2019 Sep 05
0
[PATCH 1/1] ocaml: make const the return value of caml_named_value()
With OCaml >= 4.09 caml_named_value() returns a const value *, so keep the constness to build also in this case. --- common/mlpcre/pcre-c.c | 2 +- common/mltools/uri-c.c | 2 +- common/mlvisit/visit-c.c | 2 +- generator/daemon.ml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/mlpcre/pcre-c.c...
2019 Sep 05
2
[PATCH 0/1] Build fix for future OCaml 4.09
...x for building also with the upcoming OCaml 4.09, which has a slight API change in the C library. This does not cover embedded copies such as ocaml-augeas, and ocaml-libvirt, which are being fixed separately, and will then be synchronized. Pino Toscano (1): ocaml: make const the return value of caml_named_value() common/mlpcre/pcre-c.c | 2 +- common/mltools/uri-c.c | 2 +- common/mlvisit/visit-c.c | 2 +- generator/daemon.ml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) -- 2.21.0
2019 Jan 23
2
[supermin PATCH 1/2] rpm: extend the Multiple_matches exception
...pm-c.c b/src/librpm-c.c index 3bd25a2..75ca4d7 100644 --- a/src/librpm-c.c +++ b/src/librpm-c.c @@ -66,10 +66,15 @@ librpm_handle_closed (void) } static void -librpm_raise_multiple_matches (int occurrences) +librpm_raise_multiple_matches (value pkgv, int occurrences) { - caml_raise_with_arg (*caml_named_value ("librpm_multiple_matches"), - Val_int (occurrences)); + CAMLparam1 (pkgv); + + value args[] = { pkgv, Val_int (occurrences) }; + caml_raise_with_args (*caml_named_value ("librpm_multiple_matches"), + 2, args); + + CAMLnoreturn;...
2010 Jan 07
1
Segfault in GetNewPage, memory.c.
...tus; > PROTECT(text = mkString(String_val(s))); > PROTECT(pr=R_ParseVector(text, 1, &status, R_NilValue)); > UNPROTECT(2); > switch (status) { > case PARSE_OK: > break; > case PARSE_INCOMPLETE: > case PARSE_EOF: > caml_raise_with_string(*caml_named_value("Parse_incomplete"), (String_val(s))); > case PARSE_NULL: > case PARSE_ERROR: > caml_raise_with_string(*caml_named_value("Parse_error"), (String_val(s))); > } > CAMLreturn(Val_sexp(VECTOR_ELT(pr,0))); > } But before calling ParseVector, i...
2013 Mar 25
86
[PATCH 00/28] libxl: ocaml: improve the bindings
The following series of patches fill in most of the gaps in the OCaml bindings to libxl, to make them useful for clients such as xapi/xenopsd (from XCP). There are a number of bugfixes to the existing bindings as well. I have an experimental version of xenopsd that successfully uses the new bindings. An earlier version of the first half of the series was submitted to the last by Ian Campbell on
2019 Dec 06
2
OCaml 4.09.0 rebuild complete in Rawhide (was: Re: OCaml 4.09.0 will be added to Fedora 32 via a side tag)
...nd they work fine with OCaml code. https://github.com/ocaml/ocaml/issues/2314 - ocaml-x11 (various demo-level APIs for accessing X11 directly) was moved out of the OCaml distribution upstream. While we might consider packaging this separately, my advise is to use Gtk etc instead. - caml_named_value returns a const pointer. While this is correct, it also broke a couple of our packages and will require upstream fixes. - RISC-V support should be in better shape. Rich. ocaml-tplib https://koji.fedoraproject.org/koji/buildinfo?buildID=1420345 ocaml-p3l https://koji.fedoraproject.org/koj...
2019 May 30
5
[PATCH 0/5] RFC: switch augeas APIs to OCaml
This synchronizes the embedded ocaml-augeas copy, and reimplements the augeas APIs using it (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Pino Toscano (5): common/mlaugeas: Synchronize with latest ocaml-augeas daemon: fix/enhance error reporting of Augeas exceptions Revert "Revert "daemon: implement
2017 Jul 31
0
[PATCH v11 02/10] daemon: Embed the ocaml-augeas library in the daemon.
...e <caml/memory.h> +#include <caml/mlvalues.h> +#include <caml/fail.h> +#include <caml/callback.h> +#include <caml/custom.h> + +typedef augeas *augeas_t; + +/* Raise an Augeas.Error exception. */ +static void +raise_error (const char *msg) +{ + caml_raise_with_string (*caml_named_value ("Augeas.Error"), msg); +} + +/* Map OCaml flags to C flags. */ +static int flag_map[] = { + /* AugSaveBackup */ AUG_SAVE_BACKUP, + /* AugSaveNewFile */ AUG_SAVE_NEWFILE, + /* AugTypeCheck */ AUG_TYPE_CHECK, + /* AugNoStdinc */ AUG_NO_STDINC, + /* AugSaveNoop */ AUG_SAVE_NOO...
2017 Aug 09
0
[PATCH v12 02/11] common: Bundle the ocaml-augeas library for use by the daemon.
...e <caml/memory.h> +#include <caml/mlvalues.h> +#include <caml/fail.h> +#include <caml/callback.h> +#include <caml/custom.h> + +typedef augeas *augeas_t; + +/* Raise an Augeas.Error exception. */ +static void +raise_error (const char *msg) +{ + caml_raise_with_string (*caml_named_value ("Augeas.Error"), msg); +} + +/* Map OCaml flags to C flags. */ +static int flag_map[] = { + /* AugSaveBackup */ AUG_SAVE_BACKUP, + /* AugSaveNewFile */ AUG_SAVE_NEWFILE, + /* AugTypeCheck */ AUG_TYPE_CHECK, + /* AugNoStdinc */ AUG_NO_STDINC, + /* AugSaveNoop */ AUG_SAVE_NOO...
2019 Dec 16
4
[PATCH 0/2] Move ocaml-augeas copy to libguestfs repo
ocaml-augeas is used only by virtlibguestfs, so move it to this repository, instead of having it around in the common submodule. The removal from common will happen later. Pino Toscano (2): Bundle the ocaml-augeas library for use by libguestfs build: switch embedded copy of ocaml-augeas .gitignore | 1 + 3rdparty/ocaml-augeas/COPYING.LIB | 515
2014 Sep 17
4
[PATCH 0/2] supermin: use librpm for rpm support
Hi, this work makes supermin use the rpm library instead of invoking rpm directly. This, together with a needed refactoring of the dependency resolution, should help in make supermin faster on rpm-based systems. Surely the patches will still need polishing, especially for behaviours of newly added stuff, but at least it's a good starting point. Noting that you need rpm-devel on most of rpm
2020 Mar 09
4
[PATCH v3 0/3] Switch augeas APIs to OCaml
This reimplements the augeas APIs using ocaml-augeas (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Changes from v2: - dropped patch #1, as it was applied already (was a real bugfix) - rebased on master Pino Toscano (3): Revert "Revert "daemon: implement OptString for OCaml APIs"" daemon: move augeas
2020 Jan 09
5
[PATCH v2 0/4] Switch augeas APIs to OCaml
This reimplements the augeas APIs using ocaml-augeas (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Pino Toscano (4): daemon: fix/enhance error reporting of Augeas exceptions Revert "Revert "daemon: implement OptString for OCaml APIs"" daemon: move augeas APIs to OCaml daemon: drop usage of C
2017 Jul 14
0
[PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...LL;\n"; + pr " CAMLparam0 ();\n"; + pr " CAMLlocal2 (v, retv);\n"; + pr " CAMLlocalN (args, %d);\n" + (nr_args + if add_unit_arg then 1 else 0); + pr "\n"; + pr " if (cb == NULL)\n"; + pr " cb = caml_named_value (\"%s\");\n" ocaml_function; + pr "\n"; + + (* Construct the actual call, but note that we want to pass + * the optional arguments first in the list. + *) + let i = ref 0 in + List.iter ( + fun optarg -> + let n = name_of_o...
2017 Oct 04
11
[PATCH 0/9] build: Require OCaml >= 4.02.
Per my previous email: https://www.redhat.com/archives/libguestfs/2017-September/msg00203.html I'd like to talk about requiring a more modern version of the OCaml compiler. These commits show some of the code changes which would be possible with OCaml >= 3.12 [which it turns out we already require by accident] and also with OCaml >= 4.02. The latter is my favoured option. Rich.
2010 Jun 28
8
[PATCH] add xl ocaml bindings
...e(&ctx) + +void log_callback(void *userdata, int loglevel, const char *file, + int line, const char *func, char *s) +{ +} + +void failwith_xl(char *log_data) +{ + char s[1024]; + snprintf(s, 1024, "proper logging not implemented yet: error in %s", log_data); + caml_raise_with_string(*caml_named_value("xl.error"), log_data); +} + +static int string_string_tuple_array_val (char ***c_val, value v) +{ + CAMLparam1(v); + CAMLlocal1(a); + int i; + char **array; + + for (i = 0, a = Field(v, 5); a != Val_emptylist; a = Field(a, 1)) { i++; } + + array = calloc((i + 1) * 2, sizeof(char *)); + i...
2017 Jun 03
3
[PATCH 0/3]: daemon: Reimplement ‘file’ API in OCaml.
This patch series is just FYI at the moment. However it does pass the tests. The daemon is a self-contained program. We don't need to write it all in C. Writing parts of it in OCaml would make it simpler and less error-prone. In particular if the daemon was written in a more sane programming language then we could move the inspection code to run entirely inside the appliance, which would
2017 Jul 21
0
[PATCH v2 01/23] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...LL;\n"; + pr " CAMLparam0 ();\n"; + pr " CAMLlocal2 (v, retv);\n"; + pr " CAMLlocalN (args, %d);\n" + (nr_args + if add_unit_arg then 1 else 0); + pr "\n"; + pr " if (cb == NULL)\n"; + pr " cb = caml_named_value (\"%s\");\n" ocaml_function; + pr "\n"; + + (* Construct the actual call, but note that we want to pass + * the optional arguments first in the list. + *) + let i = ref 0 in + List.iter ( + fun optarg -> + let n = name_of_o...
2019 Apr 08
0
[PATCH v4 2/7] common: Bundle the libvirt-ocaml library for use by virt-v2v
...+ /* Fake a _virError structure. */ + memset (&err, 0, sizeof err); + err.code = VIR_ERR_INTERNAL_ERROR; + err.domain = VIR_FROM_NONE; + err.level = VIR_ERR_ERROR; + err.message = (char *) fn; + errp = &err; + } + + rv = Val_virterror (errp); + caml_raise_with_arg (*caml_named_value ("ocaml_libvirt_virterror"), rv); + + /*NOTREACHED*/ + /* Suppresses a compiler warning. */ + (void) caml__frame; +} + +static int +_list_length (value listv) +{ + CAMLparam1 (listv); + int len = 0; + + for (; listv != Val_emptylist; listv = Field (listv, 1), ++len) {} + + CAMLretu...