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

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
outman
Newbie Member
Posts: 6
Joined: Thu Apr 25, 2019 3:55 am

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

Post by outman » Thu Apr 25, 2019 5:49 am

I also wonder how are those wrapper code under scripting\ecmaapi\ generated?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

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

Post by andrew » Thu Apr 25, 2019 2:35 pm

We're currently using a combination of src2srcml and XSLT to create script bindings automatically.

outman
Newbie Member
Posts: 6
Joined: Thu Apr 25, 2019 3:55 am

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

Post by outman » Thu Apr 25, 2019 3:24 pm

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.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

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

Post by andrew » Fri Apr 26, 2019 1:46 pm

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.

outman
Newbie Member
Posts: 6
Joined: Thu Apr 25, 2019 3:55 am

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

Post by outman » Tue Apr 30, 2019 1:07 am

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?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

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

Post by andrew » Tue Apr 30, 2019 3:00 pm

Possibly.

Our version reports:

Code: Select all

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

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”