From 26c1323d1982397f172365feef847a232addba21 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Fri, 31 May 2024 18:02:22 +0100 Subject: [PATCH] [1.0.2][r] fix name generation when using xi:include --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 2 +- README.md | 2 +- tools/scxml2gen/scxml2gen.py | 6 ++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a25e01..3271272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to project will be documented in this file. +## [1.0.2] - 2024-05-31 +### Fixed +- fixed handling of tags during code generation (transition targets were getting double prefix which was breaking the build) + ## [1.0.1] - 2024-01-11 ### Fixed - STD dispatcher incorrectly schedules repeating timer event (https://github.com/igor-krechetov/hsmcpp/pull/8) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef186a3..3811c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16) project(hsmcpp) -set(PROJECT_VERSION "1.0.1") +set(PROJECT_VERSION "1.0.2") set(PROJECT_DESCRIPTION "C++ library for hierarchical state machines / finite state machines. Provides a code-free visual approach for defining state machine logic using GUI editors with automatic code and diagram generation. Check out https://hsmcpp.readthedocs.io for detailed documentation.") set(CMAKE_VERBOSE_MAKEFILE OFF) diff --git a/README.md b/README.md index 0d91f9c..725d929 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/igor-krechetov/hsmcpp/blob/main/LICENSE) -[![Changelog](https://img.shields.io/badge/changelog-v1.0.1-green.svg)](https://github.com/igor-krechetov/hsmcpp/blob/main/CHANGELOG.md) +[![Changelog](https://img.shields.io/badge/changelog-v1.0.2-green.svg)](https://github.com/igor-krechetov/hsmcpp/blob/main/CHANGELOG.md) [![Documentation Status](https://readthedocs.org/projects/hsmcpp/badge/?version=latest)](https://hsmcpp.readthedocs.io/en/latest/?badge=latest) # Releases diff --git a/tools/scxml2gen/scxml2gen.py b/tools/scxml2gen/scxml2gen.py index 58bd64d..aaa3a73 100644 --- a/tools/scxml2gen/scxml2gen.py +++ b/tools/scxml2gen/scxml2gen.py @@ -202,9 +202,11 @@ def parseScxmlStates(parentElement, rootDir, namePrefix): includePath = os.path.join(rootDir, curState.attrib['href']) print(f"-- INCLUDE: {includePath}") - # add prefix only if xi:include is wrapped inside aa state with no other items inside + # add prefix only if xi:include is wrapped inside a state with no other items inside if ('id' in parentElement.attrib) and (xmlFind(parentElement, "state") is None) and (len(list(xmlFindAll(parentElement, "include"))) == 1): newPrefix += parentElement.attrib['id'] + "__" + else: + print(f"WARNING: parent state({parentElement.attrib['id']}) of xi:include has other child states. State names will not be prefixed") subScxml = parseScxml(includePath, newPrefix) if subScxml is not None: @@ -257,7 +259,7 @@ def parseScxmlStates(parentElement, rootDir, namePrefix): if "target" in curTransition.attrib: newTransition["target"] = namePrefix + curTransition.attrib["target"] else: - newTransition["target"] = namePrefix + newState["id"] + newTransition["target"] = newState["id"] if "cond" in curTransition.attrib: newTransition["condition"] = getCallbackName(curTransition)