diff --git a/sml/sml b/sml/sml deleted file mode 100644 index 2165e798..00000000 --- a/sml/sml +++ /dev/null @@ -1,977 +0,0 @@ -// -// Copyright (c) 2022 Kris Jusiak (kris at jusiak dot net) -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Tests -// $CXX -std=c++20 -x c++ sml -DUT -// -// Benchmarks -// perf stat $CXX -std=c++20 -x c++ sml -DBENCH -// -// Features -// sm -// dependencies -// process_event(Event) -// is(state...) -// -// dsl -// transition_table -// initial state -// termiante state -// orthogonal regions -// dispatch_table -// guards/actions -// compund guards, seq actions -// constexpr guards -// events -// unexpected event -// actions -// process -// -// Example -// https://godbolt.org/z/v98acEbb6 -// -// [] support for logger -// -// [] entry/exit actions for state - -#if defined(__cpp_modules) && !defined(BOOST_SML_DISABLE_MODULE) -export module boost.sml; -export import std; -#else -#pragma once -#if not defined(__clang__) -#pragma GCC system_header -#endif -#endif -#if defined(__cpp_modules) && !defined(BOOST_SML_DISABLE_MODULE) -export -#endif - namespace boost::sml::inline v_2_0_0 { -namespace mp { -template -struct index_sequence { - using type = index_sequence; -}; -#if __has_builtin(__make_integer_seq) -template -struct integer_sequence; -template -struct integer_sequence { - using type = index_sequence; -}; -template -struct make_index_sequence_impl { - using type = typename __make_integer_seq::type; -}; -#else -template -struct concat; -template -struct concat, index_sequence> : index_sequence {}; -template -struct make_index_sequence_impl - : concat::type, typename make_index_sequence_impl::type>::type {}; -template <> -struct make_index_sequence_impl<0> : index_sequence<> {}; -template <> -struct make_index_sequence_impl<1> : index_sequence<0> {}; -#endif -template -using make_index_sequence = typename make_index_sequence_impl::type; - -template -auto declval() -> T&&; - -template -struct fixed_string { - static constexpr auto size = N; - - constexpr fixed_string() = default; - constexpr explicit(false) fixed_string(const char (&str)[N + 1]) { - for (auto i = 0u; i < N; ++i) { - data[i] = str[i]; - (hash ^= data[i]) <<= 1; - } - } - - constexpr auto operator*() const { - fixed_string str{}; - str.data[0] = '*'; - for (auto i = 0u; i < N; ++i) { - str.data[i + 1] = data[i]; - (str.hash ^= str.data[i + 1]) <<= 1; - } - return str; - } - - char data[N + 1]{}; - unsigned hash{}; -}; - -template -fixed_string(const char (&str)[N]) -> fixed_string; - -template -struct counters { - friend auto get(counters); - template - struct set { - friend auto get(counters) { return N; } - }; -}; - -template -[[nodiscard]] consteval auto counter_impl() { - if constexpr (requires { get(counters{}); }) { - return counter_impl(); - } else { - return Next; - } -} - -template ()> -constexpr auto counter = N; - -template -struct append; -template