[PATCH] generator: Introduce error code (errcode) concept.
I have pushed this, this is just FYI. See the end of the patch for the new type and functions introduced into the generator. Passes all the tests, but should still be treated with a bit of suspicion. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On 07/03/11 19:34, Richard W.M. Jones wrote:
From 8037da06feea097716ce700f38c0eac0d5411a7c Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones<rjones@redhat.com> Date: Mon, 7 Mar 2011 19:28:30 +0000 Subject: [PATCH] generator: Introduce error code (errcode) concept.
There was a lot of repeated code to map return types (eg. RErr) to error cases (eg. -1 or NULL).
This commit introduces an error code type and two functions to map return types to error codes and error codes to strings. --- generator/generator_c.ml | 122 ++++++++++++++++++++++---------------- generator/generator_capitests.ml | 56 ++++++++++-------- generator/generator_daemon.ml | 40 +++++++------ generator/generator_java.ml | 85 +++++++++++++++------------ generator/generator_ocaml.ml | 58 ++++++++++-------- generator/generator_php.ml | 57 ++++++++++-------- generator/generator_python.ml | 46 ++++++++------ generator/generator_ruby.ml | 40 +++++++----- generator/generator_types.ml | 4 +- generator/generator_utils.ml | 17 +++++- generator/generator_utils.mli | 13 ++++- 11 files changed, 315 insertions(+), 223 deletions(-)
Adds more than it removes: that's a little disappointing. Still, I think it is worth it to have a single 'repository' of error codes. Incidentally, what's generator_utils.mli doing in there? Surely that's not under version control. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
On Tue, Mar 08, 2011 at 10:45:49AM +0000, Matthew Booth wrote:
Incidentally, what's generator_utils.mli doing in there? Surely that's not under version control.
module.mli = public interface of Module module.ml = implementation of Module They should both be under version control. You're probably thinking of *.cmi (compiled equivalent of .mli) which is generated and which we exclude by patterns in .gitignore. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (2)
-
Matthew Booth -
Richard W.M. Jones