-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2416 from lf-lang/disconnected-port
Fix disconnected port handling
- Loading branch information
Showing
4 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule reactor-c
updated
11 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** Testing that unconnected port does not block triggering. */ | ||
target C { | ||
logging: debug | ||
} | ||
|
||
reactor Source { | ||
output x: bool | ||
output y: bool | ||
|
||
reaction(startup) -> x, y {= | ||
lf_print("S"); | ||
lf_set(y, true); | ||
=} | ||
} | ||
|
||
reactor Destination { | ||
input y: bool | ||
|
||
state gotY: bool = false | ||
|
||
reaction(y) {= | ||
lf_print("Y"); | ||
self->gotY = true; | ||
=} | ||
|
||
reaction(shutdown) {= | ||
if (!self->gotY) { | ||
lf_print_error_and_exit("No reaction to Y!"); | ||
} | ||
=} | ||
} | ||
|
||
main reactor { | ||
ui = new Source() | ||
dlc = new Destination() | ||
|
||
ui.y -> dlc.y | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** Test that untriggered reactions are not triggered. */ | ||
target C | ||
|
||
reactor OnlySuccess { | ||
input start: bool | ||
output success: bool | ||
output failure: bool | ||
|
||
reaction(start) -> success, failure {= | ||
lf_print("Create Success"); | ||
lf_set(success, true); | ||
=} | ||
} | ||
|
||
reactor ForwardFailure { | ||
input in: bool | ||
output out: bool | ||
|
||
reaction(in) -> out {= | ||
lf_print("Forward Failure"); | ||
lf_set(out, true); | ||
=} | ||
} | ||
|
||
reactor Sequence { | ||
input start: bool | ||
output success: bool | ||
output failure: bool | ||
s = new OnlySuccess() | ||
f = new ForwardFailure() | ||
start -> s.start | ||
s.success -> success | ||
s.failure -> f.in | ||
f.out -> failure | ||
} | ||
|
||
main reactor { | ||
s = new Sequence() | ||
|
||
reaction(startup) -> s.start {= | ||
lf_print("Start"); | ||
lf_set(s.start, true); | ||
=} | ||
|
||
reaction(s.failure) {= | ||
lf_print_error_and_exit("Failure"); | ||
=} | ||
} |