1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
12 * Szabo, Janos Zoltan – initial implementation
14 ******************************************************************************/
17 unsigned int get_timer_array_index(int index_value
, unsigned int array_size
,
20 if (index_value
< index_offset
) TTCN_error("Index underflow when accessing "
21 "an element of a timer array. The index value should be between %d and %d "
22 "instead of %d.", index_offset
, index_offset
+ array_size
- 1, index_value
);
23 unsigned int ret_val
= index_value
- index_offset
;
24 if (ret_val
>= array_size
)
25 TTCN_error("Index overflow when accessing an element of a timer array. "
26 "The index value should be between %d and %d instead of %d.", index_offset
,
27 index_offset
+ array_size
- 1, index_value
);
31 unsigned int get_timer_array_index(const INTEGER
& index_value
,
32 unsigned int array_size
, int index_offset
)
34 if (!index_value
.is_bound()) TTCN_error("Accessing an element of a timer "
35 "array using an unbound index.");
36 return get_timer_array_index((int)index_value
, array_size
, index_offset
);
39 unsigned int get_port_array_index(int index_value
, unsigned int array_size
,
42 if (index_value
< index_offset
) TTCN_error("Index underflow when accessing "
43 "an element of a port array. The index value should be between %d and %d "
44 "instead of %d.", index_offset
, index_offset
+ array_size
- 1, index_value
);
45 unsigned int ret_val
= index_value
- index_offset
;
46 if (ret_val
>= array_size
)
47 TTCN_error("Index overflow when accessing an element of a port array. "
48 "The index value should be between %d and %d instead of %d.", index_offset
,
49 index_offset
+ array_size
- 1, index_value
);
53 unsigned int get_port_array_index(const INTEGER
& index_value
,
54 unsigned int array_size
, int index_offset
)
56 if (!index_value
.is_bound()) TTCN_error("Accessing an element of a port "
57 "array using an unbound index.");
58 return get_timer_array_index((int)index_value
, array_size
, index_offset
);
61 ////////////////////////////////////////////////////////////////////////////////
63 unsigned int get_array_index(int index_value
, unsigned int array_size
,
66 if (index_value
< index_offset
) TTCN_error("Index underflow when accessing "
67 "an element of an array. The index value should be between %d and %d "
68 "instead of %d.", index_offset
, index_offset
+ array_size
- 1, index_value
);
69 unsigned int ret_val
= index_value
- index_offset
;
70 if (ret_val
>= array_size
)
71 TTCN_error("Index overflow when accessing an element of an array. "
72 "The index value should be between %d and %d instead of %d.", index_offset
,
73 index_offset
+ array_size
- 1, index_value
);
77 unsigned int get_array_index(const INTEGER
& index_value
,
78 unsigned int array_size
, int index_offset
)
80 if (!index_value
.is_bound()) TTCN_error("Accessing an element of an "
81 "array using an unbound index.");
82 return get_array_index((int)index_value
, array_size
, index_offset
);
This page took 0.031463 seconds and 5 git commands to generate.