From 3305fc3c8027f622989a50855e5480b7f31b84fd Mon Sep 17 00:00:00 2001 From: erwanM Date: Sun, 15 Jan 2023 16:45:57 +0100 Subject: [PATCH] refactored term transformations, added optional display of local analyses, updated README, various other changes --- Cargo.lock | 2 +- Cargo.toml | 2 +- examples/readme/2/basic/asynch_broadcast.hsf | 7 - examples/readme/2/basic/asynch_passing.hsf | 7 - examples/readme/2/basic/emission.hsf | 7 - examples/readme/2/basic/reception.hsf | 7 - examples/readme/2/basic/synch_broadcast.hsf | 7 - examples/readme/2/basic/synch_passing.hsf | 7 - examples/readme/2/sched/par_diff.hsf | 10 - examples/readme/2/sched/par_same.hsf | 10 - examples/readme/2/sched/seq_diff.hsf | 10 - examples/readme/2/sched/seq_same.hsf | 10 - examples/readme/2/sched/strict_diff.hsf | 10 - examples/readme/2/sched/strict_same.hsf | 10 - readme/1_interaction.md | 4 +- readme/2_execution.md | 83 ++-- readme/examples/2/basic/COMMANDS.txt | 14 + readme/examples/2/basic/asynch_broadcast.hif | 1 + readme/examples/2/basic/asynch_broadcast.svg | 76 ++++ readme/examples/2/basic/asynch_passing.hif | 1 + readme/examples/2/basic/asynch_passing.svg | 38 ++ readme/examples/2/basic/emission.hif | 1 + readme/examples/2/basic/emission.svg | 24 ++ readme/examples/2/basic/explo.hcf | 4 + readme/examples/2/basic/reception.hif | 1 + readme/examples/2/basic/reception.svg | 24 ++ readme/examples/2/basic/sig.hsf | 2 + readme/examples/2/basic/synch_broadcast.hif | 1 + readme/examples/2/basic/synch_broadcast.svg | 24 ++ readme/examples/2/basic/synch_passing.hif | 1 + readme/examples/2/basic/synch_passing.svg | 24 ++ readme/examples/2/sched/COMMANDS.txt | 14 + readme/examples/2/sched/explo.hcf | 4 + readme/examples/2/sched/par_diff.hif | 4 + readme/examples/2/sched/par_diff.svg | 62 +++ readme/examples/2/sched/par_same.hif | 4 + readme/examples/2/sched/par_same.svg | 62 +++ readme/examples/2/sched/seq_diff.hif | 4 + readme/examples/2/sched/seq_diff.svg | 62 +++ readme/examples/2/sched/seq_same.hif | 4 + readme/examples/2/sched/seq_same.svg | 38 ++ readme/examples/2/sched/sig.hsf | 2 + readme/examples/2/sched/strict_diff.hif | 4 + readme/examples/2/sched/strict_diff.svg | 38 ++ readme/examples/2/sched/strict_same.hif | 4 + readme/examples/2/sched/strict_same.svg | 38 ++ readme/images/2/basic/asynch_broadcast.svg | 56 --- readme/images/2/basic/asynch_passing.svg | 28 -- readme/images/2/basic/emission.svg | 18 - readme/images/2/basic/reception.svg | 18 - readme/images/2/basic/synch_broadcast.svg | 364 ------------------ readme/images/2/basic/synch_passing.svg | 18 - src/core/language/include/action.rs | 57 +++ src/core/language/include/includes.rs | 24 ++ src/core/language/include/interaction.rs | 108 ++++++ src/core/language/include/mod.rs | 20 + src/core/language/mod.rs | 6 +- src/core/language/position/mod.rs | 1 + .../get_transfos/get_all_transfos.rs | 44 +-- .../get_transfos/get_one_transfo.rs | 42 +- .../get_transfos/get_transfos.rs | 42 -- src/core/transformation/get_transfos/mod.rs | 6 +- src/core/transformation/mod.rs | 8 +- src/core/transformation/transfofunc/action.rs | 2 +- .../alt_dedup_equal.rs} | 7 +- .../transfofunc/alt_dedup/alt_dedup_incl.rs | 20 + .../transfofunc/alt_dedup/mod.rs | 19 + .../transformation/transfofunc/defactorize.rs | 4 +- .../{ => factorize}/factorize_par.rs | 2 +- .../{ => factorize}/factorize_prefix.rs | 4 +- .../{ => factorize}/factorize_suffix.rs | 4 +- .../transfofunc/factorize/mod.rs | 20 + src/core/transformation/transfofunc/flush.rs | 26 +- src/core/transformation/transfofunc/invert.rs | 4 +- .../transformation/transfofunc/loop_simpl.rs | 112 +----- .../transfofunc/{ => merge}/merge_action.rs | 2 +- .../{ => merge}/merge_shift_left.rs | 4 +- .../{ => merge}/merge_shift_right.rs | 4 +- .../transfofunc/{ => merge}/merge_skip.rs | 2 +- .../{ => merge}/merge_skip_invert.rs | 2 +- .../transformation/transfofunc/merge/mod.rs | 25 ++ src/core/transformation/transfofunc/mod.rs | 14 +- .../transfofunc/{ => old}/loop_alt_simpl.rs | 0 src/core/transformation/transfofunc/simpl.rs | 2 +- src/core/transformation/transfokind.rs | 123 +++--- src/core/transformation/transfophase.rs | 61 +++ .../{transfodef.rs => transfores.rs} | 8 +- src/io/input/hcf/hcf_syntax.pest | 6 +- src/io/input/hcf/implem_ana.rs | 4 +- src/io/input/hcf/proc_options/loggers.rs | 32 ++ src/io/input/hcf/proc_options/opt_analyze.rs | 9 +- .../draw_interactions/as_sd/interface.rs | 1 - src/io/output/draw_interactions/interface.rs | 2 +- src/io/output/graphviz/graph.rs | 1 + src/loggers/graphic/conf.rs | 3 +- src/loggers/graphic/get_graph/state.rs | 18 +- src/loggers/graphic/get_graph/transition.rs | 24 +- src/loggers/graphic/get_graph/verdict.rs | 2 +- src/loggers/graphic/glog_ana.rs | 72 ++++ src/loggers/graphic/graphic_logger.rs | 19 +- src/main.rs | 1 - src/process/ana_proc/interface/logger.rs | 11 + src/process/ana_proc/logic/anakind.rs | 11 +- src/process/ana_proc/logic/local_analysis.rs | 56 ++- src/process/ana_proc/manager.rs | 71 +++- src/process/canon_proc/interface/step.rs | 16 +- src/process/canon_proc/manager.rs | 29 +- .../transformations/get_transfos.rs | 34 -- src/process/canon_proc/transformations/mod.rs | 1 - .../canon_proc/transformations/phases.rs | 65 ++-- src/ui/hibou_cli.yml | 22 +- src/ui/util/printing.rs | 2 +- 112 files changed, 1474 insertions(+), 1142 deletions(-) delete mode 100644 examples/readme/2/basic/asynch_broadcast.hsf delete mode 100644 examples/readme/2/basic/asynch_passing.hsf delete mode 100644 examples/readme/2/basic/emission.hsf delete mode 100644 examples/readme/2/basic/reception.hsf delete mode 100644 examples/readme/2/basic/synch_broadcast.hsf delete mode 100644 examples/readme/2/basic/synch_passing.hsf delete mode 100644 examples/readme/2/sched/par_diff.hsf delete mode 100644 examples/readme/2/sched/par_same.hsf delete mode 100644 examples/readme/2/sched/seq_diff.hsf delete mode 100644 examples/readme/2/sched/seq_same.hsf delete mode 100644 examples/readme/2/sched/strict_diff.hsf delete mode 100644 examples/readme/2/sched/strict_same.hsf create mode 100644 readme/examples/2/basic/COMMANDS.txt create mode 100644 readme/examples/2/basic/asynch_broadcast.hif create mode 100644 readme/examples/2/basic/asynch_broadcast.svg create mode 100644 readme/examples/2/basic/asynch_passing.hif create mode 100644 readme/examples/2/basic/asynch_passing.svg create mode 100644 readme/examples/2/basic/emission.hif create mode 100644 readme/examples/2/basic/emission.svg create mode 100644 readme/examples/2/basic/explo.hcf create mode 100644 readme/examples/2/basic/reception.hif create mode 100644 readme/examples/2/basic/reception.svg create mode 100644 readme/examples/2/basic/sig.hsf create mode 100644 readme/examples/2/basic/synch_broadcast.hif create mode 100644 readme/examples/2/basic/synch_broadcast.svg create mode 100644 readme/examples/2/basic/synch_passing.hif create mode 100644 readme/examples/2/basic/synch_passing.svg create mode 100644 readme/examples/2/sched/COMMANDS.txt create mode 100644 readme/examples/2/sched/explo.hcf create mode 100644 readme/examples/2/sched/par_diff.hif create mode 100644 readme/examples/2/sched/par_diff.svg create mode 100644 readme/examples/2/sched/par_same.hif create mode 100644 readme/examples/2/sched/par_same.svg create mode 100644 readme/examples/2/sched/seq_diff.hif create mode 100644 readme/examples/2/sched/seq_diff.svg create mode 100644 readme/examples/2/sched/seq_same.hif create mode 100644 readme/examples/2/sched/seq_same.svg create mode 100644 readme/examples/2/sched/sig.hsf create mode 100644 readme/examples/2/sched/strict_diff.hif create mode 100644 readme/examples/2/sched/strict_diff.svg create mode 100644 readme/examples/2/sched/strict_same.hif create mode 100644 readme/examples/2/sched/strict_same.svg delete mode 100644 readme/images/2/basic/asynch_broadcast.svg delete mode 100644 readme/images/2/basic/asynch_passing.svg delete mode 100644 readme/images/2/basic/emission.svg delete mode 100644 readme/images/2/basic/reception.svg delete mode 100644 readme/images/2/basic/synch_broadcast.svg delete mode 100644 readme/images/2/basic/synch_passing.svg create mode 100644 src/core/language/include/action.rs create mode 100644 src/core/language/include/includes.rs create mode 100644 src/core/language/include/interaction.rs create mode 100644 src/core/language/include/mod.rs delete mode 100644 src/core/transformation/get_transfos/get_transfos.rs rename src/core/transformation/transfofunc/{dedupl.rs => alt_dedup/alt_dedup_equal.rs} (86%) create mode 100644 src/core/transformation/transfofunc/alt_dedup/alt_dedup_incl.rs create mode 100644 src/core/transformation/transfofunc/alt_dedup/mod.rs rename src/core/transformation/transfofunc/{ => factorize}/factorize_par.rs (96%) rename src/core/transformation/transfofunc/{ => factorize}/factorize_prefix.rs (96%) rename src/core/transformation/transfofunc/{ => factorize}/factorize_suffix.rs (93%) create mode 100644 src/core/transformation/transfofunc/factorize/mod.rs rename src/core/transformation/transfofunc/{ => merge}/merge_action.rs (97%) rename src/core/transformation/transfofunc/{ => merge}/merge_shift_left.rs (95%) rename src/core/transformation/transfofunc/{ => merge}/merge_shift_right.rs (95%) rename src/core/transformation/transfofunc/{ => merge}/merge_skip.rs (97%) rename src/core/transformation/transfofunc/{ => merge}/merge_skip_invert.rs (94%) create mode 100644 src/core/transformation/transfofunc/merge/mod.rs rename src/core/transformation/transfofunc/{ => old}/loop_alt_simpl.rs (100%) create mode 100644 src/core/transformation/transfophase.rs rename src/core/transformation/{transfodef.rs => transfores.rs} (86%) delete mode 100644 src/process/canon_proc/transformations/get_transfos.rs diff --git a/Cargo.lock b/Cargo.lock index 8250565..7118fa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -355,7 +355,7 @@ dependencies = [ [[package]] name = "hibou_label" -version = "0.8.0" +version = "0.8.2" dependencies = [ "clap", "image", diff --git a/Cargo.toml b/Cargo.toml index e765162..de6bb0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hibou_label" -version = "0.8.1" +version = "0.8.2" authors = ["Erwan Mahe"] edition = "2021" diff --git a/examples/readme/2/basic/asynch_broadcast.hsf b/examples/readme/2/basic/asynch_broadcast.hsf deleted file mode 100644 index 4cdb421..0000000 --- a/examples/readme/2/basic/asynch_broadcast.hsf +++ /dev/null @@ -1,7 +0,0 @@ -@message{m} -@lifeline{lo;lt1;lt2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -lo -- m -> (lt1,lt2) diff --git a/examples/readme/2/basic/asynch_passing.hsf b/examples/readme/2/basic/asynch_passing.hsf deleted file mode 100644 index 6aa7380..0000000 --- a/examples/readme/2/basic/asynch_passing.hsf +++ /dev/null @@ -1,7 +0,0 @@ -@message{message} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -l1 -- message -> l2 diff --git a/examples/readme/2/basic/emission.hsf b/examples/readme/2/basic/emission.hsf deleted file mode 100644 index a779c77..0000000 --- a/examples/readme/2/basic/emission.hsf +++ /dev/null @@ -1,7 +0,0 @@ -@message{message} -@lifeline{lifeline} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -lifeline -- message ->| diff --git a/examples/readme/2/basic/reception.hsf b/examples/readme/2/basic/reception.hsf deleted file mode 100644 index e03488e..0000000 --- a/examples/readme/2/basic/reception.hsf +++ /dev/null @@ -1,7 +0,0 @@ -@message{message} -@lifeline{lifeline} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -message -> lifeline diff --git a/examples/readme/2/basic/synch_broadcast.hsf b/examples/readme/2/basic/synch_broadcast.hsf deleted file mode 100644 index 88c8f69..0000000 --- a/examples/readme/2/basic/synch_broadcast.hsf +++ /dev/null @@ -1,7 +0,0 @@ -@message{m} -@lifeline{lo;lt1;lt2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -lo -- m -> (lt1,lt2) diff --git a/examples/readme/2/basic/synch_passing.hsf b/examples/readme/2/basic/synch_passing.hsf deleted file mode 100644 index 26882af..0000000 --- a/examples/readme/2/basic/synch_passing.hsf +++ /dev/null @@ -1,7 +0,0 @@ -@message{m} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -l1 -- m -> l2 diff --git a/examples/readme/2/sched/par_diff.hsf b/examples/readme/2/sched/par_diff.hsf deleted file mode 100644 index 228b218..0000000 --- a/examples/readme/2/sched/par_diff.hsf +++ /dev/null @@ -1,10 +0,0 @@ -@message{m1;m2} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -par( - l1 -- m1 ->|, - l2 -- m2 ->| -) diff --git a/examples/readme/2/sched/par_same.hsf b/examples/readme/2/sched/par_same.hsf deleted file mode 100644 index 8505f02..0000000 --- a/examples/readme/2/sched/par_same.hsf +++ /dev/null @@ -1,10 +0,0 @@ -@message{m1;m2} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -par( - l1 -- m1 ->|, - l1 -- m2 ->| -) diff --git a/examples/readme/2/sched/seq_diff.hsf b/examples/readme/2/sched/seq_diff.hsf deleted file mode 100644 index 60372b8..0000000 --- a/examples/readme/2/sched/seq_diff.hsf +++ /dev/null @@ -1,10 +0,0 @@ -@message{m1;m2} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -seq( - l1 -- m1 ->|, - l2 -- m2 ->| -) diff --git a/examples/readme/2/sched/seq_same.hsf b/examples/readme/2/sched/seq_same.hsf deleted file mode 100644 index 8363849..0000000 --- a/examples/readme/2/sched/seq_same.hsf +++ /dev/null @@ -1,10 +0,0 @@ -@message{m1;m2} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -seq( - l1 -- m1 ->|, - l1 -- m2 ->| -) diff --git a/examples/readme/2/sched/strict_diff.hsf b/examples/readme/2/sched/strict_diff.hsf deleted file mode 100644 index d310ab7..0000000 --- a/examples/readme/2/sched/strict_diff.hsf +++ /dev/null @@ -1,10 +0,0 @@ -@message{m1;m2} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -strict( - l1 -- m1 ->|, - l2 -- m2 ->| -) diff --git a/examples/readme/2/sched/strict_same.hsf b/examples/readme/2/sched/strict_same.hsf deleted file mode 100644 index 83b7a73..0000000 --- a/examples/readme/2/sched/strict_same.hsf +++ /dev/null @@ -1,10 +0,0 @@ -@message{m1;m2} -@lifeline{l1;l2} -@explore_option{ - loggers = [graphic[svg,vertical]]; - strategy = DepthFS -} -strict( - l1 -- m1 ->|, - l1 -- m2 ->| -) diff --git a/readme/1_interaction.md b/readme/1_interaction.md index 5e846a5..c8d42a5 100644 --- a/readme/1_interaction.md +++ b/readme/1_interaction.md @@ -126,5 +126,5 @@ For instance, given "i" an interaction: - "loopW(i)" is equivalent to the infinite alternative "alt(∅,i,seq(i,i),...)" - "loopP(i)" is equivalent to the infinite alternative "alt(∅,i,par(i,i),...)" -"loopH" is a specific restriction of "loopW" which we documented in -"[A structural operational semantics for interactions with a look at loops](https://arxiv.org/abs/2105.00208)". \ No newline at end of file +"loopH" is a specific restriction of "loopW" which is documented in +"[Equivalence of Denotational and Operational Semantics for Interaction Languages](https://link.springer.com/chapter/10.1007/978-3-031-10363-6_8)". \ No newline at end of file diff --git a/readme/2_execution.md b/readme/2_execution.md index c3a9e8e..4cd1049 100644 --- a/readme/2_execution.md +++ b/readme/2_execution.md @@ -2,9 +2,8 @@ # The execution and animation of interaction models The main features of HIBOU revolve around the "execution" or "animation" of interaction models. -By execution we mean something which consists in executing an atomic action within an initial interaction model, thereby observing its occurrence. -The execution of such an action yields a new "follow-up" interaction model, -which specifies all the continuations of the behavior of the original interaction, which start by the occurence of the executed action. +By execution we mean executing an atomic action within an initial interaction model, thereby observing its occurrence. +The execution of such an action yields a new "follow-up" interaction model which specifies all the continuations of the behavior of the original interaction following the occurrence of the executed action. This approach is detailed in [this paper](https://link.springer.com/chapter/10.1007%2F978-3-030-45234-6_24) and [this one](https://dl.acm.org/doi/abs/10.1145/3412841.3442054). @@ -25,85 +24,91 @@ In the following, we will give some insights on the different elements of our la ## Basic building blocks -| | Initial Encoding | Animation | -|------------------|-------------------|-----------| -| atomic emission |
@message{message}
@lifeline{lifeline}
lifeline -- message ->|
| execution of an emission | -| atomic reception |
@message{message}
@lifeline{lifeline}
message -> lifeline
| execution of a reception | -| asynchronous message passing |
@message{message}
@lifeline{l1;l2}
l1 -- message -> l2
| execution of an asynchronous message passing | -| synchronous message passing |
@message{m}
@lifeline{l1;l2}
l1 -- m -> l2
| execution of a synchronous message passing | -| asynchronous broadcast |
@message{m}
@lifeline{lo;lt1;lt2}
lo -- m -> (lt1,lt2)
| execution of an asynchronous broadcast | -| synchronous broadcast |
@message{m}
@lifeline{lo;lt1;lt2}
lo -- m -> (lt1,lt2)
| execution of a synchronous broadcast | +The previously introduced basic building blocks can be executed as is represented below. +Each node in grey represents the state of the interaction at a given moment, with, on the left, its syntaxic structure, and, on the right, its representation as a sequence diagram. +Each transition corresponds to the execution/expression of an atomic action. +| | Animation | +|------------------|-----------| +| atomic emission | execution of an emission | +| atomic reception | execution of a reception | +| asynchronous message passing | execution of an asynchronous message passing | +| synchronous message passing | execution of a synchronous message passing | +| asynchronous broadcast | execution of an asynchronous broadcast | +| synchronous broadcast | execution of a synchronous broadcast | -## Alt - -Alternatives propose non-deterministic choice between several exclusive alternatives. -execution of actions within an alternative -## Strict, Seq and Par +## Alt -### Actions on the same lifeline(s) +Alternatives propose non-deterministic choice between several exclusive alternatives. -With strict sequencing: +execution of actions within an alternative - -With weak sequencing: +## Strict, Seq and Par - +Three basic scheduling operators enables us to specify successions of behaviors. -With interleaving: +"strict" corresponds to a strict sequencing operator, specifying a strict succession of behaviors. - +"seq" corresponds to a weak sequencing operator, specifying that events occurring on +the same sub-system (lifeline) must occur in a strict order +even though events occurring on different sub-systems (lifelines) may occur in any order. -### Actions on different lifelines +"par" corresponds to an interleaving operator, allowing any order between events. -With strict sequencing: - +### Actions on the same lifeline(s) -With weak sequencing: +| strict | seq | par | +|-----------------------------------------------------|--------------------------------------------------|--------------------------------------------------| +| | | | - -With interleaving: +### Actions on different lifelines - +| strict | seq | par | +|-----------------------------------------------------|--------------------------------------------------|--------------------------------------------------| +| | | | ## Coreg -As explained previously, a coretion behaves as par on certain lifelines and as seq on the others. -Here, we can see that: +A coregion behaves as "par" on certain lifelines and as "seq" on the others. +In the example, we can see that: - l1 must emit m1 before it can emit m2 because the coregion behaves as seq on l1 - and l2 can receive m1 and m2 in any order because the coregion behaves as par on l2 - + ## Pruning -The interplay between alternatives and sequencing makes so that the execution of certain actions -implicitly imply making certain choices on alternatives. +The interplay between alternatives and sequencing makes so that the execution of certain actions implicitly imply making certain choices on alternatives. This must be taken into account when computing the corresponding follow-up interaction. - +This is done via a mechanism of pruning which is illustrated with the two examples below. -Another example with a coregion: +In the first one, we have an alternative in which we have either the passing of message "m1" or nothing, which is followed by the emission of "m2". +If the first thing that occur is the emission of "m2" then it is impossible to observe "m1" later on. +Hence, when executing the emission of "m2", this part of the diagram must be pruned out. - +In the second example the pruning of the broadcast of "m1" only occur when it is "l3" which emits "m2" because there is a coregion on "l2" which would allow both orders on the event. +| example 1 | example 2 | +|-----------|-----------| +| | | ## Loops Loops specify repetitions of behavior. -Please refer to "[A structural operational semantics for interactions with a look at loops](https://arxiv.org/abs/2105.00208)" for further details. +Please refer to "[Equivalence of Denotational and Operational Semantics for Interaction Languages](https://link.springer.com/chapter/10.1007/978-3-031-10363-6_8)" for further details. Below we demonstrate the difference between loopH and loopW on an example: diff --git a/readme/examples/2/basic/COMMANDS.txt b/readme/examples/2/basic/COMMANDS.txt new file mode 100644 index 0000000..3f7ab3a --- /dev/null +++ b/readme/examples/2/basic/COMMANDS.txt @@ -0,0 +1,14 @@ +(.\hibou_label.exe explore sig.hsf asynch_broadcast.hif explo.hcf) -and (Rename-Item explo_l1.svg asynch_broadcast.svg) +(.\hibou_label.exe explore sig.hsf asynch_passing.hif explo.hcf) -and (Rename-Item explo_l1.svg asynch_passing.svg) +(.\hibou_label.exe explore sig.hsf emission.hif explo.hcf) -and (Rename-Item explo_l1.svg emission.svg) +(.\hibou_label.exe explore sig.hsf reception.hif explo.hcf) -and (Rename-Item explo_l1.svg reception.svg) +(.\hibou_label.exe explore sig.hsf synch_broadcast.hif explo.hcf) -and (Rename-Item explo_l1.svg synch_broadcast.svg) +(.\hibou_label.exe explore sig.hsf synch_passing.hif explo.hcf) -and (Rename-Item explo_l1.svg synch_passing.svg) + + +hibou_label explore sig.hsf asynch_broadcast.hif explo.hcf && mv explo_l1.svg asynch_broadcast.svg +hibou_label explore sig.hsf asynch_passing.hif explo.hcf && mv explo_l1.svg asynch_passing.svg +hibou_label explore sig.hsf emission.hif explo.hcf && mv explo_l1.svg emission.svg +hibou_label explore sig.hsf reception.hif explo.hcf && mv explo_l1.svg reception.svg +hibou_label explore sig.hsf synch_broadcast.hif explo.hcf && mv explo_l1.svg synch_broadcast.svg +hibou_label explore sig.hsf synch_passing.hif explo.hcf&& mv explo_l1.svg synch_passing.svg diff --git a/readme/examples/2/basic/asynch_broadcast.hif b/readme/examples/2/basic/asynch_broadcast.hif new file mode 100644 index 0000000..533e442 --- /dev/null +++ b/readme/examples/2/basic/asynch_broadcast.hif @@ -0,0 +1 @@ +lo -- m -> (lt1,lt2) diff --git a/readme/examples/2/basic/asynch_broadcast.svg b/readme/examples/2/basic/asynch_broadcast.svg new file mode 100644 index 0000000..0a489e5 --- /dev/null +++ b/readme/examples/2/basic/asynch_broadcast.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/basic/asynch_passing.hif b/readme/examples/2/basic/asynch_passing.hif new file mode 100644 index 0000000..66c4247 --- /dev/null +++ b/readme/examples/2/basic/asynch_passing.hif @@ -0,0 +1 @@ +l1 -- message -> l2 diff --git a/readme/examples/2/basic/asynch_passing.svg b/readme/examples/2/basic/asynch_passing.svg new file mode 100644 index 0000000..73112f3 --- /dev/null +++ b/readme/examples/2/basic/asynch_passing.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/basic/emission.hif b/readme/examples/2/basic/emission.hif new file mode 100644 index 0000000..1aae029 --- /dev/null +++ b/readme/examples/2/basic/emission.hif @@ -0,0 +1 @@ +lifeline -- message ->| diff --git a/readme/examples/2/basic/emission.svg b/readme/examples/2/basic/emission.svg new file mode 100644 index 0000000..c4fbe5b --- /dev/null +++ b/readme/examples/2/basic/emission.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/basic/explo.hcf b/readme/examples/2/basic/explo.hcf new file mode 100644 index 0000000..fa12d28 --- /dev/null +++ b/readme/examples/2/basic/explo.hcf @@ -0,0 +1,4 @@ +@explore_option{ + loggers = [graphic[svg,vertical,draw_legend=false,draw_sd=true,draw_tt=true]]; + strategy = DFS +} \ No newline at end of file diff --git a/readme/examples/2/basic/reception.hif b/readme/examples/2/basic/reception.hif new file mode 100644 index 0000000..9e1b68c --- /dev/null +++ b/readme/examples/2/basic/reception.hif @@ -0,0 +1 @@ +message -> lifeline diff --git a/readme/examples/2/basic/reception.svg b/readme/examples/2/basic/reception.svg new file mode 100644 index 0000000..dc49a76 --- /dev/null +++ b/readme/examples/2/basic/reception.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/basic/sig.hsf b/readme/examples/2/basic/sig.hsf new file mode 100644 index 0000000..50c997c --- /dev/null +++ b/readme/examples/2/basic/sig.hsf @@ -0,0 +1,2 @@ +@message{m;message} +@lifeline{lo;lt1;lt2;l1;l2;lifeline} \ No newline at end of file diff --git a/readme/examples/2/basic/synch_broadcast.hif b/readme/examples/2/basic/synch_broadcast.hif new file mode 100644 index 0000000..c7fc036 --- /dev/null +++ b/readme/examples/2/basic/synch_broadcast.hif @@ -0,0 +1 @@ +lo -- m -> (lt1,lt2) diff --git a/readme/examples/2/basic/synch_broadcast.svg b/readme/examples/2/basic/synch_broadcast.svg new file mode 100644 index 0000000..786cb0a --- /dev/null +++ b/readme/examples/2/basic/synch_broadcast.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/basic/synch_passing.hif b/readme/examples/2/basic/synch_passing.hif new file mode 100644 index 0000000..47fcae9 --- /dev/null +++ b/readme/examples/2/basic/synch_passing.hif @@ -0,0 +1 @@ +l1 -- m -> l2 diff --git a/readme/examples/2/basic/synch_passing.svg b/readme/examples/2/basic/synch_passing.svg new file mode 100644 index 0000000..528f86d --- /dev/null +++ b/readme/examples/2/basic/synch_passing.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/sched/COMMANDS.txt b/readme/examples/2/sched/COMMANDS.txt new file mode 100644 index 0000000..f38352f --- /dev/null +++ b/readme/examples/2/sched/COMMANDS.txt @@ -0,0 +1,14 @@ +(.\hibou_label.exe explore sig.hsf strict_same.hif explo.hcf) -and (Rename-Item explo_l1.svg strict_same.svg) +(.\hibou_label.exe explore sig.hsf seq_same.hif explo.hcf) -and (Rename-Item explo_l1.svg seq_same.svg) +(.\hibou_label.exe explore sig.hsf par_same.hif explo.hcf) -and (Rename-Item explo_l1.svg par_same.svg) +(.\hibou_label.exe explore sig.hsf strict_diff.hif explo.hcf) -and (Rename-Item explo_l1.svg strict_diff.svg) +(.\hibou_label.exe explore sig.hsf seq_diff.hif explo.hcf) -and (Rename-Item explo_l1.svg seq_diff.svg) +(.\hibou_label.exe explore sig.hsf par_diff.hif explo.hcf) -and (Rename-Item explo_l1.svg par_diff.svg) + + +hibou_label explore sig.hsf strict_same.hif explo.hcf && mv explo_l1.svg strict_same.svg +hibou_label explore sig.hsf seq_same.hif explo.hcf && mv explo_l1.svg seq_same.svg +hibou_label explore sig.hsf par_same.hif explo.hcf && mv explo_l1.svg par_same.svg +hibou_label explore sig.hsf strict_diff.hif explo.hcf && mv explo_l1.svg strict_diff.svg +hibou_label explore sig.hsf seq_diff.hif explo.hcf && mv explo_l1.svg seq_diff.svg +hibou_label explore sig.hsf par_diff.hif explo.hcf&& mv explo_l1.svg par_diff.svg diff --git a/readme/examples/2/sched/explo.hcf b/readme/examples/2/sched/explo.hcf new file mode 100644 index 0000000..fa12d28 --- /dev/null +++ b/readme/examples/2/sched/explo.hcf @@ -0,0 +1,4 @@ +@explore_option{ + loggers = [graphic[svg,vertical,draw_legend=false,draw_sd=true,draw_tt=true]]; + strategy = DFS +} \ No newline at end of file diff --git a/readme/examples/2/sched/par_diff.hif b/readme/examples/2/sched/par_diff.hif new file mode 100644 index 0000000..6e63a3d --- /dev/null +++ b/readme/examples/2/sched/par_diff.hif @@ -0,0 +1,4 @@ +par( + l1 -- m1 ->|, + l2 -- m2 ->| +) diff --git a/readme/examples/2/sched/par_diff.svg b/readme/examples/2/sched/par_diff.svg new file mode 100644 index 0000000..bb70701 --- /dev/null +++ b/readme/examples/2/sched/par_diff.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/sched/par_same.hif b/readme/examples/2/sched/par_same.hif new file mode 100644 index 0000000..cb496e7 --- /dev/null +++ b/readme/examples/2/sched/par_same.hif @@ -0,0 +1,4 @@ +par( + l1 -- m1 ->|, + l1 -- m2 ->| +) diff --git a/readme/examples/2/sched/par_same.svg b/readme/examples/2/sched/par_same.svg new file mode 100644 index 0000000..867d754 --- /dev/null +++ b/readme/examples/2/sched/par_same.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/sched/seq_diff.hif b/readme/examples/2/sched/seq_diff.hif new file mode 100644 index 0000000..b31b8d1 --- /dev/null +++ b/readme/examples/2/sched/seq_diff.hif @@ -0,0 +1,4 @@ +seq( + l1 -- m1 ->|, + l2 -- m2 ->| +) diff --git a/readme/examples/2/sched/seq_diff.svg b/readme/examples/2/sched/seq_diff.svg new file mode 100644 index 0000000..6fa1ca3 --- /dev/null +++ b/readme/examples/2/sched/seq_diff.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/sched/seq_same.hif b/readme/examples/2/sched/seq_same.hif new file mode 100644 index 0000000..d45600b --- /dev/null +++ b/readme/examples/2/sched/seq_same.hif @@ -0,0 +1,4 @@ +seq( + l1 -- m1 ->|, + l1 -- m2 ->| +) diff --git a/readme/examples/2/sched/seq_same.svg b/readme/examples/2/sched/seq_same.svg new file mode 100644 index 0000000..9798d36 --- /dev/null +++ b/readme/examples/2/sched/seq_same.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/sched/sig.hsf b/readme/examples/2/sched/sig.hsf new file mode 100644 index 0000000..6b353d2 --- /dev/null +++ b/readme/examples/2/sched/sig.hsf @@ -0,0 +1,2 @@ +@message{m1;m2} +@lifeline{l1;l2} \ No newline at end of file diff --git a/readme/examples/2/sched/strict_diff.hif b/readme/examples/2/sched/strict_diff.hif new file mode 100644 index 0000000..2a475fd --- /dev/null +++ b/readme/examples/2/sched/strict_diff.hif @@ -0,0 +1,4 @@ +strict( + l1 -- m1 ->|, + l2 -- m2 ->| +) diff --git a/readme/examples/2/sched/strict_diff.svg b/readme/examples/2/sched/strict_diff.svg new file mode 100644 index 0000000..b07edae --- /dev/null +++ b/readme/examples/2/sched/strict_diff.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/examples/2/sched/strict_same.hif b/readme/examples/2/sched/strict_same.hif new file mode 100644 index 0000000..a49569c --- /dev/null +++ b/readme/examples/2/sched/strict_same.hif @@ -0,0 +1,4 @@ +strict( + l1 -- m1 ->|, + l1 -- m2 ->| +) diff --git a/readme/examples/2/sched/strict_same.svg b/readme/examples/2/sched/strict_same.svg new file mode 100644 index 0000000..850e56f --- /dev/null +++ b/readme/examples/2/sched/strict_same.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/readme/images/2/basic/asynch_broadcast.svg b/readme/images/2/basic/asynch_broadcast.svg deleted file mode 100644 index 13dd89c..0000000 --- a/readme/images/2/basic/asynch_broadcast.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/readme/images/2/basic/asynch_passing.svg b/readme/images/2/basic/asynch_passing.svg deleted file mode 100644 index ed454f5..0000000 --- a/readme/images/2/basic/asynch_passing.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/readme/images/2/basic/emission.svg b/readme/images/2/basic/emission.svg deleted file mode 100644 index 73f4d34..0000000 --- a/readme/images/2/basic/emission.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/readme/images/2/basic/reception.svg b/readme/images/2/basic/reception.svg deleted file mode 100644 index 3670c68..0000000 --- a/readme/images/2/basic/reception.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/readme/images/2/basic/synch_broadcast.svg b/readme/images/2/basic/synch_broadcast.svg deleted file mode 100644 index 9655f77..0000000 --- a/readme/images/2/basic/synch_broadcast.svg +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/readme/images/2/basic/synch_passing.svg b/readme/images/2/basic/synch_passing.svg deleted file mode 100644 index b342af7..0000000 --- a/readme/images/2/basic/synch_passing.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/core/language/include/action.rs b/src/core/language/include/action.rs new file mode 100644 index 0000000..7645734 --- /dev/null +++ b/src/core/language/include/action.rs @@ -0,0 +1,57 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +use std::collections::HashSet; +use crate::core::language::include::includes::PartialSemanticInclusion; +use crate::core::language::syntax::action::{EmissionAction, EmissionTargetRef}; + + +impl PartialSemanticInclusion for EmissionAction { + + fn is_included(&self, other: &Self) -> bool { + if self.ms_id != other.ms_id { + return false; + } + if self.origin_lf_id != other.origin_lf_id { + return false; + } + // *** + let self_target_lfs : Vec = self.targets.iter().filter_map(|x| match x { + EmissionTargetRef::Lifeline(x_lf) => {Some(x_lf)}, + _ => {None} + }).collect(); + let other_target_lfs : Vec = other.targets.iter().filter_map(|x| match x { + EmissionTargetRef::Lifeline(x_lf) => {Some(x_lf)}, + _ => {None} + }).collect(); + // *** + let self_target_lfs_as_set : HashSet = HashSet::from_iter(self_target_lfs.into_iter()); + let other_target_lfs_as_set : HashSet = HashSet::from_iter(other_target_lfs.into_iter()); + if !other_target_lfs_as_set.is_superset(&self_target_lfs_as_set) { + return false; + } + // *** + if self_target_lfs_as_set.len() > 0 { + if self.synchronicity != other.synchronicity { + return false; + } + } + // *** + return true; + } + +} + diff --git a/src/core/language/include/includes.rs b/src/core/language/include/includes.rs new file mode 100644 index 0000000..7c12d38 --- /dev/null +++ b/src/core/language/include/includes.rs @@ -0,0 +1,24 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + + + +pub trait PartialSemanticInclusion { + + fn is_included(&self, other : &Self) -> bool; + +} diff --git a/src/core/language/include/interaction.rs b/src/core/language/include/interaction.rs new file mode 100644 index 0000000..970db29 --- /dev/null +++ b/src/core/language/include/interaction.rs @@ -0,0 +1,108 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +use crate::core::language::include::includes::PartialSemanticInclusion; +use crate::core::language::syntax::action::EmissionAction; +use crate::core::language::syntax::interaction::Interaction; + +impl PartialSemanticInclusion for Interaction { + + fn is_included(&self, other: &Self) -> bool { + if self == other { + return true; + } + match self { + Interaction::Empty => { + return other.express_empty(); + }, + Interaction::Emission(em_act) => { + return is_emission_included_in_interaction(em_act,other); + } + } + } + +} + + + +fn is_emission_included_in_interaction(em_act : &EmissionAction, interaction : &Interaction) -> bool { + match interaction { + Interaction::Empty => { + return false; + }, + Interaction::Emission(em_act2) => { + return em_act.is_included(em_act2); + }, + Interaction::Reception(_) => { + return false; + }, + Interaction::Loop(_,i1) => { + return is_emission_included_in_interaction(em_act,i1); + }, + Interaction::Strict(i1,i2) => { + if i1.express_empty() && is_emission_included_in_interaction(em_act,i2) { + return true; + } + if i2.express_empty() && is_emission_included_in_interaction(em_act,i1) { + return true; + } + return false; + }, + Interaction::Seq(i1,i2) => { + if i1.express_empty() && is_emission_included_in_interaction(em_act,i2) { + return true; + } + if i2.express_empty() && is_emission_included_in_interaction(em_act,i1) { + return true; + } + return false; + }, + Interaction::CoReg(_,i1,i2) => { + if i1.express_empty() && is_emission_included_in_interaction(em_act,i2) { + return true; + } + if i2.express_empty() && is_emission_included_in_interaction(em_act,i1) { + return true; + } + return false; + }, + Interaction::Par(i1,i2) => { + if i1.express_empty() && is_emission_included_in_interaction(em_act,i2) { + return true; + } + if i2.express_empty() && is_emission_included_in_interaction(em_act,i1) { + return true; + } + return false; + }, + Interaction::Alt(i1,i2) => { + if is_emission_included_in_interaction(em_act,i2) { + return true; + } + if is_emission_included_in_interaction(em_act,i1) { + return true; + } + return false; + }, + Interaction::And(_,_) => { + panic!(); + } + } +} + + + + diff --git a/src/core/language/include/mod.rs b/src/core/language/include/mod.rs new file mode 100644 index 0000000..138a1b5 --- /dev/null +++ b/src/core/language/include/mod.rs @@ -0,0 +1,20 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +pub mod includes; +//mod action; +//mod interaction; \ No newline at end of file diff --git a/src/core/language/mod.rs b/src/core/language/mod.rs index b79f1ba..6d03c0d 100644 --- a/src/core/language/mod.rs +++ b/src/core/language/mod.rs @@ -22,4 +22,8 @@ pub mod position; pub mod avoid; pub mod prune; pub mod unfold; -mod ord; \ No newline at end of file +//pub mod include; +mod ord; + + + diff --git a/src/core/language/position/mod.rs b/src/core/language/position/mod.rs index 063a7ac..d46eb20 100644 --- a/src/core/language/position/mod.rs +++ b/src/core/language/position/mod.rs @@ -16,3 +16,4 @@ limitations under the License. pub mod position; pub mod at_pos_tools; +//pub mod symbols; diff --git a/src/core/transformation/get_transfos/get_all_transfos.rs b/src/core/transformation/get_transfos/get_all_transfos.rs index 8c7cdb8..f8097c8 100644 --- a/src/core/transformation/get_transfos/get_all_transfos.rs +++ b/src/core/transformation/get_transfos/get_all_transfos.rs @@ -19,12 +19,12 @@ limitations under the License. use crate::core::language::position::position::Position; use crate::core::language::syntax::interaction::Interaction; -use crate::core::transformation::transfodef::InteractionTransformation; +use crate::core::transformation::transfores::InteractionTransformationResult; use crate::core::transformation::transfokind::InteractionTransformationKind; -pub fn get_all_transformations_rec(transfos : &Vec<(InteractionTransformationKind, &dyn Fn(&Interaction) -> Vec)>, - interaction : &Interaction) -> Vec { +pub fn get_all_transformations_rec(transfos : &Vec, + interaction : &Interaction) -> Vec { let mut results = get_all_transformations_inner(transfos,interaction); match interaction { &Interaction::Empty => { @@ -35,85 +35,85 @@ pub fn get_all_transformations_rec(transfos : &Vec<(InteractionTransformationKin // *** }, &Interaction::Strict(ref i1, ref i2) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Strict(Box::new(left_transfo.result),i2.clone()) ) ); } for right_transfo in get_all_transformations_rec(transfos,i2) { - results.push( InteractionTransformation::new(right_transfo.kind, + results.push( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Strict(i1.clone(), Box::new(right_transfo.result)) ) ); } }, &Interaction::Seq(ref i1, ref i2) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Seq(Box::new(left_transfo.result),i2.clone()) ) ); } for right_transfo in get_all_transformations_rec(transfos,i2) { - results.push( InteractionTransformation::new(right_transfo.kind, + results.push( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Seq(i1.clone(), Box::new(right_transfo.result)) ) ); } }, &Interaction::CoReg(ref cr, ref i1, ref i2) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::CoReg(cr.clone(), Box::new(left_transfo.result),i2.clone()) ) ); } for right_transfo in get_all_transformations_rec(transfos,i2) { - results.push( InteractionTransformation::new(right_transfo.kind, + results.push( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::CoReg(cr.clone(), i1.clone(), Box::new(right_transfo.result)) ) ); } }, &Interaction::Par(ref i1, ref i2) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Par(Box::new(left_transfo.result),i2.clone()) ) ); } for right_transfo in get_all_transformations_rec(transfos,i2) { - results.push( InteractionTransformation::new(right_transfo.kind, + results.push( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Par(i1.clone(), Box::new(right_transfo.result)) ) ); } }, &Interaction::Alt(ref i1, ref i2) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Alt(Box::new(left_transfo.result),i2.clone()) ) ); } for right_transfo in get_all_transformations_rec(transfos,i2) { - results.push( InteractionTransformation::new(right_transfo.kind, + results.push( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Alt(i1.clone(), Box::new(right_transfo.result)) ) ); } }, &Interaction::Loop(ref lk, ref i1) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Loop(lk.clone(), Box::new(left_transfo.result)) ) ); } }, &Interaction::And(ref i1, ref i2) => { for left_transfo in get_all_transformations_rec(transfos,i1) { - results.push( InteractionTransformation::new(left_transfo.kind, + results.push( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Strict(Box::new(left_transfo.result),i2.clone()) ) ); } for right_transfo in get_all_transformations_rec(transfos,i2) { - results.push( InteractionTransformation::new(right_transfo.kind, + results.push( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Strict(i1.clone(), Box::new(right_transfo.result)) ) ); @@ -123,13 +123,13 @@ pub fn get_all_transformations_rec(transfos : &Vec<(InteractionTransformationKin return results; } -fn get_all_transformations_inner(transfos : &Vec<(InteractionTransformationKind, &dyn Fn(&Interaction) -> Vec)>, - interaction : &Interaction) -> Vec { +fn get_all_transformations_inner(transfos : &Vec, + interaction : &Interaction) -> Vec { - let mut results : Vec = Vec::new(); - for (transfo_kind, transfo_func) in transfos { - let new_transfos : Vec = transfo_func(interaction) - .into_iter().map(|x| InteractionTransformation::new((*transfo_kind).clone(),Position::Epsilon(None),x)).collect(); + let mut results : Vec = Vec::new(); + for transfo_kind in transfos { + let new_transfos : Vec = transfo_kind.get_transformation()(interaction) + .into_iter().map(|x| InteractionTransformationResult::new((*transfo_kind).clone(),Position::Epsilon(None),x)).collect(); results.extend(new_transfos); } return results; diff --git a/src/core/transformation/get_transfos/get_one_transfo.rs b/src/core/transformation/get_transfos/get_one_transfo.rs index cea2283..57a3785 100644 --- a/src/core/transformation/get_transfos/get_one_transfo.rs +++ b/src/core/transformation/get_transfos/get_one_transfo.rs @@ -19,12 +19,12 @@ limitations under the License. use crate::core::language::syntax::interaction::{Interaction}; use crate::core::language::position::position::Position; -use crate::core::transformation::transfodef::InteractionTransformation; +use crate::core::transformation::transfores::InteractionTransformationResult; use crate::core::transformation::transfokind::InteractionTransformationKind; -pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind, &dyn Fn(&Interaction) -> Vec)>, - interaction : &Interaction) -> Option { +pub fn get_one_transformation_rec(transfos : &Vec, + interaction : &Interaction) -> Option { match get_one_transformation_inner(transfos,interaction) { Some( got_transfo ) => { return Some(got_transfo); @@ -40,7 +40,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::Strict(ref i1, ref i2) => { match get_one_transformation_rec(transfos,i1) { Some(left_transfo) => { - return Some( InteractionTransformation::new(left_transfo.kind, + return Some( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Strict(Box::new(left_transfo.result),i2.clone())) ); }, @@ -48,7 +48,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } match get_one_transformation_rec(transfos,i2) { Some(right_transfo) => { - return Some( InteractionTransformation::new(right_transfo.kind, + return Some( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Strict(i1.clone(), Box::new(right_transfo.result))) ); }, @@ -57,7 +57,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::Seq(ref i1, ref i2) => { match get_one_transformation_rec(transfos,i1) { Some(left_transfo) => { - return Some( InteractionTransformation::new(left_transfo.kind, + return Some( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Seq(Box::new(left_transfo.result),i2.clone())) ); }, @@ -65,7 +65,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } match get_one_transformation_rec(transfos,i2) { Some(right_transfo) => { - return Some( InteractionTransformation::new(right_transfo.kind, + return Some( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Seq(i1.clone(), Box::new(right_transfo.result))) ); }, @@ -74,7 +74,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::CoReg(ref cr, ref i1, ref i2) => { match get_one_transformation_rec(transfos,i1) { Some(left_transfo) => { - return Some( InteractionTransformation::new(left_transfo.kind, + return Some( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::CoReg(cr.clone(), Box::new(left_transfo.result),i2.clone())) ); }, @@ -82,7 +82,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } match get_one_transformation_rec(transfos,i2) { Some(right_transfo) => { - return Some( InteractionTransformation::new(right_transfo.kind, + return Some( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::CoReg(cr.clone(), i1.clone(), Box::new(right_transfo.result))) ); }, @@ -91,7 +91,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::Par(ref i1, ref i2) => { match get_one_transformation_rec(transfos,i1) { Some(left_transfo) => { - return Some( InteractionTransformation::new(left_transfo.kind, + return Some( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Par(Box::new(left_transfo.result),i2.clone())) ); }, @@ -99,7 +99,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } match get_one_transformation_rec(transfos,i2) { Some(right_transfo) => { - return Some( InteractionTransformation::new(right_transfo.kind, + return Some( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Par(i1.clone(), Box::new(right_transfo.result))) ); }, @@ -108,7 +108,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::Alt(ref i1, ref i2) => { match get_one_transformation_rec(transfos,i1) { Some(left_transfo) => { - return Some( InteractionTransformation::new(left_transfo.kind, + return Some( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Alt(Box::new(left_transfo.result),i2.clone())) ); }, @@ -116,7 +116,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } match get_one_transformation_rec(transfos,i2) { Some(right_transfo) => { - return Some( InteractionTransformation::new(right_transfo.kind, + return Some( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Alt(i1.clone(), Box::new(right_transfo.result))) ); }, @@ -125,7 +125,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::Loop(ref lk, ref i1) => { match get_one_transformation_rec(transfos,i1) { Some(sub_transfo) => { - return Some( InteractionTransformation::new(sub_transfo.kind, + return Some( InteractionTransformationResult::new(sub_transfo.kind, Position::Left(Box::new(sub_transfo.position)), Interaction::Loop(lk.clone(), Box::new(sub_transfo.result))) ); }, @@ -134,7 +134,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind }, &Interaction::And(ref i1, ref i2) => { match get_one_transformation_rec(transfos,i1) { Some(left_transfo) => { - return Some( InteractionTransformation::new(left_transfo.kind, + return Some( InteractionTransformationResult::new(left_transfo.kind, Position::Left(Box::new(left_transfo.position)), Interaction::Strict(Box::new(left_transfo.result),i2.clone())) ); }, @@ -142,7 +142,7 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } match get_one_transformation_rec(transfos,i2) { Some(right_transfo) => { - return Some( InteractionTransformation::new(right_transfo.kind, + return Some( InteractionTransformationResult::new(right_transfo.kind, Position::Right(Box::new(right_transfo.position)), Interaction::Strict(i1.clone(), Box::new(right_transfo.result))) ); }, @@ -156,11 +156,11 @@ pub fn get_one_transformation_rec(transfos : &Vec<(InteractionTransformationKind } -fn get_one_transformation_inner(transfos : &Vec<(InteractionTransformationKind, &dyn Fn(&Interaction) -> Vec)>, - interaction : &Interaction) -> Option { - for (transfo_kind, transfo_func) in transfos { - let mut new_transfos : Vec = transfo_func(interaction) - .into_iter().map(|x| InteractionTransformation::new((*transfo_kind).clone(),Position::Epsilon(None),x)).collect(); +fn get_one_transformation_inner(transfos : &Vec, + interaction : &Interaction) -> Option { + for transfo_kind in transfos { + let mut new_transfos : Vec = transfo_kind.get_transformation()(interaction) + .into_iter().map(|x| InteractionTransformationResult::new((*transfo_kind).clone(),Position::Epsilon(None),x)).collect(); if new_transfos.len() > 0 { return Some(new_transfos.remove(0)); } diff --git a/src/core/transformation/get_transfos/get_transfos.rs b/src/core/transformation/get_transfos/get_transfos.rs deleted file mode 100644 index da25ceb..0000000 --- a/src/core/transformation/get_transfos/get_transfos.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2020 Erwan Mahe (github.com/erwanM974) - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -use crate::core::language::syntax::interaction::Interaction; -use crate::core::transformation::get_transfos::get_all_transfos::get_all_transformations_rec; -use crate::core::transformation::get_transfos::get_one_transfo::get_one_transformation_rec; -use crate::core::transformation::transfodef::InteractionTransformation; -use crate::core::transformation::transfokind::InteractionTransformationKind; - - -pub fn get_transfos(interaction : &Interaction, - get_all : bool, - transfos : &Vec<(InteractionTransformationKind, &dyn Fn(&Interaction) -> Vec)>) - -> Vec { - if get_all { - return get_all_transformations_rec(transfos,interaction); - } else { - match get_one_transformation_rec(transfos,interaction) { - None => { - return Vec::new(); - }, - Some( got ) => { - return vec![got]; - } - } - } -} - diff --git a/src/core/transformation/get_transfos/mod.rs b/src/core/transformation/get_transfos/mod.rs index bbeab74..a77a9f4 100644 --- a/src/core/transformation/get_transfos/mod.rs +++ b/src/core/transformation/get_transfos/mod.rs @@ -15,7 +15,5 @@ limitations under the License. */ -mod get_all_transfos; -mod get_one_transfo; - -pub mod get_transfos; \ No newline at end of file +pub mod get_all_transfos; +pub mod get_one_transfo; \ No newline at end of file diff --git a/src/core/transformation/mod.rs b/src/core/transformation/mod.rs index 4c7bc4e..dbcf118 100644 --- a/src/core/transformation/mod.rs +++ b/src/core/transformation/mod.rs @@ -16,7 +16,9 @@ limitations under the License. pub mod transfokind; -pub mod transfodef; - pub mod transfofunc; -pub mod get_transfos; +pub mod transfores; +mod get_transfos; + +pub mod transfophase; + diff --git a/src/core/transformation/transfofunc/action.rs b/src/core/transformation/transfofunc/action.rs index 005062e..fcd4fd2 100644 --- a/src/core/transformation/transfofunc/action.rs +++ b/src/core/transformation/transfofunc/action.rs @@ -20,7 +20,7 @@ limitations under the License. use crate::core::language::syntax::action::{EmissionAction, ReceptionAction}; use crate::core::language::syntax::interaction::Interaction; -pub fn sort_action_content(interaction : &Interaction) -> Vec { +pub fn transfo_sort_action_content(interaction : &Interaction) -> Vec { match interaction { &Interaction::Emission(ref em_act) => { let mut new_targets = em_act.targets.clone(); diff --git a/src/core/transformation/transfofunc/dedupl.rs b/src/core/transformation/transfofunc/alt_dedup/alt_dedup_equal.rs similarity index 86% rename from src/core/transformation/transfofunc/dedupl.rs rename to src/core/transformation/transfofunc/alt_dedup/alt_dedup_equal.rs index c9f8f72..9a21ba0 100644 --- a/src/core/transformation/transfofunc/dedupl.rs +++ b/src/core/transformation/transfofunc/alt_dedup/alt_dedup_equal.rs @@ -19,10 +19,10 @@ limitations under the License. use std::collections::HashSet; use itertools::Itertools; use crate::core::language::syntax::interaction::Interaction; -use crate::core::language::syntax::util::fold_recursive_frags::{fold_recursive_alt_frags, fold_recursive_par_frags}; +use crate::core::language::syntax::util::fold_recursive_frags::fold_recursive_alt_frags; use crate::core::language::syntax::util::get_recursive_frag::get_recursive_alt_frags; -pub fn deduplicate(interaction : &Interaction) -> Vec { +pub fn transfo_deduplicate(interaction : &Interaction) -> Vec { let orig_alt_frags = get_recursive_alt_frags(interaction); let as_set : HashSet<&Interaction> = HashSet::from_iter(orig_alt_frags.iter().cloned()); if as_set.len() < orig_alt_frags.len() { @@ -32,6 +32,3 @@ pub fn deduplicate(interaction : &Interaction) -> Vec { return vec![]; } } - - - diff --git a/src/core/transformation/transfofunc/alt_dedup/alt_dedup_incl.rs b/src/core/transformation/transfofunc/alt_dedup/alt_dedup_incl.rs new file mode 100644 index 0000000..91035ca --- /dev/null +++ b/src/core/transformation/transfofunc/alt_dedup/alt_dedup_incl.rs @@ -0,0 +1,20 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +//TODO: define semantic inclusion and then use that rather than equality to simplify alternatives +// i.e. instead of alt(x,x) -> x modulo AC +// rather have alt(y,x) -> x | y ⊆ x modulo AC diff --git a/src/core/transformation/transfofunc/alt_dedup/mod.rs b/src/core/transformation/transfofunc/alt_dedup/mod.rs new file mode 100644 index 0000000..f2dbec2 --- /dev/null +++ b/src/core/transformation/transfofunc/alt_dedup/mod.rs @@ -0,0 +1,19 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +pub mod alt_dedup_equal; + diff --git a/src/core/transformation/transfofunc/defactorize.rs b/src/core/transformation/transfofunc/defactorize.rs index e5177a3..2ce580b 100644 --- a/src/core/transformation/transfofunc/defactorize.rs +++ b/src/core/transformation/transfofunc/defactorize.rs @@ -19,7 +19,7 @@ limitations under the License. use crate::core::language::syntax::interaction::Interaction; -pub fn defactorize_left(interaction : &Interaction) -> Vec { +pub fn transfo_defactorize_left(interaction : &Interaction) -> Vec { match interaction { &Interaction::Strict(ref i1, ref i2) => { match **i2 { @@ -68,7 +68,7 @@ pub fn defactorize_left(interaction : &Interaction) -> Vec { -pub fn defactorize_right(interaction : &Interaction) -> Vec { +pub fn transfo_defactorize_right(interaction : &Interaction) -> Vec { match interaction { &Interaction::Strict(ref i1, ref i2) => { match **i1 { diff --git a/src/core/transformation/transfofunc/factorize_par.rs b/src/core/transformation/transfofunc/factorize/factorize_par.rs similarity index 96% rename from src/core/transformation/transfofunc/factorize_par.rs rename to src/core/transformation/transfofunc/factorize/factorize_par.rs index 43aaca9..6c94e3b 100644 --- a/src/core/transformation/transfofunc/factorize_par.rs +++ b/src/core/transformation/transfofunc/factorize/factorize_par.rs @@ -25,7 +25,7 @@ use crate::core::language::syntax::util::get_recursive_frag::*; -pub fn factorize_par(interaction : &Interaction) -> Vec { +pub fn transfo_factorize_par(interaction : &Interaction) -> Vec { let mut got_ints = vec![]; match interaction { &Interaction::Alt(ref i1, ref i2) => { diff --git a/src/core/transformation/transfofunc/factorize_prefix.rs b/src/core/transformation/transfofunc/factorize/factorize_prefix.rs similarity index 96% rename from src/core/transformation/transfofunc/factorize_prefix.rs rename to src/core/transformation/transfofunc/factorize/factorize_prefix.rs index 42bb7ae..e739107 100644 --- a/src/core/transformation/transfofunc/factorize_prefix.rs +++ b/src/core/transformation/transfofunc/factorize/factorize_prefix.rs @@ -24,7 +24,7 @@ use crate::core::language::syntax::util::get_recursive_frag::*; -pub fn factorize_prefix_strict(interaction : &Interaction) -> Vec { +pub fn transfo_factorize_prefix_strict(interaction : &Interaction) -> Vec { match interaction { &Interaction::Alt(ref i1, ref i2) => { let mut left_strict_frags = get_recursive_strict_frags(i1); @@ -65,7 +65,7 @@ pub fn factorize_prefix_strict(interaction : &Interaction) -> Vec { return vec![]; } -pub fn factorize_prefix_seq(interaction : &Interaction) -> Vec { +pub fn transfo_factorize_prefix_seq(interaction : &Interaction) -> Vec { match interaction { &Interaction::Alt(ref i1, ref i2) => { let mut left_seq_frags = get_recursive_seq_frags(i1); diff --git a/src/core/transformation/transfofunc/factorize_suffix.rs b/src/core/transformation/transfofunc/factorize/factorize_suffix.rs similarity index 93% rename from src/core/transformation/transfofunc/factorize_suffix.rs rename to src/core/transformation/transfofunc/factorize/factorize_suffix.rs index 4f0e147..50febd9 100644 --- a/src/core/transformation/transfofunc/factorize_suffix.rs +++ b/src/core/transformation/transfofunc/factorize/factorize_suffix.rs @@ -24,7 +24,7 @@ use crate::core::language::syntax::util::get_recursive_frag::*; -pub fn factorize_suffix_strict(interaction : &Interaction) -> Vec { +pub fn transfo_factorize_suffix_strict(interaction : &Interaction) -> Vec { match interaction { &Interaction::Alt(ref i1, ref i2) => { let mut left_strict_frags = get_recursive_strict_frags(i1); @@ -45,7 +45,7 @@ pub fn factorize_suffix_strict(interaction : &Interaction) -> Vec { return vec![]; } -pub fn factorize_suffix_seq(interaction : &Interaction) -> Vec { +pub fn transfo_factorize_suffix_seq(interaction : &Interaction) -> Vec { match interaction { &Interaction::Alt(ref i1, ref i2) => { let mut left_seq_frags = get_recursive_seq_frags(i1); diff --git a/src/core/transformation/transfofunc/factorize/mod.rs b/src/core/transformation/transfofunc/factorize/mod.rs new file mode 100644 index 0000000..bc65404 --- /dev/null +++ b/src/core/transformation/transfofunc/factorize/mod.rs @@ -0,0 +1,20 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +pub mod factorize_par; +pub mod factorize_prefix; +pub mod factorize_suffix; diff --git a/src/core/transformation/transfofunc/flush.rs b/src/core/transformation/transfofunc/flush.rs index fb192b9..8c49d29 100644 --- a/src/core/transformation/transfofunc/flush.rs +++ b/src/core/transformation/transfofunc/flush.rs @@ -18,13 +18,12 @@ limitations under the License. use crate::core::language::syntax::interaction::Interaction; -pub fn flush_right(interaction : &Interaction) -> Vec { - let mut new_int : Option = None; +pub fn transfo_flush_right(interaction : &Interaction) -> Vec { match interaction { &Interaction::Alt(ref i1, ref i2) => { match **i1 { Interaction::Alt(ref i11,ref i12) => { - new_int = Some(Interaction::Alt( i11.clone(), Box::new(Interaction::Alt(i12.clone(), i2.clone())) ) ); + return vec![Interaction::Alt( i11.clone(), Box::new(Interaction::Alt(i12.clone(), i2.clone())) )]; }, _ => {} } @@ -32,7 +31,7 @@ pub fn flush_right(interaction : &Interaction) -> Vec { &Interaction::Strict(ref i1, ref i2) => { match **i1 { Interaction::Strict(ref i11,ref i12) => { - new_int = Some(Interaction::Strict( i11.clone(), Box::new(Interaction::Strict(i12.clone(), i2.clone())) )); + return vec![Interaction::Strict( i11.clone(), Box::new(Interaction::Strict(i12.clone(), i2.clone())) )]; }, _ => {} } @@ -40,7 +39,7 @@ pub fn flush_right(interaction : &Interaction) -> Vec { &Interaction::Seq(ref i1, ref i2) => { match **i1 { Interaction::Seq(ref i11,ref i12) => { - new_int = Some(Interaction::Seq( i11.clone(), Box::new(Interaction::Seq(i12.clone(), i2.clone())) )); + return vec![Interaction::Seq( i11.clone(), Box::new(Interaction::Seq(i12.clone(), i2.clone())) )]; }, _ => {} } @@ -48,7 +47,7 @@ pub fn flush_right(interaction : &Interaction) -> Vec { &Interaction::Par(ref i1, ref i2) => { match **i1 { Interaction::Par(ref i11,ref i12) => { - new_int = Some(Interaction::Par( i11.clone(), Box::new(Interaction::Par(i12.clone(), i2.clone())) )); + return vec![Interaction::Par( i11.clone(), Box::new(Interaction::Par(i12.clone(), i2.clone())) )]; }, _ => {} } @@ -57,7 +56,7 @@ pub fn flush_right(interaction : &Interaction) -> Vec { match **i1 { Interaction::CoReg(ref cr2, ref i11,ref i12) => { if cr1 == cr2 { - new_int = Some(Interaction::CoReg( cr1.clone(), i11.clone(), Box::new(Interaction::CoReg(cr1.clone(), i12.clone(), i2.clone())) )); + return vec![Interaction::CoReg( cr1.clone(), i11.clone(), Box::new(Interaction::CoReg(cr1.clone(), i12.clone(), i2.clone())) )]; } }, _ => {} @@ -65,18 +64,7 @@ pub fn flush_right(interaction : &Interaction) -> Vec { }, _ => {} } - match new_int { - None => { - return vec![]; - }, - Some(got_int) => { - if &got_int < interaction { - return vec![got_int]; - } else { - return vec![] - } - } - } + return vec![] } /* diff --git a/src/core/transformation/transfofunc/invert.rs b/src/core/transformation/transfofunc/invert.rs index 9f21bea..ead0323 100644 --- a/src/core/transformation/transfofunc/invert.rs +++ b/src/core/transformation/transfofunc/invert.rs @@ -23,7 +23,7 @@ use crate::core::language::syntax::interaction::Interaction; use crate::core::language::syntax::util::fold_recursive_frags::{fold_recursive_alt_frags, fold_recursive_par_frags}; use crate::core::language::syntax::util::get_recursive_frag::{get_recursive_alt_frags, get_recursive_par_frags}; -pub fn invert_alt_sorted(interaction : &Interaction) -> Vec { +pub fn transfo_invert_alt_sorted(interaction : &Interaction) -> Vec { let orig_alt_frags = get_recursive_alt_frags(interaction); let mut sorted_alt_frags : Vec<&Interaction> = orig_alt_frags.iter().map(|x| *x).sorted().collect(); if sorted_alt_frags != orig_alt_frags { @@ -33,7 +33,7 @@ pub fn invert_alt_sorted(interaction : &Interaction) -> Vec { } } -pub fn invert_par_sorted(interaction : &Interaction) -> Vec { +pub fn transfo_invert_par_sorted(interaction : &Interaction) -> Vec { let orig_par_frags = get_recursive_par_frags(interaction); let mut sorted_par_frags : Vec<&Interaction> = orig_par_frags.iter().map(|x| *x).sorted().collect(); if sorted_par_frags != orig_par_frags { diff --git a/src/core/transformation/transfofunc/loop_simpl.rs b/src/core/transformation/transfofunc/loop_simpl.rs index 123b8f5..47c463e 100644 --- a/src/core/transformation/transfofunc/loop_simpl.rs +++ b/src/core/transformation/transfofunc/loop_simpl.rs @@ -16,11 +16,9 @@ limitations under the License. -use crate::core::language::syntax::interaction::{Interaction, LoopKind}; -use crate::core::language::syntax::util::fold_recursive_frags::{fold_recursive_par_frags, fold_recursive_seq_frags, fold_recursive_strict_frags}; -use crate::core::language::syntax::util::get_recursive_frag::{get_recursive_par_frags, get_recursive_seq_frags, get_recursive_strict_frags}; +use crate::core::language::syntax::interaction::{Interaction}; -pub fn loop_empty_simpl(interaction : &Interaction) -> Vec { +pub fn transfo_loop_empty_simpl(interaction : &Interaction) -> Vec { match interaction { &Interaction::Loop(ref sk, ref i1) => { match **i1 { @@ -36,7 +34,7 @@ pub fn loop_empty_simpl(interaction : &Interaction) -> Vec { } -pub fn loop_unnest(interaction : &Interaction) -> Vec { +pub fn transfo_loop_unnest(interaction : &Interaction) -> Vec { match interaction { &Interaction::Loop(ref lkA, ref i1) => { match **i1 { @@ -51,109 +49,7 @@ pub fn loop_unnest(interaction : &Interaction) -> Vec { return vec![]; } -pub fn loop_factorize(interaction : &Interaction) -> Vec { - let mut got_ints = vec![]; - match interaction { - &Interaction::Strict(ref i1, ref i2) => { - match **i1 { - Interaction::Loop(ref lk, ref i11) => { - match lk { - LoopKind::SStrictSeq => { - if i2 == i11 { - got_ints.push(*i1.clone()); - } else if i2 == i1 { - got_ints.push(*i1.clone()); - } - }, - _ => {} - } - }, - _ => {} - } - match **i2 { - Interaction::Loop(ref lk, ref i21) => { - match lk { - LoopKind::SStrictSeq => { - if i1 == i21 { - got_ints.push(*i2.clone()); - } else if i1 == i2 { - got_ints.push(*i2.clone()); - } - }, - _ => {} - } - }, - _ => {} - } - }, - &Interaction::Seq(ref i1, ref i2) => { - match **i1 { - Interaction::Loop(ref lk, ref i11) => { - match lk { - LoopKind::WWeakSeq => { - if i2 == i11 { - got_ints.push(*i1.clone()); - } else if i2 == i1 { - got_ints.push(*i1.clone()); - } - }, - _ => {} - } - }, - _ => {} - } - match **i2 { - Interaction::Loop(ref lk, ref i21) => { - match lk { - LoopKind::WWeakSeq => { - if i1 == i21 { - got_ints.push(*i2.clone()); - } else if i1 == i2 { - got_ints.push(*i2.clone()); - } - }, - _ => {} - } - }, - _ => {} - } - }, - &Interaction::Par(ref i1, ref i2) => { - match **i1 { - Interaction::Loop(ref lk, ref i11) => { - match lk { - LoopKind::PInterleaving => { - if i2 == i11 { - got_ints.push(*i1.clone()); - } else if i2 == i1 { - got_ints.push(*i1.clone()); - } - }, - _ => {} - } - }, - _ => {} - } - match **i2 { - Interaction::Loop(ref lk, ref i21) => { - match lk { - LoopKind::PInterleaving => { - if i1 == i21 { - got_ints.push(*i2.clone()); - } else if i1 == i2 { - got_ints.push(*i2.clone()); - } - }, - _ => {} - } - }, - _ => {} - } - }, - _ => {} - } - return got_ints; -} + diff --git a/src/core/transformation/transfofunc/merge_action.rs b/src/core/transformation/transfofunc/merge/merge_action.rs similarity index 97% rename from src/core/transformation/transfofunc/merge_action.rs rename to src/core/transformation/transfofunc/merge/merge_action.rs index 8e0a02a..3366389 100644 --- a/src/core/transformation/transfofunc/merge_action.rs +++ b/src/core/transformation/transfofunc/merge/merge_action.rs @@ -20,7 +20,7 @@ use crate::core::language::syntax::action::{EmissionAction, EmissionTargetRef, R use crate::core::language::syntax::interaction::Interaction; -pub fn merge_action(interaction : &Interaction) -> Option { +pub fn transfo_merge_action(interaction : &Interaction) -> Option { match interaction { Interaction::And(ref i1, ref i2) => { match (&**i1,&**i2) { diff --git a/src/core/transformation/transfofunc/merge_shift_left.rs b/src/core/transformation/transfofunc/merge/merge_shift_left.rs similarity index 95% rename from src/core/transformation/transfofunc/merge_shift_left.rs rename to src/core/transformation/transfofunc/merge/merge_shift_left.rs index 4145b15..eda9af5 100644 --- a/src/core/transformation/transfofunc/merge_shift_left.rs +++ b/src/core/transformation/transfofunc/merge/merge_shift_left.rs @@ -17,7 +17,7 @@ limitations under the License. use crate::core::language::syntax::interaction::Interaction; -pub fn merge_shift_left_1(interaction : &Interaction) -> Option { +pub fn transfo_merge_shift_left_1(interaction : &Interaction) -> Option { match interaction { &Interaction::And(ref i1, ref i2) => { match **i1 { @@ -55,7 +55,7 @@ pub fn merge_shift_left_1(interaction : &Interaction) -> Option { -pub fn merge_shift_left_2(interaction : &Interaction) -> Option { +pub fn transfo_merge_shift_left_2(interaction : &Interaction) -> Option { match interaction { &Interaction::And(ref i1, ref i2) => { match **i1 { diff --git a/src/core/transformation/transfofunc/merge_shift_right.rs b/src/core/transformation/transfofunc/merge/merge_shift_right.rs similarity index 95% rename from src/core/transformation/transfofunc/merge_shift_right.rs rename to src/core/transformation/transfofunc/merge/merge_shift_right.rs index a18d2c4..418a1c7 100644 --- a/src/core/transformation/transfofunc/merge_shift_right.rs +++ b/src/core/transformation/transfofunc/merge/merge_shift_right.rs @@ -17,7 +17,7 @@ limitations under the License. use crate::core::language::syntax::interaction::Interaction; -pub fn merge_shift_right_1(interaction : &Interaction) -> Option { +pub fn transfo_merge_shift_right_1(interaction : &Interaction) -> Option { match interaction { &Interaction::And(ref i1, ref i2) => { match **i2 { @@ -55,7 +55,7 @@ pub fn merge_shift_right_1(interaction : &Interaction) -> Option { -pub fn merge_shift_right_2(interaction : &Interaction) -> Option { +pub fn transfo_merge_shift_right_2(interaction : &Interaction) -> Option { match interaction { &Interaction::And(ref i1, ref i2) => { match **i2 { diff --git a/src/core/transformation/transfofunc/merge_skip.rs b/src/core/transformation/transfofunc/merge/merge_skip.rs similarity index 97% rename from src/core/transformation/transfofunc/merge_skip.rs rename to src/core/transformation/transfofunc/merge/merge_skip.rs index 556f2a3..75f3fcc 100644 --- a/src/core/transformation/transfofunc/merge_skip.rs +++ b/src/core/transformation/transfofunc/merge/merge_skip.rs @@ -17,7 +17,7 @@ limitations under the License. use crate::core::language::syntax::interaction::Interaction; -pub fn merge_skip(interaction : &Interaction) -> Option { +pub fn transfo_merge_skip(interaction : &Interaction) -> Option { match interaction { &Interaction::And(ref i1, ref i2) => { match (&**i1,&**i2) { diff --git a/src/core/transformation/transfofunc/merge_skip_invert.rs b/src/core/transformation/transfofunc/merge/merge_skip_invert.rs similarity index 94% rename from src/core/transformation/transfofunc/merge_skip_invert.rs rename to src/core/transformation/transfofunc/merge/merge_skip_invert.rs index fd9c4fd..723b81f 100644 --- a/src/core/transformation/transfofunc/merge_skip_invert.rs +++ b/src/core/transformation/transfofunc/merge/merge_skip_invert.rs @@ -17,7 +17,7 @@ limitations under the License. use crate::core::language::syntax::interaction::Interaction; -pub fn merge_skip_invert(interaction : &Interaction) -> Option { +pub fn transfo_merge_skip_invert(interaction : &Interaction) -> Option { match interaction { &Interaction::And(ref i1, ref i2) => { match (&**i1,&**i2) { diff --git a/src/core/transformation/transfofunc/merge/mod.rs b/src/core/transformation/transfofunc/merge/mod.rs new file mode 100644 index 0000000..0b67926 --- /dev/null +++ b/src/core/transformation/transfofunc/merge/mod.rs @@ -0,0 +1,25 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + + +pub mod merge_action; +pub mod merge_skip; +pub mod merge_skip_invert; +pub mod merge_shift_left; +pub mod merge_shift_right; + + diff --git a/src/core/transformation/transfofunc/mod.rs b/src/core/transformation/transfofunc/mod.rs index 1f4302e..51c105a 100644 --- a/src/core/transformation/transfofunc/mod.rs +++ b/src/core/transformation/transfofunc/mod.rs @@ -14,19 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ +pub mod simpl; pub mod action; -pub mod dedupl; +pub mod alt_dedup; pub mod defactorize; -pub mod factorize_par; -pub mod factorize_prefix; -pub mod factorize_suffix; +pub mod factorize; pub mod flush; pub mod invert; -pub mod loop_alt_simpl; pub mod loop_simpl; -pub mod merge_action; -pub mod merge_skip; -pub mod merge_skip_invert; -pub mod merge_shift_left; -pub mod merge_shift_right; -pub mod simpl; diff --git a/src/core/transformation/transfofunc/loop_alt_simpl.rs b/src/core/transformation/transfofunc/old/loop_alt_simpl.rs similarity index 100% rename from src/core/transformation/transfofunc/loop_alt_simpl.rs rename to src/core/transformation/transfofunc/old/loop_alt_simpl.rs diff --git a/src/core/transformation/transfofunc/simpl.rs b/src/core/transformation/transfofunc/simpl.rs index ecedbc3..1371404 100644 --- a/src/core/transformation/transfofunc/simpl.rs +++ b/src/core/transformation/transfofunc/simpl.rs @@ -23,7 +23,7 @@ use crate::core::language::syntax::util::fold_recursive_frags::{fold_recursive_c use crate::core::language::syntax::util::get_recursive_frag::{get_recursive_coreg_frags, get_recursive_par_frags, get_recursive_seq_frags, get_recursive_strict_frags}; -pub fn simpl(interaction : &Interaction) -> Vec { +pub fn transfo_simpl(interaction : &Interaction) -> Vec { match interaction { &Interaction::Strict(ref i1, ref i2) => { let mut old_frags = get_recursive_strict_frags(i1); diff --git a/src/core/transformation/transfokind.rs b/src/core/transformation/transfokind.rs index db5068e..290170a 100644 --- a/src/core/transformation/transfokind.rs +++ b/src/core/transformation/transfokind.rs @@ -14,112 +14,113 @@ See the License for the specific language governing permissions and limitations under the License. */ +use strum_macros::IntoStaticStr; +use crate::core::language::syntax::interaction::Interaction; +use crate::core::transformation::transfofunc::action::transfo_sort_action_content; +use crate::core::transformation::transfofunc::alt_dedup::alt_dedup_equal::transfo_deduplicate; +use crate::core::transformation::transfofunc::defactorize::{transfo_defactorize_left, transfo_defactorize_right}; +use crate::core::transformation::transfofunc::factorize::factorize_par::transfo_factorize_par; +use crate::core::transformation::transfofunc::factorize::factorize_prefix::{transfo_factorize_prefix_seq, transfo_factorize_prefix_strict}; +use crate::core::transformation::transfofunc::factorize::factorize_suffix::{transfo_factorize_suffix_seq, transfo_factorize_suffix_strict}; +use crate::core::transformation::transfofunc::flush::transfo_flush_right; +use crate::core::transformation::transfofunc::invert::{transfo_invert_alt_sorted, transfo_invert_par_sorted}; +use crate::core::transformation::transfofunc::loop_simpl::{transfo_loop_empty_simpl, transfo_loop_unnest}; +use crate::core::transformation::transfofunc::simpl::transfo_simpl; -#[derive(Clone, PartialEq, Debug, Eq, Hash)] +#[derive(IntoStaticStr,Clone, PartialEq, Debug, Eq, Hash)] pub enum InteractionTransformationKind { Simpl, - FlushLeft, FlushRight, InvertAlt, InvertPar, Deduplicate, FactorizePrefixStrict, FactorizePrefixSeq, + FactorizeCommutativePar, FactorizeSuffixStrict, FactorizeSuffixSeq, - FactorizeCommutativePar, DeFactorizeLeft, DeFactorizeRight, LoopSimpl, - LoopAltSimpl, LoopUnNest, SortActionContent, // sort emission targets OR reception recipients // *** - MergeShiftLeft1, + /*MergeShiftLeft1, MergeShiftLeft2, MergeShiftRight1, MergeShiftRight2, MergeAction, MergeSkip, - MergeSkipInvert, + MergeSkipInvert,*/ } impl InteractionTransformationKind { pub fn to_string(&self) -> String { + let as_static_str : &'static str = self.into(); + return as_static_str.to_string(); + } + pub fn get_transformation(&self) -> fn(&Interaction) -> Vec { match self { - &InteractionTransformationKind::Simpl => { - return "Simpl".to_string(); - }, - &InteractionTransformationKind::FlushLeft => { - return "FlushLeft".to_string(); - }, - &InteractionTransformationKind::FlushRight => { - return "FlushRight".to_string(); - }, - &InteractionTransformationKind::InvertAlt => { - return "InvertAlt".to_string(); - }, - &InteractionTransformationKind::InvertPar => { - return "InvertPar".to_string(); - }, - &InteractionTransformationKind::Deduplicate => { - return "Deduplicate".to_string(); - }, - &InteractionTransformationKind::FactorizePrefixStrict => { - return "FactorizePrefixStrict".to_string(); + InteractionTransformationKind::Simpl => { + return transfo_simpl; + } + InteractionTransformationKind::FlushRight => { + return transfo_flush_right; }, - &InteractionTransformationKind::FactorizePrefixSeq => { - return "FactorizePrefixSeq".to_string(); + InteractionTransformationKind::InvertAlt => { + return transfo_invert_alt_sorted; }, - &InteractionTransformationKind::FactorizeSuffixStrict => { - return "FactorizeSuffixStrict".to_string(); + InteractionTransformationKind::InvertPar => { + return transfo_invert_par_sorted; }, - &InteractionTransformationKind::FactorizeSuffixSeq => { - return "FactorizeSuffixSeq".to_string(); + InteractionTransformationKind::Deduplicate => { + return transfo_deduplicate; }, - &InteractionTransformationKind::FactorizeCommutativePar => { - return "FactorizeCommutativePar".to_string(); + InteractionTransformationKind::FactorizePrefixStrict => { + return transfo_factorize_prefix_strict; }, - &InteractionTransformationKind::DeFactorizeLeft => { - return "DeFactorizeLeft".to_string(); + InteractionTransformationKind::FactorizePrefixSeq => { + return transfo_factorize_prefix_seq; }, - &InteractionTransformationKind::DeFactorizeRight => { - return "DeFactorizeRight".to_string(); + InteractionTransformationKind::FactorizeCommutativePar => { + return transfo_factorize_par; }, - &InteractionTransformationKind::LoopSimpl => { - return "LoopSimpl".to_string(); + InteractionTransformationKind::FactorizeSuffixSeq => { + return transfo_factorize_suffix_strict; }, - &InteractionTransformationKind::LoopAltSimpl => { - return "LoopAltSimpl".to_string(); + InteractionTransformationKind::FactorizeSuffixStrict => { + return transfo_factorize_suffix_seq; }, - &InteractionTransformationKind::LoopUnNest => { - return "LoopUnNest".to_string(); + InteractionTransformationKind::DeFactorizeLeft => { + return transfo_defactorize_left; }, - &InteractionTransformationKind::SortActionContent => { - return "SortActionContent".to_string(); + InteractionTransformationKind::DeFactorizeRight => { + return transfo_defactorize_right; }, - &InteractionTransformationKind::MergeShiftLeft1 => { - return "MergeShiftLeft1".to_string(); + InteractionTransformationKind::LoopSimpl => { + return transfo_loop_empty_simpl; }, - &InteractionTransformationKind::MergeShiftRight1 => { - return "MergeShiftRight1".to_string(); + InteractionTransformationKind::LoopUnNest => { + return transfo_loop_unnest; }, - &InteractionTransformationKind::MergeShiftLeft2 => { - return "MergeShiftLeft2".to_string(); + InteractionTransformationKind::SortActionContent => { + return transfo_sort_action_content; }, - &InteractionTransformationKind::MergeShiftRight2 => { - return "MergeShiftRight2".to_string(); + // *** + /* + InteractionTransformationKind::MergeShiftLeft1 => { + return transfo_merge_shift_left_1; }, - &InteractionTransformationKind::MergeAction => { - return "MergeAction".to_string(); + InteractionTransformationKind::MergeShiftLeft2 => { + return transfo_merge_shift_left_2; }, - &InteractionTransformationKind::MergeSkip => { - return "MergeSkip".to_string(); + InteractionTransformationKind::MergeShiftRight1 => { + return transfo_merge_shift_right_1; }, - &InteractionTransformationKind::MergeSkipInvert => { - return "MergeSkipInvert".to_string(); - } + InteractionTransformationKind::MergeShiftRight2 => { + return transfo_merge_shift_right_2; + },*/ } } } diff --git a/src/core/transformation/transfophase.rs b/src/core/transformation/transfophase.rs new file mode 100644 index 0000000..352040e --- /dev/null +++ b/src/core/transformation/transfophase.rs @@ -0,0 +1,61 @@ +/* +Copyright 2020 Erwan Mahe (github.com/erwanM974) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +use crate::core::language::syntax::interaction::Interaction; +use crate::core::transformation::get_transfos::get_all_transfos::get_all_transformations_rec; +use crate::core::transformation::get_transfos::get_one_transfo::get_one_transformation_rec; +use crate::core::transformation::transfokind::InteractionTransformationKind; +use crate::core::transformation::transfores::InteractionTransformationResult; + +pub struct InteractionTransformationPhase { + pub transfos : Vec, + pub get_all : bool, + pub ordered : bool +} + +impl InteractionTransformationPhase { + pub fn new(transfos : Vec,get_all : bool,ordered : bool) -> InteractionTransformationPhase { + return InteractionTransformationPhase{transfos,get_all,ordered}; + } + + pub fn apply_phase(&self,interaction : &Interaction) -> Vec { + if self.ordered { + panic!("not implemented"); + } else { + return self.get_transfos(interaction,&self.transfos); + } + } + + fn get_transfos(&self, + interaction : &Interaction, + transfos : &Vec) -> Vec { + if self.get_all { + return get_all_transformations_rec(transfos,interaction); + } else { + match get_one_transformation_rec(transfos,interaction) { + None => { + return Vec::new(); + }, + Some( got ) => { + return vec![got]; + } + } + } + } +} + + diff --git a/src/core/transformation/transfodef.rs b/src/core/transformation/transfores.rs similarity index 86% rename from src/core/transformation/transfodef.rs rename to src/core/transformation/transfores.rs index b972f20..5093d4c 100644 --- a/src/core/transformation/transfodef.rs +++ b/src/core/transformation/transfores.rs @@ -19,16 +19,16 @@ use crate::core::language::position::position::Position; use crate::core::language::syntax::interaction::Interaction; use crate::core::transformation::transfokind::InteractionTransformationKind; -pub struct InteractionTransformation { +pub struct InteractionTransformationResult { pub kind : InteractionTransformationKind, pub position : Position, pub result : Interaction } -impl InteractionTransformation { +impl InteractionTransformationResult { pub fn new(kind : InteractionTransformationKind, position : Position, - result : Interaction) -> InteractionTransformation { - return InteractionTransformation{kind,position,result}; + result : Interaction) -> InteractionTransformationResult { + return InteractionTransformationResult{kind,position,result}; } } \ No newline at end of file diff --git a/src/io/input/hcf/hcf_syntax.pest b/src/io/input/hcf/hcf_syntax.pest index df1227b..129ff4d 100644 --- a/src/io/input/hcf/hcf_syntax.pest +++ b/src/io/input/hcf/hcf_syntax.pest @@ -39,6 +39,9 @@ GRAPHIC_LOGGER_layout = _{ ("layout" ~ "=")? ~ (GRAPHIC_LOGGER_layout_horizontal GRAPHIC_LOGGER_draw_sequence_diagram = { "draw_sd" ~ "=" ~ (HIBOU_true | HIBOU_false) } GRAPHIC_LOGGER_draw_term_tree = { "draw_tt" ~ "=" ~ (HIBOU_true | HIBOU_false) } +GRAPHIC_LOGGER_draw_sub_processes = { "draw_sub_processes" ~ "=" ~ (HIBOU_true | HIBOU_false) } +GRAPHIC_LOGGER_draw_legend = { "draw_legend" ~ "=" ~ (HIBOU_true | HIBOU_false) } + GRAPHIC_LOGGER_parent_folder = { ("parent"|"parent_folder"|"folder") ~ "=" ~ HIBOU_LABEL } GRAPHIC_LOGGER_output_file = { ("output"|"name") ~ "=" ~ HIBOU_LABEL } @@ -46,6 +49,8 @@ GRAPHIC_LOGGER_opt = _{ GRAPHIC_LOGGER_format | GRAPHIC_LOGGER_layout | GRAPHIC_LOGGER_draw_sequence_diagram | GRAPHIC_LOGGER_draw_term_tree + | GRAPHIC_LOGGER_draw_sub_processes + | GRAPHIC_LOGGER_draw_legend | GRAPHIC_LOGGER_parent_folder | GRAPHIC_LOGGER_output_file } @@ -185,7 +190,6 @@ OPTION_GOAL_KIND = _{ OPTION_GOAL_pass | OPTION_GOAL_weakpass | OPTION_GOAL_none OPTION_GOAL_DECL = { "goal" ~ "=" ~ OPTION_GOAL_KIND } // *********************************************** OPTION_LOCANA_yes = { "local_analysis" ~ "=" ~ HIBOU_true } -OPTION_LOCANA_onlyfront = { "local_analysis" ~ "=" ~ ("front" | "onlyfront" | "only" ~"front") } OPTION_LOCANA_no = { "local_analysis" ~ "=" ~ HIBOU_false } OPTION_LOCANA = _{ OPTION_LOCANA_yes | OPTION_LOCANA_no } // *********************************************** diff --git a/src/io/input/hcf/implem_ana.rs b/src/io/input/hcf/implem_ana.rs index 8d07e46..e468ebf 100644 --- a/src/io/input/hcf/implem_ana.rs +++ b/src/io/input/hcf/implem_ana.rs @@ -30,7 +30,9 @@ use crate::pest::Parser; use crate::io::input::hcf::parser::{HcfParser,Rule}; -pub fn parse_hcf_string_for_ana(gen_ctx : &GeneralContext, hcf_string : String, file_name : &str) -> Result { +pub fn parse_hcf_string_for_ana(gen_ctx : &GeneralContext, + hcf_string : String, + file_name : &str) -> Result { match HcfParser::parse(Rule::HCF_PEST_FILE, &hcf_string) { Ok( ref mut got_pair ) => { let conf_pair = got_pair.next().unwrap(); diff --git a/src/io/input/hcf/proc_options/loggers.rs b/src/io/input/hcf/proc_options/loggers.rs index 44a0f0d..d29566f 100644 --- a/src/io/input/hcf/proc_options/loggers.rs +++ b/src/io/input/hcf/proc_options/loggers.rs @@ -44,6 +44,8 @@ pub fn parse_graphic_logger(logger_id : u32, let mut layout = GraphicProcessLoggerLayout::vertical; let mut int_repr_sd = true; let mut int_repr_tt = false; + let mut display_legend = true; + let mut display_subprocesses = true; let mut parent_folder = "".to_string(); let mut output_file_name = format!("{:}_l{:}",file_name,logger_id); // *** @@ -94,6 +96,34 @@ pub fn parse_graphic_logger(logger_id : u32, } } }, + Rule::GRAPHIC_LOGGER_draw_legend => { + let inner = opt_pair.into_inner().next().unwrap(); + match inner.as_rule() { + Rule::HIBOU_true => { + display_legend = true; + }, + Rule::HIBOU_false => { + display_legend = false; + }, + _ => { + panic!("what rule then ? : {:?}", inner.as_rule()); + } + } + }, + Rule::GRAPHIC_LOGGER_draw_sub_processes => { + let inner = opt_pair.into_inner().next().unwrap(); + match inner.as_rule() { + Rule::HIBOU_true => { + display_subprocesses = true; + }, + Rule::HIBOU_false => { + display_subprocesses = false; + }, + _ => { + panic!("what rule then ? : {:?}", inner.as_rule()); + } + } + }, Rule::GRAPHIC_LOGGER_parent_folder => { let inner_pair = opt_pair.into_inner().next().unwrap(); parent_folder = inner_pair.as_str().chars().filter(|c| !c.is_whitespace()).collect(); @@ -112,6 +142,8 @@ pub fn parse_graphic_logger(logger_id : u32, // *** return GraphicProcessLogger::new(output_format, layout, + display_legend, + display_subprocesses, int_repr_sd, int_repr_tt, format!("temp_l{:}", logger_id), diff --git a/src/io/input/hcf/proc_options/opt_analyze.rs b/src/io/input/hcf/proc_options/opt_analyze.rs index c3846fa..cf6e659 100644 --- a/src/io/input/hcf/proc_options/opt_analyze.rs +++ b/src/io/input/hcf/proc_options/opt_analyze.rs @@ -63,7 +63,7 @@ impl HibouAnalyzeOptions { filters:Vec::new(), priorities:GenericProcessPriorities::Specific(AnalysisPriorities::default()), ana_kind:AnalysisKind::Prefix, - local_analysis:UseLocalAnalysis::Yes(false), + local_analysis:UseLocalAnalysis::Yes, goal:Some(GlobalVerdict::WeakPass) }; } @@ -79,7 +79,7 @@ pub fn parse_analyze_options(option_pair : Pair, let mut filters : Vec = Vec::new(); let mut priorities : GenericProcessPriorities = GenericProcessPriorities::Specific(AnalysisPriorities::default()); let mut ana_kind = AnalysisKind::Prefix; - let mut local_analysis = UseLocalAnalysis::Yes(false); + let mut local_analysis = UseLocalAnalysis::Yes; let mut goal = Some(GlobalVerdict::WeakPass); // *** for option_decl_pair in option_pair.into_inner() { @@ -188,10 +188,7 @@ pub fn parse_analyze_options(option_pair : Pair, } }, Rule::OPTION_LOCANA_yes => { - local_analysis = UseLocalAnalysis::Yes(false); - }, - Rule::OPTION_LOCANA_onlyfront => { - local_analysis = UseLocalAnalysis::Yes(true); + local_analysis = UseLocalAnalysis::Yes; }, Rule::OPTION_LOCANA_no => { local_analysis = UseLocalAnalysis::No; diff --git a/src/io/output/draw_interactions/as_sd/interface.rs b/src/io/output/draw_interactions/as_sd/interface.rs index 0d23483..80d93f0 100644 --- a/src/io/output/draw_interactions/as_sd/interface.rs +++ b/src/io/output/draw_interactions/as_sd/interface.rs @@ -23,7 +23,6 @@ use crate::io::output::draw_interactions::as_sd::interaction_repr::interaction:: pub fn draw_int_as_sd(gen_ctx : &GeneralContext, interaction : &Interaction, - temp_folder : &String, parent_folder : &String, output_file_name : &String) { // *** diff --git a/src/io/output/draw_interactions/interface.rs b/src/io/output/draw_interactions/interface.rs index 9a42bf5..b0ccef8 100644 --- a/src/io/output/draw_interactions/interface.rs +++ b/src/io/output/draw_interactions/interface.rs @@ -37,7 +37,7 @@ pub fn draw_interaction(gen_ctx : &GeneralContext, output_file_name : &String) { match repr { InteractionGraphicalRepresentation::AsSequenceDiagram => { - draw_int_as_sd(gen_ctx,int,temp_folder,parent_folder,output_file_name); + draw_int_as_sd(gen_ctx,int,parent_folder,output_file_name); }, InteractionGraphicalRepresentation::AsTerm => { draw_int_as_term(gen_ctx,int,temp_folder,parent_folder,output_file_name); diff --git a/src/io/output/graphviz/graph.rs b/src/io/output/graphviz/graph.rs index 8f9a27c..0eee188 100644 --- a/src/io/output/graphviz/graph.rs +++ b/src/io/output/graphviz/graph.rs @@ -18,6 +18,7 @@ limitations under the License. use crate::io::output::graphviz::cluster::cluster::GraphVizCluster; use crate::io::output::graphviz::colors::DotTranslatable; use crate::io::output::graphviz::edge::edge::GraphVizEdge; +use crate::io::output::graphviz::node::style::GraphvizNodeStyle; pub struct GraphVizDiGraph { diff --git a/src/loggers/graphic/conf.rs b/src/loggers/graphic/conf.rs index 197ffe8..e6d23c3 100644 --- a/src/loggers/graphic/conf.rs +++ b/src/loggers/graphic/conf.rs @@ -14,12 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ - +#[derive(Clone, PartialEq, Debug, Eq, Hash)] pub enum GraphicProcessLoggerOutputFormat { svg, png } +#[derive(Clone, PartialEq, Debug, Eq, Hash)] pub enum GraphicProcessLoggerLayout { horizontal, vertical diff --git a/src/loggers/graphic/get_graph/state.rs b/src/loggers/graphic/get_graph/state.rs index abb250e..0555121 100644 --- a/src/loggers/graphic/get_graph/state.rs +++ b/src/loggers/graphic/get_graph/state.rs @@ -158,13 +158,23 @@ fn make_graphic_logger_mu(temp_folder : &String, is_simulation : bool, sim_crit_loop : bool, sim_crit_act : bool) -> GraphVizNode { - let mu_image_file_name = format!("mu{}.png", state_id); + let mu_image_file_name = format!("mu{}", state_id); // *** - draw_multitrace(gen_ctx,co_localizations,multi_trace,flags,is_simulation,sim_crit_loop,sim_crit_act,temp_folder,&mu_image_file_name); + draw_multitrace(gen_ctx, + co_localizations, + multi_trace, + flags, + is_simulation, + sim_crit_loop, + sim_crit_act, + temp_folder, + &mu_image_file_name); // *** let mut node_gv_options : GraphvizNodeStyle = Vec::new(); - let mu_image_file_path : PathBuf = [temp_folder, &mu_image_file_name].iter().collect(); - node_gv_options.push( GraphvizNodeStyleItem::Image( mu_image_file_path.into_os_string().to_str().unwrap().to_string() ) ); + { + let mu_image_file_path : PathBuf = [temp_folder, &format!("{}.png",mu_image_file_name)].iter().collect(); + node_gv_options.push( GraphvizNodeStyleItem::Image( mu_image_file_path.into_os_string().to_str().unwrap().to_string() ) ); + } node_gv_options.push(GraphvizNodeStyleItem::Label( "".to_string() )); node_gv_options.push( GraphvizNodeStyleItem::Shape(GvNodeShape::Rectangle) ); // *** diff --git a/src/loggers/graphic/get_graph/transition.rs b/src/loggers/graphic/get_graph/transition.rs index 3631a6d..48f70ed 100644 --- a/src/loggers/graphic/get_graph/transition.rs +++ b/src/loggers/graphic/get_graph/transition.rs @@ -39,8 +39,8 @@ use crate::process::ana_proc::interface::step::SimulationStepKind; pub fn make_graphic_logger_string_label(temp_folder : &String, state_id : u32, string_label : String) -> GraphVizNode { - let sl_image_file_name = format!("sl{}.png", state_id); - let sl_image_file_path : PathBuf = [temp_folder, &sl_image_file_name].iter().collect(); + let sl_image_file_name = format!("sl{}", state_id); + let sl_image_file_path : PathBuf = [temp_folder, &format!("{}.png",sl_image_file_name)].iter().collect(); // *** draw_string_label(sl_image_file_path.as_path(),string_label); // *** @@ -50,7 +50,7 @@ pub fn make_graphic_logger_string_label(temp_folder : &String, gv_node_options.push(GraphvizNodeStyleItem::FillColor( GraphvizColor::white )); gv_node_options.push( GraphvizNodeStyleItem::Shape(GvNodeShape::Rectangle) ); // *** - return GraphVizNode{id:format!("sl{:}", state_id),style:gv_node_options}; + return GraphVizNode{id:sl_image_file_name,style:gv_node_options}; } @@ -61,8 +61,8 @@ pub fn make_graphic_logger_transformation(temp_folder : &String, state_id : u32, transfo_kind : &InteractionTransformationKind, position : &Position) -> GraphVizNode { - let tr_image_file_name = format!("t{}.png", state_id); - let tr_image_file_path : PathBuf = [temp_folder, &tr_image_file_name].iter().collect(); + let tr_image_file_name = format!("t{}", state_id); + let tr_image_file_path : PathBuf = [temp_folder, &format!("{}.png",tr_image_file_name)].iter().collect(); // *** draw_transformation(tr_image_file_path.as_path(),transfo_kind,position); // *** @@ -72,7 +72,7 @@ pub fn make_graphic_logger_transformation(temp_folder : &String, gv_node_options.push(GraphvizNodeStyleItem::FillColor( GraphvizColor::white )); gv_node_options.push( GraphvizNodeStyleItem::Shape(GvNodeShape::Rectangle) ); // *** - return GraphVizNode{id:format!("t{:}", state_id),style:gv_node_options}; + return GraphVizNode{id:tr_image_file_name,style:gv_node_options}; } @@ -82,8 +82,8 @@ pub fn make_graphic_logger_hiding(temp_folder : &String, gen_ctx : &GeneralContext, state_id : u32, lfs_to_hide: &HashSet) -> GraphVizNode { - let hid_image_file_name = format!("h{}.png", state_id); - let hid_image_file_path : PathBuf = [temp_folder, &hid_image_file_name].iter().collect(); + let hid_image_file_name = format!("h{}", state_id); + let hid_image_file_path : PathBuf = [temp_folder, &format!("{}.png",hid_image_file_name)].iter().collect(); // *** draw_hiding(hid_image_file_path.as_path(),gen_ctx,lfs_to_hide); // *** @@ -93,7 +93,7 @@ pub fn make_graphic_logger_hiding(temp_folder : &String, gv_node_options.push(GraphvizNodeStyleItem::FillColor( GraphvizColor::white )); gv_node_options.push( GraphvizNodeStyleItem::Shape(GvNodeShape::Rectangle) ); // *** - return GraphVizNode{id:format!("h{:}", state_id),style:gv_node_options}; + return GraphVizNode{id:hid_image_file_name,style:gv_node_options}; } @@ -104,8 +104,8 @@ pub fn make_graphic_logger_firing(temp_folder : &String, action_position : &Position, executed_actions : &HashSet, ana : Option<(&CoLocalizations, &HashSet, &HashMap)>) -> GraphVizNode { - let fir_image_file_name = format!("f{}.png", state_id); - let fir_image_file_path : PathBuf = [temp_folder, &fir_image_file_name].iter().collect(); + let fir_image_file_name = format!("f{}", state_id); + let fir_image_file_path : PathBuf = [temp_folder, &format!("{}.png",fir_image_file_name)].iter().collect(); // *** match ana { None => { @@ -131,6 +131,6 @@ pub fn make_graphic_logger_firing(temp_folder : &String, gv_node_options.push(GraphvizNodeStyleItem::FillColor( GraphvizColor::white )); gv_node_options.push( GraphvizNodeStyleItem::Shape(GvNodeShape::Rectangle) ); // *** - return GraphVizNode{id:format!("f{:}", state_id),style:gv_node_options}; + return GraphVizNode{id:fir_image_file_name,style:gv_node_options}; } diff --git a/src/loggers/graphic/get_graph/verdict.rs b/src/loggers/graphic/get_graph/verdict.rs index 50ecd3b..97a19f0 100644 --- a/src/loggers/graphic/get_graph/verdict.rs +++ b/src/loggers/graphic/get_graph/verdict.rs @@ -48,7 +48,7 @@ pub fn make_graphic_logger_verdict(parent_state_id: u32, // *** tran_gv_options.push( GraphvizEdgeStyleItem::Head( GvArrowHeadStyle::Vee(GvArrowHeadSide::Both) ) ); tran_gv_options.push( GraphvizEdgeStyleItem::Color( verdict_color ) ); - tran_gv_options.push( GraphvizEdgeStyleItem::LHead( format!("cluster_n{}",parent_state_id) ) ); + tran_gv_options.push( GraphvizEdgeStyleItem::LTail( format!("cluster_n{}",parent_state_id) ) ); // *** verd_edge = GraphVizEdge::new(format!("a{:}", parent_state_id),verd_node.id.clone(),tran_gv_options); } diff --git a/src/loggers/graphic/glog_ana.rs b/src/loggers/graphic/glog_ana.rs index c84cb7b..782a022 100644 --- a/src/loggers/graphic/glog_ana.rs +++ b/src/loggers/graphic/glog_ana.rs @@ -16,14 +16,19 @@ limitations under the License. use std::collections::{HashMap, HashSet}; +use std::path::PathBuf; use crate::core::colocalizations::CoLocalizations; use crate::core::execution::trace::multitrace::MultiTrace; use crate::core::execution::trace::trace::TraceAction; use crate::core::general_context::GeneralContext; use crate::core::language::position::position::Position; use crate::core::language::syntax::interaction::Interaction; +use crate::io::output::graphviz::colors::GraphvizColor; use crate::io::output::graphviz::edge::edge::GraphVizEdge; use crate::io::output::graphviz::edge::style::{GraphvizEdgeStyle, GraphvizEdgeStyleItem, GvArrowHeadSide, GvArrowHeadStyle, GvEdgeLineStyle}; +use crate::io::output::graphviz::node::node::GraphVizNode; +use crate::io::output::graphviz::node::style::{GraphvizNodeStyle, GraphvizNodeStyleItem, GvNodeShape}; +use crate::loggers::graphic::conf::GraphicProcessLoggerOutputFormat; use crate::loggers::graphic::get_graph::filter::make_graphic_logger_filter; use crate::loggers::graphic::get_graph::state::make_graphic_logger_state; use crate::loggers::graphic::get_graph::transition::{make_graphic_logger_firing, make_graphic_logger_hiding}; @@ -32,7 +37,9 @@ use crate::loggers::graphic::graphic_logger::GraphicProcessLogger; use crate::process::abstract_proc::common::FilterEliminationKind; use crate::process::ana_proc::interface::logger::AnalysisLogger; use crate::process::ana_proc::interface::step::SimulationStepKind; +use crate::process::ana_proc::logic::anakind::AnalysisKind; use crate::process::ana_proc::logic::flags::MultiTraceAnalysisFlags; +use crate::process::ana_proc::logic::local_analysis::perform_local_analysis; use crate::process::ana_proc::logic::verdicts::CoverageVerdict; @@ -177,4 +184,69 @@ impl AnalysisLogger for GraphicProcessLogger { self.graph.nodes.push(Box::new(verd_node)); self.graph.edges.push(verd_edge); } + + fn log_out_on_local_analysis(&mut self, + gen_ctx : &GeneralContext, + parent_state_id: u32, + verdict: &CoverageVerdict, + parent_analysis_kind: &AnalysisKind, + local_coloc: &CoLocalizations, + local_interaction: &Interaction, + local_multi_trace: &MultiTrace, + local_flags: &MultiTraceAnalysisFlags) { + if self.display_subprocesses { + // *** + let subproc_image_file_name = format!("ana{}", parent_state_id); + let sub_graphic_logger = GraphicProcessLogger::new(GraphicProcessLoggerOutputFormat::png, + self.layout.clone(), + false, + false, + self.int_repr_sd, + self.int_repr_tt, + "./temp".to_string(), + self.temp_folder.clone(), + subproc_image_file_name.clone()); + perform_local_analysis(gen_ctx, + local_coloc.clone(), + parent_analysis_kind, + local_interaction.clone(), + local_multi_trace.clone(), + local_flags.clone(), + vec![Box::new(sub_graphic_logger)]); + // *** + let subproc_image_file_path : PathBuf = [&self.temp_folder, &format!("{}.png",subproc_image_file_name)].iter().collect(); + // *** + let verdict_color = verdict.get_verdict_color(); + // *** + let locana_node : GraphVizNode; + { + let mut gv_node_options : GraphvizNodeStyle = Vec::new(); + gv_node_options.push( GraphvizNodeStyleItem::Image( subproc_image_file_path.into_os_string().to_str().unwrap().to_string() ) ); + gv_node_options.push(GraphvizNodeStyleItem::Label( "".to_string() )); + gv_node_options.push(GraphvizNodeStyleItem::FillColor( GraphvizColor::white )); + gv_node_options.push( GraphvizNodeStyleItem::Shape(GvNodeShape::Rectangle) ); + gv_node_options.push( GraphvizNodeStyleItem::PenWidth(3) ); + gv_node_options.push(GraphvizNodeStyleItem::Color( verdict_color.clone() )); + // *** + locana_node = GraphVizNode{id:subproc_image_file_name,style:gv_node_options}; + } + // *** + let locana_edge : GraphVizEdge; + { + let mut tran_gv_options : GraphvizEdgeStyle = Vec::new(); + // *** + tran_gv_options.push( GraphvizEdgeStyleItem::Head( GvArrowHeadStyle::Vee(GvArrowHeadSide::Both) ) ); + tran_gv_options.push( GraphvizEdgeStyleItem::Color( verdict_color ) ); + tran_gv_options.push( GraphvizEdgeStyleItem::LTail( format!("cluster_n{}",parent_state_id) ) ); + // *** + locana_edge = GraphVizEdge::new(format!("a{:}", parent_state_id),locana_node.id.clone(),tran_gv_options); + } + // *** + self.graph.nodes.push(Box::new(locana_node)); + self.graph.edges.push(locana_edge); + // *** + } else { + self.log_verdict(parent_state_id,verdict); + } + } } \ No newline at end of file diff --git a/src/loggers/graphic/graphic_logger.rs b/src/loggers/graphic/graphic_logger.rs index 3b6cd69..1b30390 100644 --- a/src/loggers/graphic/graphic_logger.rs +++ b/src/loggers/graphic/graphic_logger.rs @@ -20,8 +20,9 @@ use std::fs::File; use std::io::Write; use std::path::{Path, PathBuf}; use std::process::Command; -use crate::io::output::graphviz::colors::DotTranslatable; +use crate::io::output::graphviz::colors::{DotTranslatable, GraphvizColor}; use crate::io::output::graphviz::graph::GraphVizDiGraph; +use crate::io::output::graphviz::node::style::{GraphvizNodeStyle, GraphvizNodeStyleItem}; use crate::loggers::graphic::conf::{GraphicProcessLoggerLayout, GraphicProcessLoggerOutputFormat}; @@ -33,7 +34,10 @@ use crate::process::abstract_proc::common::FilterEliminationKind; pub struct GraphicProcessLogger { output_format : GraphicProcessLoggerOutputFormat, - layout : GraphicProcessLoggerLayout, + pub layout : GraphicProcessLoggerLayout, + // *** + display_legend : bool, + pub display_subprocesses : bool, // *** pub int_repr_sd : bool, pub int_repr_tt : bool, @@ -50,6 +54,8 @@ impl GraphicProcessLogger { pub fn new(output_format : GraphicProcessLoggerOutputFormat, layout : GraphicProcessLoggerLayout, + display_legend : bool, + display_subprocesses : bool, int_repr_sd : bool, int_repr_tt : bool, temp_folder : String, @@ -74,6 +80,8 @@ impl GraphicProcessLogger { // *** return GraphicProcessLogger{output_format, layout, + display_legend, + display_subprocesses, int_repr_sd, int_repr_tt, temp_folder:temp_folder, @@ -85,13 +93,16 @@ impl GraphicProcessLogger { pub fn terminate(&mut self, options_as_strs : &Vec) { // *** LEGEND - self.graph.nodes.push(Box::new(make_graphic_logger_legend(options_as_strs))); + if self.display_legend { + self.graph.nodes.push(Box::new(make_graphic_logger_legend(options_as_strs))); + } // *** let dot_file_name = format!("{:}.dot", self.output_file_name); let dot_file_path : PathBuf = [&self.temp_folder, &dot_file_name].iter().collect(); { // *** let mut dot_file = File::create(dot_file_path.as_path()).unwrap(); + // *** dot_file.write(self.graph.to_dot_string().as_bytes()); } // *** @@ -106,7 +117,6 @@ impl GraphicProcessLogger { .arg("-o") .arg(output_file_path.as_path()) .output(); - println!("{:?}",status); }, GraphicProcessLoggerOutputFormat::svg => { let output_file_name = format!("{:}.svg", self.output_file_name); @@ -118,7 +128,6 @@ impl GraphicProcessLogger { .arg("-o") .arg(output_file_path.as_path()) .output(); - println!("{:?}",status); } } } diff --git a/src/main.rs b/src/main.rs index fc7747d..249d542 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,6 @@ pub mod core; pub mod io; pub mod ui; pub mod plantuml; -//pub mod canonize; //pub mod merge_gates; pub mod process; pub mod loggers; diff --git a/src/process/ana_proc/interface/logger.rs b/src/process/ana_proc/interface/logger.rs index f70ffb7..cd204ee 100644 --- a/src/process/ana_proc/interface/logger.rs +++ b/src/process/ana_proc/interface/logger.rs @@ -25,6 +25,7 @@ use crate::core::language::position::position::Position; use crate::core::execution::trace::trace::TraceAction; use crate::process::abstract_proc::common::FilterEliminationKind; use crate::process::ana_proc::interface::step::SimulationStepKind; +use crate::process::ana_proc::logic::anakind::AnalysisKind; use crate::process::ana_proc::logic::flags::MultiTraceAnalysisFlags; use crate::process::ana_proc::logic::verdicts::CoverageVerdict; @@ -81,4 +82,14 @@ pub trait AnalysisLogger { parent_state_id : u32, verdict : &CoverageVerdict); + fn log_out_on_local_analysis(&mut self, + gen_ctx : &GeneralContext, + parent_state_id : u32, + verdict : &CoverageVerdict, + parent_analysis_kind : &AnalysisKind, + local_coloc : &CoLocalizations, + local_interaction : &Interaction, + local_multi_trace : &MultiTrace, + local_flags : &MultiTraceAnalysisFlags); + } diff --git a/src/process/ana_proc/logic/anakind.rs b/src/process/ana_proc/logic/anakind.rs index ff9cccc..a7ab35f 100644 --- a/src/process/ana_proc/logic/anakind.rs +++ b/src/process/ana_proc/logic/anakind.rs @@ -209,7 +209,7 @@ impl std::string::ToString for AnalysisKind { #[derive(Clone, PartialEq, Debug)] pub enum UseLocalAnalysis { No, - Yes(bool) + Yes } @@ -219,13 +219,8 @@ impl std::string::ToString for UseLocalAnalysis { UseLocalAnalysis::No => { return "No".to_string(); }, - UseLocalAnalysis::Yes(only_front) => { - if *only_front { - return "Only front".to_string(); - } - else { - return "Yes".to_string(); - } + UseLocalAnalysis::Yes => { + return "Yes".to_string(); } } } diff --git a/src/process/ana_proc/logic/local_analysis.rs b/src/process/ana_proc/logic/local_analysis.rs index 0f51913..355603b 100644 --- a/src/process/ana_proc/logic/local_analysis.rs +++ b/src/process/ana_proc/logic/local_analysis.rs @@ -15,6 +15,7 @@ limitations under the License. */ +use std::collections::HashSet; use crate::core::colocalizations::CoLocalizations; use crate::core::execution::trace::multitrace::{MultiTrace, Trace}; use crate::core::general_context::GeneralContext; @@ -24,23 +25,55 @@ use crate::process::abstract_proc::common::HibouSearchStrategy; use crate::process::abstract_proc::manager::GenericProcessPriorities; use crate::process::ana_proc::logic::anakind::{AnalysisKind, UseLocalAnalysis}; use crate::process::ana_proc::interface::filter::AnalysisFilter; +use crate::process::ana_proc::interface::logger::AnalysisLogger; use crate::process::ana_proc::manager::AnalysisProcessManager; use crate::process::ana_proc::interface::priorities::AnalysisPriorities; use crate::process::ana_proc::logic::flags::{MultiTraceAnalysisFlags, TraceAnalysisFlags}; use crate::process::ana_proc::logic::verdicts::GlobalVerdict; + + +pub fn get_local_analysis_starting_data(gen_ctx : &GeneralContext, + canal_id : usize, + co_localizations : &CoLocalizations, + interaction : &Interaction, + multi_trace : &MultiTrace, + flags : &MultiTraceAnalysisFlags) -> (CoLocalizations,Interaction,MultiTrace,MultiTraceAnalysisFlags) { + let local_coloc : CoLocalizations; + let locs_lf_ids : &HashSet = co_localizations.locs_lf_ids.get(canal_id).unwrap(); + local_coloc = CoLocalizations::new(vec![locs_lf_ids.clone()]); + // *** + let local_interaction : Interaction; + { + let mut lfs_to_remove = gen_ctx.get_all_lfs_ids(); + for lf_id in locs_lf_ids { + lfs_to_remove.remove( lf_id ); + } + local_interaction = interaction.hide(&lfs_to_remove); + } + // *** + let canal_trace: &Trace = multi_trace.get(canal_id).unwrap(); + let local_multi_trace : MultiTrace = vec![canal_trace.clone()]; + // *** + let canal_flags: &TraceAnalysisFlags = flags.canals.get(canal_id).unwrap(); + let local_flags : MultiTraceAnalysisFlags = MultiTraceAnalysisFlags::new(vec![canal_flags.clone()], flags.rem_loop_in_sim, flags.rem_act_in_sim); + // *** + return (local_coloc,local_interaction,local_multi_trace,local_flags); +} + + pub fn is_dead_local_analysis(gen_ctx : &GeneralContext, co_localizations : &CoLocalizations, parent_analysis_kind : &AnalysisKind, use_locana : &UseLocalAnalysis, interaction : &Interaction, multi_trace : &MultiTrace, - flags : &mut MultiTraceAnalysisFlags) -> bool { + flags : &mut MultiTraceAnalysisFlags) -> Option { match use_locana { UseLocalAnalysis::No => { - // nothing + // *** }, - UseLocalAnalysis::Yes(only_front) => { + UseLocalAnalysis::Yes => { for (canal_id, colocalized_lfs) in co_localizations.locs_lf_ids.iter().enumerate() { let canal_flags: &mut TraceAnalysisFlags = flags.canals.get_mut(canal_id).unwrap(); let canal_trace: &Trace = multi_trace.get(canal_id).unwrap(); @@ -57,12 +90,12 @@ pub fn is_dead_local_analysis(gen_ctx : &GeneralContext, local_interaction = interaction.hide(&lfs_to_remove); } let local_coloc = CoLocalizations::new(vec![colocalized_lfs.clone()]); - match perform_local_analysis(gen_ctx,local_coloc,parent_analysis_kind,local_interaction,local_multi_trace,local_flags,*only_front) { + match perform_local_analysis(gen_ctx,local_coloc,parent_analysis_kind,local_interaction,local_multi_trace,local_flags,vec![]) { GlobalVerdict::Fail => { - return true; + return Some(canal_id); }, GlobalVerdict::WeakFail => { - return true; + return Some(canal_id); }, _ => {} } @@ -72,19 +105,19 @@ pub fn is_dead_local_analysis(gen_ctx : &GeneralContext, } } } - return false; + return None; } -fn perform_local_analysis(gen_ctx : &GeneralContext, +pub fn perform_local_analysis(gen_ctx : &GeneralContext, local_coloc : CoLocalizations, parent_analysis_kind : &AnalysisKind, local_interaction : Interaction, local_multi_trace : MultiTrace, local_flags : MultiTraceAnalysisFlags, - only_front : bool) -> GlobalVerdict { + loggers:Vec>) -> GlobalVerdict { // *** let local_analysis_kind : AnalysisKind; match parent_analysis_kind { @@ -103,9 +136,6 @@ fn perform_local_analysis(gen_ctx : &GeneralContext, let new_gen_ctx= gen_ctx.clone(); // *** let mut locana_filters : Vec = vec![]; - if only_front { - locana_filters.push( AnalysisFilter::MaxProcessDepth(1) ); - } // *** let mut local_analysis_manager = AnalysisProcessManager::new(new_gen_ctx, local_coloc, @@ -113,7 +143,7 @@ fn perform_local_analysis(gen_ctx : &GeneralContext, HibouSearchStrategy::DFS, locana_filters, GenericProcessPriorities::Specific(AnalysisPriorities::default()), - vec![], + loggers, local_analysis_kind, UseLocalAnalysis::No, Some(GlobalVerdict::WeakPass) diff --git a/src/process/ana_proc/manager.rs b/src/process/ana_proc/manager.rs index 1ae8891..70642c8 100644 --- a/src/process/ana_proc/manager.rs +++ b/src/process/ana_proc/manager.rs @@ -39,7 +39,7 @@ use crate::process::ana_proc::interface::logger::AnalysisLogger; use crate::process::ana_proc::interface::node::AnalysisNodeKind; use crate::process::ana_proc::interface::step::{AnalysisStepKind, SimulationStepKind}; use crate::process::ana_proc::logic::flags::{MultiTraceAnalysisFlags, WasMultiTraceConsumedWithSimulation}; -use crate::process::ana_proc::logic::local_analysis::is_dead_local_analysis; +use crate::process::ana_proc::logic::local_analysis::{get_local_analysis_starting_data, is_dead_local_analysis}; //use crate::process::ana_proc::logic::local_analysis::is_dead_local_analysis; use crate::process::ana_proc::logic::verdicts::{CoverageVerdict, GlobalVerdict, InconcReason, update_global_verdict_from_new_coverage_verdict}; @@ -178,24 +178,6 @@ impl AnalysisProcessManager { let mut to_enqueue : Vec> = Vec::new(); // *** if !node_kind.flags.is_multi_trace_empty(&self.multi_trace) { - // *** - if is_dead_local_analysis(&self.manager.gen_ctx, - &self.co_localizations, - &self.ana_kind, - &self.use_locana, - &node_kind.interaction, - &self.multi_trace, - &mut node_kind.flags) { - let verdict : CoverageVerdict; - if self.ana_kind.has_simulation() { - verdict = CoverageVerdict::OutSim(true); - } else { - verdict = CoverageVerdict::Out(true); - } - self.verdict_loggers(&verdict,parent_id); - return Some( verdict ); - } - // *** // *** match &self.ana_kind { &AnalysisKind::Accept => { @@ -240,6 +222,38 @@ impl AnalysisProcessManager { } // *** if id_as_child > 0 { + // *** + match is_dead_local_analysis(&self.manager.gen_ctx, + &self.co_localizations, + &self.ana_kind, + &self.use_locana, + &node_kind.interaction, + &self.multi_trace, + &mut node_kind.flags) { + None => {}, + Some( fail_on_canal_id ) => { + let (local_coloc,local_interaction,local_multi_trace,local_flags) = get_local_analysis_starting_data(&self.manager.gen_ctx, + fail_on_canal_id, + &self.co_localizations, + &node_kind.interaction, + &self.multi_trace, + &node_kind.flags); + let verdict : CoverageVerdict; + if self.ana_kind.has_simulation() { + verdict = CoverageVerdict::OutSim(true); + } else { + verdict = CoverageVerdict::Out(true); + } + self.verdict_out_on_local_analysis(&verdict, + parent_id, + &local_coloc, + &local_interaction, + &local_multi_trace, + &local_flags); + return Some( verdict ); + } + } + // *** let remaining_ids_to_process : HashSet = HashSet::from_iter((1..(id_as_child+1)).collect::>().iter().cloned() ); let generic_node = GenericNode{kind:node_kind,remaining_ids_to_process,depth:ana_depth}; self.manager.remember_state( parent_id, generic_node ); @@ -452,6 +466,25 @@ impl AnalysisProcessManager { } } + pub fn verdict_out_on_local_analysis(&mut self, + verdict : &CoverageVerdict, + parent_state_id : u32, + local_coloc : &CoLocalizations, + local_interaction : &Interaction, + local_multi_trace : &MultiTrace, + local_flags : &MultiTraceAnalysisFlags) { + for logger in self.manager.loggers.iter_mut() { + logger.log_out_on_local_analysis(&self.manager.gen_ctx, + parent_state_id, + verdict, + &self.ana_kind, + local_coloc, + local_interaction, + local_multi_trace, + local_flags); + } + } + fn term_loggers(&mut self, verdict : &GlobalVerdict) { let mut options_as_strs = (&self).manager.get_basic_options_as_strings(); diff --git a/src/process/canon_proc/interface/step.rs b/src/process/canon_proc/interface/step.rs index 2f366bd..26bcd7f 100644 --- a/src/process/canon_proc/interface/step.rs +++ b/src/process/canon_proc/interface/step.rs @@ -15,7 +15,7 @@ limitations under the License. */ -use crate::core::transformation::transfodef::InteractionTransformation; +use crate::core::transformation::transfores::InteractionTransformationResult; use crate::core::transformation::transfokind::InteractionTransformationKind; use crate::process::abstract_proc::generic::AbstractStepKind; use crate::process::canon_proc::interface::conf::CanonizationConfig; @@ -25,7 +25,7 @@ use crate::process::canon_proc::interface::priorities::CanonizationPriorities; pub enum CanonizationStepKind { - Transform(InteractionTransformation), + Transform(InteractionTransformationResult), ChangePhase } @@ -43,9 +43,9 @@ impl AbstractStepKind for CanonizationStepKind { InteractionTransformationKind::Simpl => { priority += process_priorities.simpl; }, - InteractionTransformationKind::FlushLeft => { + /*InteractionTransformationKind::FlushLeft => { priority += process_priorities.flush; - }, + },*/ InteractionTransformationKind::FlushRight => { priority += process_priorities.flush; }, @@ -82,16 +82,16 @@ impl AbstractStepKind for CanonizationStepKind { InteractionTransformationKind::LoopSimpl => { priority += process_priorities.simpl; }, - InteractionTransformationKind::LoopAltSimpl => { + /*InteractionTransformationKind::LoopAltSimpl => { priority += process_priorities.simpl; - }, + },*/ InteractionTransformationKind::LoopUnNest => { priority += process_priorities.simpl; }, InteractionTransformationKind::SortActionContent => { priority += process_priorities.simpl; }, - // *** + /* InteractionTransformationKind::MergeShiftLeft1 => { // nothing }, @@ -112,7 +112,7 @@ impl AbstractStepKind for CanonizationStepKind { }, InteractionTransformationKind::MergeAction => { // nothing - } + }*/ } // *** return priority; diff --git a/src/process/canon_proc/manager.rs b/src/process/canon_proc/manager.rs index b356f61..347f6e0 100644 --- a/src/process/canon_proc/manager.rs +++ b/src/process/canon_proc/manager.rs @@ -20,8 +20,9 @@ use std::iter::FromIterator; use crate::core::general_context::GeneralContext; use crate::core::language::syntax::interaction::Interaction; use crate::core::language::position::position::Position; -use crate::core::transformation::transfodef::InteractionTransformation; use crate::core::transformation::transfokind::InteractionTransformationKind; +use crate::core::transformation::transfophase::InteractionTransformationPhase; +use crate::core::transformation::transfores::InteractionTransformationResult; use crate::process::abstract_proc::common::{FilterEliminationKind, HibouSearchStrategy}; use crate::process::abstract_proc::generic::{GenericNode, GenericStep}; use crate::process::abstract_proc::manager::{GenericProcessManager, GenericProcessPriorities}; @@ -30,8 +31,7 @@ use crate::process::canon_proc::interface::filter::{CanonizationFilter, Canoniza use crate::process::canon_proc::interface::logger::CanonizationLogger; use crate::process::canon_proc::interface::node::CanonizationNodeKind; use crate::process::canon_proc::interface::step::CanonizationStepKind; -use crate::process::canon_proc::transformations::get_transfos::get_canonize_transfos; -use crate::process::canon_proc::transformations::phases::CanonizationPhase; +use crate::process::canon_proc::transformations::phases::{CanonizationPhase, transfos_phase1, transfos_phase2}; @@ -43,14 +43,26 @@ pub enum IntRefOrOldIdRef<'l> { pub struct CanonizationProcessManager { pub(crate) manager: GenericProcessManager, - pub(crate) get_all_transfos : bool, pub(crate) node_has_child_interaction : HashSet, + phase1 : InteractionTransformationPhase, + phase2 : InteractionTransformationPhase, phase1_known : HashMap, // interaction term and corresponding state id phase2_known : HashMap // interaction term and corresponding state id } impl CanonizationProcessManager { + pub fn get_transo_phase(&self,canon_phase : &CanonizationPhase) -> &InteractionTransformationPhase { + match canon_phase { + CanonizationPhase::FirstDefactorize => { + return &self.phase1; + }, + CanonizationPhase::SecondFactorize => { + return &self.phase2; + } + } + } + pub fn new(gen_ctx : GeneralContext, strategy : HibouSearchStrategy, filters : Vec, @@ -65,8 +77,9 @@ impl CanonizationProcessManager { loggers ); return CanonizationProcessManager{manager, - get_all_transfos, node_has_child_interaction:HashSet::new(), + phase1 : InteractionTransformationPhase::new(transfos_phase1(),get_all_transfos,false), + phase2 : InteractionTransformationPhase::new(transfos_phase2(),get_all_transfos,false), phase1_known:HashMap::new(), phase2_known:HashMap::new()}; } @@ -127,7 +140,7 @@ impl CanonizationProcessManager { phase : CanonizationPhase, depth : u32) { // *** - let transfos = get_canonize_transfos(&interaction,&phase,self.get_all_transfos); + let transfos = self.get_transo_phase(&phase).apply_phase(&interaction); // *** let mut id_as_child : u32 = 0; // *** @@ -226,7 +239,7 @@ impl CanonizationProcessManager { fn process_new_transformation_step(&mut self, parent_state : &GenericNode, - transfo : InteractionTransformation, + transfo : InteractionTransformationResult, parent_id : u32, new_state_id : u32, node_counter : u32) -> Option<(Interaction,u32,CanonizationPhase)> { @@ -260,7 +273,7 @@ impl CanonizationProcessManager { fn term_loggers(&mut self) { let mut options_as_strs = (&self).manager.get_basic_options_as_strings(); options_as_strs.insert(0, "process=canonization".to_string()); - options_as_strs.push( format!("search_all={}", self.get_all_transfos.to_string()) ); + options_as_strs.push( format!("search_all={}", self.phase1.get_all.to_string()) ); for logger in self.manager.loggers.iter_mut() { (*logger).log_term(&options_as_strs); } diff --git a/src/process/canon_proc/transformations/get_transfos.rs b/src/process/canon_proc/transformations/get_transfos.rs deleted file mode 100644 index 7ce6431..0000000 --- a/src/process/canon_proc/transformations/get_transfos.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright 2020 Erwan Mahe (github.com/erwanM974) - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -use crate::core::language::syntax::interaction::Interaction; -use crate::core::transformation::get_transfos::get_transfos::get_transfos; -use crate::core::transformation::transfodef::InteractionTransformation; -use crate::process::canon_proc::transformations::phases::{CanonizationPhase, transfos_phase1, transfos_phase2}; - - -pub fn get_canonize_transfos(interaction : &Interaction, phase : &CanonizationPhase, get_all : bool) -> Vec { - match phase { - CanonizationPhase::FirstDefactorize => { - return get_transfos(interaction,get_all,&transfos_phase1()); - }, - CanonizationPhase::SecondFactorize => { - return get_transfos(interaction,get_all,&transfos_phase2()); - } - } -} - diff --git a/src/process/canon_proc/transformations/mod.rs b/src/process/canon_proc/transformations/mod.rs index 9d42569..8a83dae 100644 --- a/src/process/canon_proc/transformations/mod.rs +++ b/src/process/canon_proc/transformations/mod.rs @@ -17,7 +17,6 @@ limitations under the License. pub mod phases; -pub mod get_transfos; diff --git a/src/process/canon_proc/transformations/phases.rs b/src/process/canon_proc/transformations/phases.rs index 21ef7a7..2ec7a20 100644 --- a/src/process/canon_proc/transformations/phases.rs +++ b/src/process/canon_proc/transformations/phases.rs @@ -16,21 +16,10 @@ limitations under the License. -use crate::core::language::syntax::interaction::Interaction; -use crate::core::transformation::transfofunc::action::*; -use crate::core::transformation::transfofunc::dedupl::*; -use crate::core::transformation::transfofunc::defactorize::*; -use crate::core::transformation::transfofunc::factorize_par::factorize_par; -use crate::core::transformation::transfofunc::factorize_prefix::*; -use crate::core::transformation::transfofunc::factorize_suffix::*; -use crate::core::transformation::transfofunc::flush::*; -use crate::core::transformation::transfofunc::invert::*; -use crate::core::transformation::transfofunc::loop_alt_simpl::loop_alt_simpl; -use crate::core::transformation::transfofunc::loop_simpl::*; -use crate::core::transformation::transfofunc::simpl::*; use crate::core::transformation::transfokind::InteractionTransformationKind; + #[derive(Clone, PartialEq, Debug, Eq, Hash)] pub enum CanonizationPhase { FirstDefactorize, @@ -50,42 +39,40 @@ impl CanonizationPhase { } } -pub fn transfos_phase1<'lifetime>() -> Vec<(InteractionTransformationKind, &'lifetime dyn Fn(&Interaction) -> Vec)> { +pub fn transfos_phase1() -> Vec { return vec![ - (InteractionTransformationKind::Deduplicate,&deduplicate), - (InteractionTransformationKind::Simpl,&simpl), - (InteractionTransformationKind::FlushRight,&flush_right), - (InteractionTransformationKind::InvertPar,&invert_par_sorted), - (InteractionTransformationKind::InvertAlt,&invert_alt_sorted), - (InteractionTransformationKind::LoopSimpl,&loop_empty_simpl), - (InteractionTransformationKind::LoopUnNest,&loop_unnest), - (InteractionTransformationKind::LoopAltSimpl,&loop_alt_simpl), + InteractionTransformationKind::Deduplicate, + InteractionTransformationKind::Simpl, + InteractionTransformationKind::FlushRight, + InteractionTransformationKind::InvertPar, + InteractionTransformationKind::InvertAlt, + InteractionTransformationKind::LoopSimpl, + InteractionTransformationKind::LoopUnNest, // *** - (InteractionTransformationKind::DeFactorizeLeft,&defactorize_left), - (InteractionTransformationKind::DeFactorizeRight,&defactorize_right), + InteractionTransformationKind::DeFactorizeLeft, + InteractionTransformationKind::DeFactorizeRight, // *** - (InteractionTransformationKind::SortActionContent,&sort_action_content) + InteractionTransformationKind::SortActionContent ]; } -pub fn transfos_phase2<'lifetime>() -> Vec<(InteractionTransformationKind, &'lifetime dyn Fn(&Interaction) -> Vec)> { +pub fn transfos_phase2() -> Vec { return vec![ - (InteractionTransformationKind::Deduplicate,&deduplicate), - (InteractionTransformationKind::Simpl,&simpl), - (InteractionTransformationKind::FlushRight,&flush_right), - (InteractionTransformationKind::InvertPar,&invert_par_sorted), - (InteractionTransformationKind::InvertAlt,&invert_alt_sorted), - (InteractionTransformationKind::LoopSimpl,&loop_empty_simpl), - (InteractionTransformationKind::LoopUnNest,&loop_unnest), - (InteractionTransformationKind::LoopAltSimpl,&loop_alt_simpl), + InteractionTransformationKind::Deduplicate, + InteractionTransformationKind::Simpl, + InteractionTransformationKind::FlushRight, + InteractionTransformationKind::InvertPar, + InteractionTransformationKind::InvertAlt, + InteractionTransformationKind::LoopSimpl, + InteractionTransformationKind::LoopUnNest, // *** - (InteractionTransformationKind::FactorizePrefixStrict,&factorize_prefix_strict), - (InteractionTransformationKind::FactorizePrefixSeq,&factorize_prefix_seq), - (InteractionTransformationKind::FactorizeSuffixStrict,&factorize_suffix_strict), - (InteractionTransformationKind::FactorizeSuffixSeq,&factorize_suffix_seq), - (InteractionTransformationKind::FactorizeCommutativePar,&factorize_par), + InteractionTransformationKind::FactorizePrefixStrict, + InteractionTransformationKind::FactorizePrefixSeq, + InteractionTransformationKind::FactorizeSuffixStrict, + InteractionTransformationKind::FactorizeSuffixSeq, + InteractionTransformationKind::FactorizeCommutativePar, // *** - (InteractionTransformationKind::SortActionContent,&sort_action_content) + InteractionTransformationKind::SortActionContent ]; } diff --git a/src/ui/hibou_cli.yml b/src/ui/hibou_cli.yml index a25209f..91a2d39 100644 --- a/src/ui/hibou_cli.yml +++ b/src/ui/hibou_cli.yml @@ -16,13 +16,13 @@ name: hibou_label -version: "0.8.1" +version: "0.8.2" author: Erwan Mahe about: Holistic Interaction Behavioral Oracle Utility - hibou provides utilities for manipulating interaction models (sequence diagrams/sequence charts) subcommands: - draw: about: utility to draw an interaction either as a sequence diagram or a term tree - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -45,7 +45,7 @@ subcommands: help: kind of representation (either sequence diagram 'sd' or term tree 'tt') - canonize: about: utility to compute the normal form of an interaction - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -62,7 +62,7 @@ subcommands: help: input hibou configuration file - explore: about: utility to explore the semantics of an interaction - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -79,7 +79,7 @@ subcommands: help: input hibou configuration file - analyze: about: utility to analyze a (multi-)trace w.r.t. an interaction - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -100,7 +100,7 @@ subcommands: help: input hibou configuration file - slice: about: utility to generate slices of a (multi-)trace - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -138,7 +138,7 @@ subcommands: help: a name for prefixing generated files names - mutate_insert_noise: about: utility to generate generate a mutant from a multi-trace by inserting noise actions - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -176,7 +176,7 @@ subcommands: help: maximum number of inserts (default 1), actual number can be lower due other parameters - mutate_swap_actions: about: utility to generate generate a mutant from a multi-trace by swaping positions of actions within its component traces - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -204,7 +204,7 @@ subcommands: help: maximum number of swaps (default 1), actual number can be lower due to multi-trace size - mutate_swap_components: about: utility to generate generate a mutant from two multi-traces by swaping their respective component traces - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -236,7 +236,7 @@ subcommands: help: maximum number of swaps (default 1), actual number can be lower due to multi-trace size - puml_sd: about: utility to translate an interaction into a .puml informal sequence diagram spec (.puml) - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: @@ -249,7 +249,7 @@ subcommands: help: input hibou interaction file - puml_ap: about: utility to translate an interaction into a .puml informal automata product spec (.puml) - version: "0.8.1" + version: "0.8.2" author: Erwan Mahe args: - hsf: diff --git a/src/ui/util/printing.rs b/src/ui/util/printing.rs index 565ed38..735ebe7 100644 --- a/src/ui/util/printing.rs +++ b/src/ui/util/printing.rs @@ -30,7 +30,7 @@ fn get_ascii_left() -> Vec<&'static str> { my_vec.push(r#"-"-"- Oracle "#); my_vec.push(r#" \_/ Utility "#); my_vec.push(r#" "#); - my_vec.push(r#" V-label-0.8.1 "#); + my_vec.push(r#" V-label-0.8.2 "#); return my_vec; }