Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1e51ab
Bump version number.
walkie Nov 5, 2021
3337212
Fix clippy warnings.
walkie Nov 10, 2021
6927d74
Runtime system refactor to support event history.
walkie Nov 10, 2021
e0fcfa8
Add arbitrary event callback interface.
walkie Nov 11, 2021
5b6c145
Unit tests for event tracking.
walkie Nov 11, 2021
fd91d20
Separate event sent/handled + tests and fixes.
walkie Nov 11, 2021
096f004
More event handling tests.
walkie Nov 11, 2021
0d65c5b
WIP codegen for new context/event representation
walkie Nov 15, 2021
0285c8f
Move domain variables back into machine struct.
walkie Nov 16, 2021
ef5bb6e
Add method for debugging.
walkie Nov 16, 2021
c8aae66
All non-runtime tests pass.
walkie Nov 17, 2021
1205ca0
Basic runtime test is working
walkie Nov 17, 2021
8d2e501
Getting more runtime tests working.
walkie Nov 17, 2021
7d9232c
Notify transition callbacks between exit and enter events
walkie Nov 17, 2021
9a82252
Bug fixes, more runtime tests working.
walkie Nov 17, 2021
b0f1b9f
Migrating more runtime tests.
walkie Nov 17, 2021
17f4823
Fix state stack bugs, all tests passing again!
walkie Nov 17, 2021
accc032
Minor newline fixes in generated code.
walkie Nov 18, 2021
1cc836b
Remove Send trait from callbacks.
walkie Nov 18, 2021
ca9ca5f
Use unformatted message name for Display.
walkie Nov 18, 2021
6d50578
Start working on event monitor tests.
walkie Nov 18, 2021
63699a2
Whitespace cleanup.
walkie Nov 19, 2021
52d2fcc
Test event monitor ordering.
walkie Nov 19, 2021
e17cde3
Add and use Display impl for transitions.
walkie Nov 19, 2021
45cd3dd
Add events to history when sent rather than handled
walkie Nov 19, 2021
d828f2c
Test transition and event history.
walkie Nov 19, 2021
b68ce1b
More event system tests and fixes.
walkie Nov 22, 2021
11c11db
Fix and test live smcat rendering.
walkie Nov 22, 2021
b58bd55
Use consistent names for history capacities.
walkie Nov 23, 2021
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
52 changes: 39 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Frame Language Transpiler v0.7.0
# Frame Language Transpiler v0.7.1


Hi! So very glad you are interested in Frame. Frame system design markdown language for software architects and engineers. It is an easy to learn textual language for defining system specifications that can generate both UML documentation as well as code in 7 langauges.
Expand Down
6 changes: 5 additions & 1 deletion frame_runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "frame_runtime"
version = "0.7.0"
version = "0.7.1"
authors = ["Eric Walkingshaw <eric.walkingshaw@savant.com>"]
edition = "2018"

Expand All @@ -9,3 +9,7 @@ edition = "2018"
crate-type = ["rlib"]

[dependencies]
once_cell = "1.8.0"

[dev-dependencies]
indoc = "1.0.3"
59 changes: 49 additions & 10 deletions frame_runtime/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//! name bindings.

use std::any::Any;
use std::cell::{Ref, RefCell};
use std::rc::Rc;

/// Environments associate names (i.e. variables/parameters) with values.
///
Expand All @@ -12,7 +14,7 @@ use std::any::Any;
/// It is common for a particular environment to be absent because there are no variables of the
/// kind held by that environment. We represent absent environments by an empty environment rather
/// than using an `Option` type because it simplifies the interface and because the distinction
/// between `None` and `Some(EMPTY)` is not significant.
/// between `None` and `Some(empty)` is not significant.
pub trait Environment {
/// Is this the empty environment?
fn is_empty(&self) -> bool {
Expand All @@ -22,13 +24,30 @@ pub trait Environment {
fn lookup(&self, name: &str) -> Option<&dyn Any>;
}

/// The trivial empty environment. This can be used in place of an environment when that
/// environment is absent.
pub const EMPTY: &'static dyn Environment = &EmptyEnvironment {};
/// The trivial empty enviorment. This can be used in place of an environment when that environment
/// is absent.
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub struct Empty {}

struct EmptyEnvironment {}
impl Empty {
/// Create a new empty environment.
pub fn new() -> Empty {
Empty {}
}

impl Environment for EmptyEnvironment {
/// Create a new reference-counted pointer to an empty environment.
pub fn new_rc() -> Rc<Empty> {
Rc::new(Empty::new())
}
}

impl Default for Empty {
fn default() -> Self {
Empty::new()
}
}

impl Environment for Empty {
fn is_empty(&self) -> bool {
true
}
Expand All @@ -37,6 +56,24 @@ impl Environment for EmptyEnvironment {
}
}

impl<'a, T: Environment> Environment for Ref<'a, T> {
fn is_empty(&self) -> bool {
(**self).is_empty()
}
fn lookup(&self, name: &str) -> Option<&dyn Any> {
(**self).lookup(name)
}
}

impl<T: Environment> Environment for RefCell<T> {
fn is_empty(&self) -> bool {
self.borrow().is_empty()
}
fn lookup(&self, name: &str) -> Option<&dyn Any> {
unsafe { (*self.as_ptr()).lookup(name) }
}
}

#[allow(clippy::approx_constant)]
#[cfg(test)]
mod tests {
Expand All @@ -61,14 +98,16 @@ mod tests {

#[test]
fn empty_environment_is_empty() {
assert!(EMPTY.is_empty());
let empty = Empty::new();
assert!(empty.is_empty());
}

#[test]
fn empty_environment_returns_none() {
assert!(EMPTY.lookup("x").is_none());
assert!(EMPTY.lookup("y").is_none());
assert!(EMPTY.lookup("z").is_none());
let empty = Empty::new();
assert!(empty.lookup("x").is_none());
assert!(empty.lookup("y").is_none());
assert!(empty.lookup("z").is_none());
}

#[test]
Expand Down
Loading