jp-embedded / scxmlcc

The SCXML state machine to C++ compiler
GNU General Public License v3.0
138 stars 34 forks source link

add support for <script> in <scxml> #79

Closed sstiller closed 5 years ago

sstiller commented 5 years ago

A better version of https://github.com/jp-embedded/scxmlcc/pull/78. #include, type declarations, etc. can now be added. Example:

<scxml initial="hello" version="0.9" xmlns="http://www.w3.org/2005/07/scxml">
  <script>#include &quot;foo.h&quot;</script>
  <script>void hello()
{
  std::cout &lt;&lt; &quot;Hello&quot; &lt;&lt; std::endl;
}</script>
  <state id="hello"/>
</scxml>

results in

...
// user initialisations
#include "foo.h"
void hello()
{
  std::cout << "Hello" << std::endl;
}
...

Closes #63

jp-embedded commented 5 years ago

That was fast - great :-)