GitHub Source | SCXML Wiki | SCXML Editor | Examples | Forum |
---|
The main objective of the project is to execute dynamic SCXML state charts in C++ Builder by using such a great library as USCXML. But the problem is that USCXML source code can not be compiled by Borland C++ Compiler (not full C11 support, compiler bugs etc). We have an option to use uscxml-transformer application for transpiling SCXML source code to ANSI-C. But in this case you have to compile application every time once you've made corrections to state chart. The solution seems to have a common library wrapper with only C-functions, which could be executed on all versions of C++ Builder.
UscxmlCLib consists of only 1 lib and 1 header which should be added to C++ Builder to start executing state charts.
Windows 7, Windows 8, Windows 10
MSVC 2015 SP3
UscxmlCLib\Lib\UscxmlCLib_borland.lib - for Borland C++ Compiler (tests were performed on C++ Builder 2010, C++ Builder XE7)
UscxmlCLib\Lib\UscxmlCLib.lib - for MSVC 2015 SP3
-
Install Visual C++ Redistributable for Visual Studio 2015 SP3
-
Put UscxmlCLib\Bin binaries to Windows search path or add dir with binaries to PATH environment settings
There will be special article
Let's start 'Hello, world' example in C++ Builder
- Add library to project
#include "UscxmlCLib.h"
#pragma comment(lib,"UscxmlCLib_borland.lib")
- Set callbacks from interpreter and notifiers for main thread
class TLogNotify : public TIdNotify {
const UnicodeString FMessage;
protected:
virtual void __fastcall DoNotify(void) {
FormHelloWorld->Memo1->Lines->Add(FMessage);
}
public:
__fastcall TLogNotify(const UnicodeString &sMsg) : FMessage(sMsg) {
}
};
void __stdcall OnInterpreterLogCallback(const UsclibInterpreter *AInterpreter, const int nSeverity, const char *chMessage, void *AUser) {
(new TLogNotify(chMessage))->Notify();
}
- Work with interprter
if (USCLIB_SUCCESS != usclib_OpenInterpreter(&g_Interpreter, 0, 0, 0))
throw Exception(usclib_GetLastError());
usclib_RegisterLogCallback(g_Interpreter, OnInterpreterLogCallback, NULL);
if (USCLIB_SUCCESS != usclib_StartInterpreter(g_Interpreter, g_chScxml, USCLIB_SCXML_AS_TEXT))
throw Exception(usclib_GetLastError());
if (USCLIB_SUCCESS != usclib_CloseInterpreter(g_Interpreter))
throw Exception(usclib_GetLastError());
UscxmlCLib itself is distributed under under the terms of the BSD 3-Clause License but it include external components with their own licensies
Project | License | Comment |
---|---|---|
uSCXML | Simplified BSD license | This wrapper mostly based on uSCXML original SDK |
libcurl | MIT/X derivate | Used in uSCXML to fetch remote content |
Xerces-C++ | Apache v2 | XML parser and DOM implementation |
libevent | 3-clause BSD | Delayed event queues |
uriparser | New BSD | Referring and resolving URIs |
Lua | Under the terms of the MIT license | Lua Data Model |
JavaScriptCore | Under the LGPL and BSD licenses | EcmaScript Data Model |
Almost the same as uSCXML original with some restrictions. Run W3C testing application to get more info
- NULL
- Lua
- Luavia (Lua datamodel with some non-standard extensions to increase state chart performance)
- EcmaScript Based on JavaScriptCore binaries
After installation you are able to start ready-to-use examples.
- Hello World
- Traffic Light
- Calculator
- Multiple Interpreters
- KT76C Transponder Simulator
- Salus RT500 (Digital Room Thermostat) Simulator
- W3C SCXML Testing Application
- UscxmlCLib Testing Application
Take special look at KT76C Transponder Example!
It has ZERO lines of device logic in C++! Just connected GUI controls!
TOP | GitHub Source | SCXML Wiki | SCXML Editor | Examples | Forum |
---|