source: trunk/t3q-examples/CodeFormatting/functions.ttcn3 @ 22

Last change on this file since 22 was 4, checked in by phdmakk, 14 years ago
File size: 1.5 KB
Line 
1module functions {
2//full function body with multiple parameters, including passing modes, runs on clause and return value
3function f_sample2 (
4  template R3Msg p_radiusAccntReq,
5  out template R3Msg p_radiusAccntRsp )
6runs on R3Comp
7return FncRetCode {
8  var FncRetCode v_ret := e_success;
9
10  alt {
11    [] r3Port.receive ( m_r3MonitorInd ( p_radiusAccntReq ) ) {
12      v_ret := e_success;
13    }
14    [] r3Port.receive ( m_r3MonitorInd (
15                          e_RadiusAccountingRequest,
16                          p_radiusAccntReq ) ) {
17      v_ret := e_success;
18    }
19    [] r3Port.receive ( m_r3MonitorInd (
20                          e_RadiusAccountingRequest,
21                          m_radiusAccntReq_any ) ) {
22      return e_error;
23    }
24  }
25  return v_ret;
26}   
27//function skeleton with a single parameter, including a passing mode, with a runs on clause
28function f_sample1 (in template R3Msg p_radiusAccntReq)
29        runs on R3Comp {
30}
31
32//function skeleton with a single parameter, with a runs on clause
33function f_sample11 (template R3Msg p_radiusAccntReq)
34        runs on R3Comp {
35}
36
37//function skeleton without parameters, with a return value
38function f_sample ()
39        return r {
40}
41
42//full function body with multiple parameters, including passing modes, no further clauses
43function f_sample21( template R3Msg p_radiusAccntReq, out template R3Msg p_radiusAccntRsp ) {
44
45  var integer v_var1 := 0;
46  var integer v_var2 := 10;
47 
48  while (v_var1 < v_var2){
49        v_var1:=v_var1+1;
50  }
51 
52}
53       
54}
Note: See TracBrowser for help on using the repository browser.