module generic {
	

//module parameters
modulepar boolean mp_boolean := true;
modulepar { integer mp_int1, mp_int2 := 2; integer mp_int3 := 3;}


//full function body with multiple parameters, including passing modes, runs on clause and return value
function f_sample2 ( 
  template R3Msg p_radiusAccntReq, 
  out template R3Msg p_radiusAccntRsp ) 
runs on R3Comp 
return FncRetCode {
  var FncRetCode v_ret := e_success;

  alt {
    [] r3Port.receive ( m_r3MonitorInd ( p_radiusAccntReq ) ) {
      v_ret := e_success;
    }
    [] r3Port.receive ( m_r3MonitorInd ( 
                          e_RadiusAccountingRequest,
                          p_radiusAccntReq ) ) {
      v_ret := e_success;
    }
    [] r3Port.receive ( m_r3MonitorInd (
                          e_RadiusAccountingRequest,
                          m_radiusAccntReq_any ) ) {
      return e_error;
    }
  } 
  return v_ret;
}   
//function skeleton with a single parameter, including a passing mode, with a runs on clause
function f_sample1 (in template R3Msg p_radiusAccntReq) 
	runs on R3Comp {
}

//function skeleton with a single parameter, with a runs on clause 
function f_sample11 (template R3Msg p_radiusAccntReq) 
	runs on R3Comp {
}

//function skeleton without parameters, with a return value
function f_sample () 
	return r {
}

//full function body with multiple parameters, including passing modes, no further clauses
function f_sample21( 
  template R3Msg p_radiusAccntReq, 
  out template R3Msg p_radiusAccntRsp ) {

  var integer v_var1 := 0;
  var integer v_var2 := 10;
  
  while (v_var1 < v_var2){
  	v_var1:=v_var1+1;
  }
  
}


//altstep skeleton without parameters
altstep a_sample () 
	runs on R3Comp {
}

//altstep with full body, multiple parameters, with passing modes and a runs on clause

altstep a_sample2 ( template R3Msg p_radiusAccntReq, inout template R3Msg p_radiusAccntRsp ) 
	runs on R3Comp {

[] r3Port.receive ( m_r3MonitorInd ( p_radiusAccntReq ) ) {
      v_ret := e_success;
    }
    [] r3Port.receive ( m_r3MonitorInd ( 
                          e_RadiusAccountingRequest,
                          p_radiusAccntReq ) ) {
      v_ret := e_success;
    }
 }


//altstep skeleton with a single parameter
altstep a_sample1 (template R3Msg p_radiusAccntReq) {
}

//sample test case with full body, multiple parameters, with modifiers, runs on and system clauses
testcase tc_sample2 ( 
  template R3Msg p_radiusAccntReq, 
  out template R3Msg p_radiusAccntRsp ) 
runs on R3Comp 
system R3System {
  var FncRetCode v_ret := e_success;

  alt {
    [] r3Port.receive ( m_r3MonitorInd ( p_radiusAccntReq ) ) {
      v_ret := e_success;
    }
    [] r3Port.receive ( m_r3MonitorInd ( 
                          e_RadiusAccountingRequest,
                          p_radiusAccntReq ) ) {
      v_ret := e_success;
    }
    [] r3Port.receive ( m_r3MonitorInd (
                          e_RadiusAccountingRequest,
                          m_radiusAccntReq_any ) ) {
    }
    [] a_sample2 (m_r3MonitorInd,m_r3MonitorInd);
    [] a_sample1 (m_r3MonitorInd);
    [] a_sample0 ();
  }

}   
//sample test case skeleton with a single parameter, including a passing mode, with a runs on clause
testcase tc_sample1 (in template R3Msg p_radiusAccntReq) 
	runs on R3Comp {
}

//test tcase skeleton with a single parameter, with a runs on clause and a system clause 
testcase tc_sample11 (template R3Msg p_radiusAccntReq) 
	runs on R3Comp system R3System {
	f_sample();
	f_sample1(p_radiusAccntReq);
	f_sample2(p_radiusAccntReq,p_radiusAccntRsp) 
}

//test case skeleton without parameters, with a runs on clause
testcase tc_sample () 
	runs on R3Comp {
}

	//template with a single parameter
	template type1 template1 (integer i) :={
		int1 :=i,
		int2 :=2
	}

	template type1 template11 (integer i) modifies template1 :={
		int1 :=i,
		int2 :=4 
	}



	//template with multiple parameters
	template type1 template2 (integer i1, integer i2) :={
		int1 :=i1,
		int2 :=i2
	}

	
	signature s_lookup () return charstring exception (e_NotFound);

	signature s_accept () return charstring exception (e_NotFound);

	
	signature s_lookup1 (in charstring key) return charstring exception (e_NotFound);
	
	signature s_lookup2 (in charstring key, in charstring id) return charstring exception (e_NotFound);
	
	signature s_lookup3 (in charstring key, in charstring id, inout integer state) return charstring exception (e_NotFound);
	
	//not clear if legal, or useful...
	//parser seems to fail
	//it is legal
	type record type2 (integer i1, integer i2) {
		integer range (i1 .. i2)
	}

	type integer range2 (1 .. 10);

	//this should also be legal although maybe not in the current version
	//the above is an indirect version
	//type integer intRange (integer min, integer max ) (min .. max);
	const type2(1,10) c_range := 3;
	
	//type integer binary (0,1);
	//type integer octary (0 .. 7);

	//illegal 
	//type record type3 (integer i1, integer i2) {
	//	i1 binary,
	//	i2 octary
	//}
	
	testcase tc_sample_procedurebased() runs on sampleComponent system systemComponent{
		port1.call(s_lookup:{x}) {
			[]port1.getreply(s_accept:{y}) {
			
			}
		}
	}
	
	control{
		execute(tc_sample1(template_sample1));
		execute(tc_sample2(template_sample1,template_sample2));
		execute(tc_sample());
	}
	

	
}