summaryrefslogblamecommitdiff
path: root/tests/source/NestedControl.scade
blob: af4fdab1a0b502104b2f77999abb8cbff80e1e79 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                                       
                      



                            


                                                 




































                                            
node root(In : int; C : bool) returns (Out, Out1 : int)
var last_Out, last_Out1: int;
    disj, disj2: bool;
let
  last_Out = 0 -> pre Out;
  last_Out1 = 0 -> pre Out1;

  disj = In > 0;
  disj2 = In < 0;
  assume C_in_not_null: (not C) or disj or disj2;

  automaton SM1
    initial state State1
      let
        Out1 = 2;
        Out = 3;
      tel
      until
        if C resume State2;
    
    state State2
      let
        automaton SM2
          initial state State3
            Out1 = 1;
            until
              if C resume State4;
          
          state State4
            activate if C
              then let
                guarantee no_mod0: Out <> 0;
                Out1 = In mod Out;
              tel else Out1 = last_Out1;
            returns Out1;
            
        returns Out1;
        
        activate if C
          then Out = In;
          else Out = last_Out;
        returns Out;
        
      tel
    
  returns Out, Out1;
tel