From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Hoes Subject: [PATCH 05/28] libxl: ocaml: avoid reserved words in type and field names. Date: Mon, 25 Mar 2013 14:45:06 +0000 Message-ID: <1364222729-6982-6-git-send-email-rob.hoes@citrix.com> References: <1364222729-6982-1-git-send-email-rob.hoes@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1364222729-6982-1-git-send-email-rob.hoes@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, Rob Hoes List-Id: xen-devel@lists.xenproject.org Current just s/type/ty/ and there are no such fields (yet) so no change to generated code. Signed-off-by: Ian Campbell Signed-off-by: Rob Hoes --- tools/ocaml/libs/xl/genwrap.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py index 7b29039..9042c79 100644 --- a/tools/ocaml/libs/xl/genwrap.py +++ b/tools/ocaml/libs/xl/genwrap.py @@ -70,8 +70,14 @@ def ocaml_type_of(ty): else: return ty.rawname +def munge_name(name): + if name == "type": + return "ty" + else: + return name + def ocaml_instance_of(type, name): - return "%s : %s" % (name, ocaml_type_of(type)) + return "%s : %s" % (munge_name(name), ocaml_type_of(type)) def gen_ocaml_ml(ty, interface, indent=""): -- 1.7.10.4