Re: Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-22 Thread Andrea Bolognani
On Wed, 2020-04-22 at 10:45 +0100, Daniel P. Berrangé wrote: > On Wed, Apr 22, 2020 at 11:37:23AM +0200, Andrea Bolognani wrote: > > On Wed, 2020-04-22 at 09:48 +0100, Daniel P. Berrangé wrote: > > > I wonder if we can refactor that tool to extract the code for parsing into > > > a module, so that

Re: Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-22 Thread Daniel P . Berrangé
On Wed, Apr 22, 2020 at 11:37:23AM +0200, Andrea Bolognani wrote: > On Wed, 2020-04-22 at 09:48 +0100, Daniel P. Berrangé wrote: > > On Wed, Apr 22, 2020 at 01:51:10PM +0800, Shi Lei wrote: > > > As you suggested, parsing C-structs plus some magic comments may be a > > > good starting point. > > >

Re: Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-22 Thread Andrea Bolognani
On Wed, 2020-04-22 at 09:48 +0100, Daniel P. Berrangé wrote: > On Wed, Apr 22, 2020 at 01:51:10PM +0800, Shi Lei wrote: > > As you suggested, parsing C-structs plus some magic comments may be a good > > starting point. > > But parsing C is much more difficult than parsing xml or json. I think this

Re: Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-22 Thread Shi Lei
>On Wed, Apr 22, 2020 at 01:51:10PM +0800, Shi Lei wrote: >> As you suggested, parsing C-structs plus some magic comments may be a good >> starting point. >> But parsing C is much more difficult than parsing xml or json. I think this >> job should base on >> some present tools or other basis. We

Re: Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-22 Thread Daniel P . Berrangé
On Wed, Apr 22, 2020 at 01:51:10PM +0800, Shi Lei wrote: > As you suggested, parsing C-structs plus some magic comments may be a good > starting point. > But parsing C is much more difficult than parsing xml or json. I think this > job should base on > some present tools or other basis. We can fi

Re: Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-21 Thread Shi Lei
... ... >The key question is just how difficult will it be to write a tool that >can parse the C header files, and magic comments, to output suitable >XML parser/formatter functions ? There's no easy way to answer that >without someone trying it. > > >Regards, >Daniel >-- >|: https://berrange.com -

Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-04-21 Thread Daniel P . Berrangé
On Wed, Mar 25, 2020 at 03:11:40PM +0800, Shi Lei wrote: > Outline > = > > In libvirt world, objects(like domain, network, etc.) are described with two > representations: structures in c-language and XML specified by relax-ng. > Since c-language-implementation and xml restricted by relax-

Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-03-26 Thread Peter Krempa
On Thu, Mar 26, 2020 at 18:19:20 +, Daniel Berrange wrote: > On Wed, Mar 25, 2020 at 03:11:40PM +0800, Shi Lei wrote: [...] > IOW if we go down the route of generating everything from the RNG schema, > we're quite likely to need to do work to make the RNG schema more accurate. > We'll probabl

Re: [RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-03-26 Thread Daniel P . Berrangé
On Wed, Mar 25, 2020 at 03:11:40PM +0800, Shi Lei wrote: > Outline > = > > In libvirt world, objects(like domain, network, etc.) are described with two > representations: structures in c-language and XML specified by relax-ng. > Since c-language-implementation and xml restricted by relax-

[RFC 00/29] RFC: Generate object-model code based on relax-ng files

2020-03-25 Thread Shi Lei
Outline = In libvirt world, objects(like domain, network, etc.) are described with two representations: structures in c-language and XML specified by relax-ng. Since c-language-implementation and xml restricted by relax-ng are merely the different expressions of the same object-model, we