From: Ian Campbell Subject: Re: [PATCH v3-RESEND 03/28] libxl: ocaml: avoid reserved words in type and field names. Date: Thu, 24 Oct 2013 23:04:16 +0100 Message-ID: <1382652256.22417.131.camel@hastur.hellion.org.uk> References: <1382362365-6645-1-git-send-email-rob.hoes@citrix.com> <1382362365-6645-4-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: <1382362365-6645-4-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: Rob Hoes Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-10-21 at 14:32 +0100, Rob Hoes wrote: > Do this by adding a "xl_" prefix to all names. Does this not result in pretty fugly looking ocaml code with lots of spurious "xl_" everywhere? > > Signed-off-by: Ian Campbell > Signed-off-by: Rob Hoes > > --- > New in v3: > * Using common prefixes rather than changing names on a case by case basis. > --- > tools/ocaml/libs/xl/genwrap.py | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py > index 1b68b6b..a14fcfe 100644 > --- a/tools/ocaml/libs/xl/genwrap.py > +++ b/tools/ocaml/libs/xl/genwrap.py > @@ -70,8 +70,11 @@ def ocaml_type_of(ty): > else: > return ty.rawname > > +def munge_name(name): > + return "xl_" + 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=""): >