Skip to content

Commit

Permalink
[1.0.2][r] fix name generation when using xi:include
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-krechetov committed May 31, 2024
1 parent 91b791d commit 26c1323
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 <xi:include> 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)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions tools/scxml2gen/scxml2gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 26c1323

Please sign in to comment.