Page 1 of 1

How are those wrapper code under scripting\ecmaapi\ generated?

Posted: Thu Apr 25, 2019 5:49 am
by outman
I also wonder how are those wrapper code under scripting\ecmaapi\ generated?

Re: How are those wrapper code under scripting\ecmaapi\ generated?

Posted: Thu Apr 25, 2019 2:35 pm
by andrew
We're currently using a combination of src2srcml and XSLT to create script bindings automatically.

Re: How are those wrapper code under scripting\ecmaapi\ generated?

Posted: Thu Apr 25, 2019 3:24 pm
by outman
Thanks, andrew, awesome work!
So, can I get more details about the method to create script bindings automatically? Maybe when I make some changes to the interfaces, I don't need to change those bindings manually.

Re: How are those wrapper code under scripting\ecmaapi\ generated?

Posted: Fri Apr 26, 2019 1:46 pm
by andrew
The ECMA script bindings generator can be found at:
https://github.com/qcad/qcad/tree/maste ... agenerator

It's probably not for the faint-hearted... However, you could keep an XML file with your interface up to date like those in https://github.com/qcad/qcad/tree/maste ... or/src/xml and then use xml2cpp.xsl to generate C++ source code. That should be straightforward and does not involve the srcml tools.

Re: How are those wrapper code under scripting\ecmaapi\ generated?

Posted: Tue Apr 30, 2019 1:07 am
by outman
Thanks,Andrew.
I tried to run the 'generate.sh' and the 'cpp2srcml.sh', and got the message 'src2srcml not found'. My question is, is src2srcml the earlier version of srcml tool?

Re: How are those wrapper code under scripting\ecmaapi\ generated?

Posted: Tue Apr 30, 2019 3:00 pm
by andrew
Possibly.

Our version reports:

Code: Select all

$ src2srcml --version
src2srcml Version Beta Nov-09-2006 Libxml2 enabled
Copyright (C) 2006 SDML