Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.0 #64

Merged
merged 15 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

env:
SOLUTION_FILE_PATH: projects\visual-studio\ffsm2-vs.sln
SOLUTION_FILE_PATH: projects\premake\ffsm2-vs.sln

jobs:
build:
Expand All @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
BUILD_CONFIG: [ Release, Debug ]
BUILD_PLATFORM: [ x86, x64 ]
BUILD_PLATFORM: [ 32, 64 ]

steps:
- uses: actions/checkout@v4
Expand All @@ -31,4 +31,4 @@ jobs:

- name: Test
working-directory: ${{env.GITHUB_WORKSPACE}}
run: binaries-${{matrix.BUILD_PLATFORM}}\test-17-${{matrix.BUILD_CONFIG}}-${{matrix.BUILD_PLATFORM}}.exe
run: "binaries/test-17-${{matrix.BUILD_CONFIG}}-${{matrix.BUILD_PLATFORM}}.exe"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ cmake-*
/projects/code-lite/test/test.mk
/projects/visual-studio/.opencppcov
/projects/visual-studio/*.log
/pull.cmd
/push.cmd
10 changes: 5 additions & 5 deletions development/ffsm2/detail/features/logger_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ struct LoggerInterfaceT {
void
recordMethod(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin),
const Method FFSM2_UNUSED(method)) noexcept
const Method FFSM2_UNUSED(method))
{}

FFSM2_CONSTEXPR(NO)
virtual
void
recordTransition(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin),
const StateID FFSM2_UNUSED(target)) noexcept
const StateID FFSM2_UNUSED(target))
{}

#if FFSM2_PLANS_AVAILABLE()
Expand All @@ -45,14 +45,14 @@ struct LoggerInterfaceT {
void
recordTaskStatus(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin),
const StatusEvent FFSM2_UNUSED(event)) noexcept
const StatusEvent FFSM2_UNUSED(event))
{}

FFSM2_CONSTEXPR(NO)
virtual
void
recordPlanStatus(const Context& FFSM2_UNUSED(context),
const StatusEvent FFSM2_UNUSED(event)) noexcept
const StatusEvent FFSM2_UNUSED(event))
{}

#endif
Expand All @@ -61,7 +61,7 @@ struct LoggerInterfaceT {
virtual
void
recordCancelledPending(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin)) noexcept
const StateID FFSM2_UNUSED(origin))
{}

};
Expand Down
37 changes: 26 additions & 11 deletions development/ffsm2/detail/shared/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ move(T&& t) noexcept {

////////////////////////////////////////////////////////////////////////////////

template <typename T0,
typename T1>
template <
typename T0
, typename T1
>
FFSM2_CONSTEXPR(11)
T0
min(const T0 t0,
Expand All @@ -217,8 +219,10 @@ min(const T0 t0,

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

template <typename T0,
typename T1>
template <
typename T0
, typename T1
>
FFSM2_CONSTEXPR(11)
T0
max(const T0 t0,
Expand All @@ -230,19 +234,23 @@ max(const T0 t0,

//------------------------------------------------------------------------------

template <typename TIndex,
typename TElement,
TIndex NCount>
template <
typename TIndex
, typename TElement
, TIndex NCount
>
FFSM2_CONSTEXPR(11)
TIndex
count(const TElement(&)[NCount]) noexcept {
count(const TElement (&)[NCount]) noexcept {
return NCount;
}

//------------------------------------------------------------------------------

template <typename T,
typename TT>
template <
typename T
, typename TT
>
FFSM2_CONSTEXPR(11)
T
contain(const T x,
Expand All @@ -251,7 +259,6 @@ contain(const T x,
return (x + static_cast<T>(to) - 1) / static_cast<T>(to);
}

//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////

template <typename T>
Expand All @@ -262,6 +269,14 @@ fill(T& a, const char value) noexcept {
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

template<class T>
FFSM2_CONSTEXPR(14)
void destroy(T& t) noexcept {
t.~T();
}

////////////////////////////////////////////////////////////////////////////////

template <int>
Expand Down
6 changes: 3 additions & 3 deletions development/ffsm2/machine_dev.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// FFSM2 (flat state machine for games and interactive applications)
// 2.3.3 (2023-12-21)
// 2.4.0 (2023-12-25)
//
// Created by Andrew Gresyk
//
Expand Down Expand Up @@ -32,8 +32,8 @@
#pragma once

#define FFSM2_VERSION_MAJOR 2
#define FFSM2_VERSION_MINOR 3
#define FFSM2_VERSION_PATCH 3
#define FFSM2_VERSION_MINOR 4
#define FFSM2_VERSION_PATCH 0

#define FFSM2_VERSION (10000 * FFSM2_VERSION_MAJOR + 100 * FFSM2_VERSION_MINOR + FFSM2_VERSION_PATCH)

Expand Down
2 changes: 1 addition & 1 deletion examples/basic_audio_player/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct Logger

void recordTransition(const Context& /*context*/,
const StateID origin,
const StateID target) noexcept override
const StateID target) override
{
std::cout << stateName(origin) << " -> " << stateName(target) << "\n";
}
Expand Down
3 changes: 1 addition & 2 deletions examples/basic_traffic_light/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ struct Off

////////////////////////////////////////////////////////////////////////////////

int
main() {
int main() {
// shared data storage instance
Context context;

Expand Down
4 changes: 2 additions & 2 deletions examples/debug_logger_interface/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ struct Logger
{
void recordMethod(const Context& /*context*/,
const ffsm2::StateID /*origin*/,
const Method method) noexcept override
const Method method) override
{
std::cout //<< ffsm2::stateName(origin) << "::"
<< ffsm2::methodName(method) << "()\n";
}

void recordTransition(const Context& /*context*/,
const ffsm2::StateID /*origin*/,
const ffsm2::StateID /*target*/) noexcept override
const ffsm2::StateID /*target*/) override
{
std::cout //<< ffsm2::stateName(origin) << ": "
<< "changeTo<"
Expand Down
50 changes: 32 additions & 18 deletions include/ffsm2/machine.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// FFSM2 (flat state machine for games and interactive applications)
// 2.3.3 (2023-12-21)
// 2.4.0 (2023-12-25)
//
// Created by Andrew Gresyk
//
Expand Down Expand Up @@ -32,8 +32,8 @@
#pragma once

#define FFSM2_VERSION_MAJOR 2
#define FFSM2_VERSION_MINOR 3
#define FFSM2_VERSION_PATCH 3
#define FFSM2_VERSION_MINOR 4
#define FFSM2_VERSION_PATCH 0

#define FFSM2_VERSION (10000 * FFSM2_VERSION_MAJOR + 100 * FFSM2_VERSION_MINOR + FFSM2_VERSION_PATCH)

Expand Down Expand Up @@ -491,8 +491,10 @@ move(T&& t) noexcept {
return static_cast<RemoveReference<T>&&>(t);
}

template <typename T0,
typename T1>
template <
typename T0
, typename T1
>
FFSM2_CONSTEXPR(11)
T0
min(const T0 t0,
Expand All @@ -502,8 +504,10 @@ min(const T0 t0,
t0 : static_cast<T0>(t1);
}

template <typename T0,
typename T1>
template <
typename T0
, typename T1
>
FFSM2_CONSTEXPR(11)
T0
max(const T0 t0,
Expand All @@ -513,17 +517,21 @@ max(const T0 t0,
t0 : static_cast<T0>(t1);
}

template <typename TIndex,
typename TElement,
TIndex NCount>
template <
typename TIndex
, typename TElement
, TIndex NCount
>
FFSM2_CONSTEXPR(11)
TIndex
count(const TElement(&)[NCount]) noexcept {
count(const TElement (&)[NCount]) noexcept {
return NCount;
}

template <typename T,
typename TT>
template <
typename T
, typename TT
>
FFSM2_CONSTEXPR(11)
T
contain(const T x,
Expand All @@ -539,6 +547,12 @@ fill(T& a, const char value) noexcept {
memset(&a, static_cast<int>(value), sizeof(a));
}

template<class T>
FFSM2_CONSTEXPR(14)
void destroy(T& t) noexcept {
t.~T();
}

template <int>
struct StaticPrintConstT;

Expand Down Expand Up @@ -1598,15 +1612,15 @@ struct LoggerInterfaceT {
void
recordMethod(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin),
const Method FFSM2_UNUSED(method)) noexcept
const Method FFSM2_UNUSED(method))
{}

FFSM2_CONSTEXPR(NO)
virtual
void
recordTransition(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin),
const StateID FFSM2_UNUSED(target)) noexcept
const StateID FFSM2_UNUSED(target))
{}

#if FFSM2_PLANS_AVAILABLE()
Expand All @@ -1616,14 +1630,14 @@ struct LoggerInterfaceT {
void
recordTaskStatus(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin),
const StatusEvent FFSM2_UNUSED(event)) noexcept
const StatusEvent FFSM2_UNUSED(event))
{}

FFSM2_CONSTEXPR(NO)
virtual
void
recordPlanStatus(const Context& FFSM2_UNUSED(context),
const StatusEvent FFSM2_UNUSED(event)) noexcept
const StatusEvent FFSM2_UNUSED(event))
{}

#endif
Expand All @@ -1632,7 +1646,7 @@ struct LoggerInterfaceT {
virtual
void
recordCancelledPending(const Context& FFSM2_UNUSED(context),
const StateID FFSM2_UNUSED(origin)) noexcept
const StateID FFSM2_UNUSED(origin))
{}

};
Expand Down
Loading