| ///////////////////////////////////////////////////////////////////////////////
|
| // //
|
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Module: EPTF_CLL_UIHandler_ConvertFunctions
|
| //
|
| // Purpose:
|
| // This module contains data conversion functions
|
| //
|
| // Module Parameters:
|
| //
|
| // Module depends on:
|
| // *EPTF_CLL_Common_Definitions*
|
| //
|
| // Current Owner:
|
| // L�szl� Skum�t (ELSZSKU)
|
| //
|
| // Last Review Date:
|
| // 2007-
|
| //
|
| // Detailed Comments:
|
| // These functions are used in data display.
|
| //
|
| ///////////////////////////////////////////////////////////////
|
| module EPTF_CLL_UIHandler_ConvertFunctions
|
| // [.objid{ itu_t(0) identified_organization(4) etsi(0)
|
| // identified_organization(127) ericsson(5) testing(0)
|
| // <put further nodes here if needed>}]
|
| {
|
|
|
| import from EPTF_CLL_Common_Definitions all;
|
| import from TCCConversion_Functions all;
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_UIHandler_str2IntegerList
|
| //
|
| // Purpose:
|
| // Converts a string containing non-digit char separated
|
| // numbers into a record of integer
|
| //
|
| // Parameters:
|
| // pl_str - *in* *charstring* - element to be converted
|
| //
|
| // Return Value:
|
| // EPTF_IntegerList - the parameter value as an <EPTF_IntegerList>
|
| //
|
| // Errors:
|
| // none
|
| //
|
| // Detailed Comments:
|
| // This function supports storage of a string as a paramValue.
|
| // Non-digit chars treated as seperators
|
| ///////////////////////////////////////////////////////////
|
| public function f_EPTF_UIHandler_str2Integer(in charstring pl_str) return charstring
|
| {
|
| // example: " -1234a 5"
|
| var charstring vl_parsedIntStr := "";
|
| var integer vl_ret;
|
|
|
| for(var integer vl_xx := 0; vl_xx < lengthof(pl_str) and isbound(vl_ret) == false; vl_xx := vl_xx + 1) {
|
| // if leading space, dont sore it
|
| if(char2int(pl_str[vl_xx]) == char2int(" ") and
|
| (vl_parsedIntStr == "")) {
|
| } // leading +|- store it
|
| else if((char2int(pl_str[vl_xx]) == char2int("+") or
|
| char2int(pl_str[vl_xx]) == char2int("-") ) and
|
| (vl_parsedIntStr == "")){
|
| vl_parsedIntStr := vl_parsedIntStr & pl_str[vl_xx];
|
| } // if digit, store it
|
| else if((char2int(pl_str[vl_xx]) >= char2int("0")) and
|
| (char2int(pl_str[vl_xx]) <= char2int("9"))) {
|
| vl_parsedIntStr := vl_parsedIntStr & pl_str[vl_xx];
|
| } //else end of number
|
| else
|
| {
|
| //if found any digit
|
| if(lengthof(vl_parsedIntStr) > 0) {
|
| if(vl_parsedIntStr != "+" and vl_parsedIntStr != "-") {
|
| vl_ret := str2int(vl_parsedIntStr);
|
| } else {
|
| vl_parsedIntStr := "";
|
| vl_ret := 0;
|
| }
|
| } else {
|
| vl_ret := 0;
|
| }
|
| }
|
| }/* EndFor */
|
| if((vl_parsedIntStr == "+" or vl_parsedIntStr == "-")) {
|
| vl_parsedIntStr := "";
|
| vl_ret := 0;
|
| }
|
| return vl_parsedIntStr;
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_UIHandler_str2IntegerList
|
| //
|
| // Purpose:
|
| // Converts a string containing non-digit char separated
|
| // numbers into a record of integer
|
| //
|
| // Parameters:
|
| // pl_str - *in* *charstring* - element to be converted
|
| //
|
| // Return Value:
|
| // EPTF_IntegerList - the parameter value as an <EPTF_IntegerList>
|
| //
|
| // Errors:
|
| // none
|
| //
|
| // Detailed Comments:
|
| // This function supports storage of a string as a paramValue.
|
| // Non-digit chars treated as seperators
|
| ///////////////////////////////////////////////////////////
|
| public function f_EPTF_UIHandler_str2IntegerList(in charstring pl_str) return EPTF_IntegerList
|
| {
|
| // example: "1,x2x,3x,42 ,5y\n6"
|
| var EPTF_IntegerList vl_buffer := {};
|
| var charstring vl_parsedIntStr := "";
|
|
|
| for(var integer vl_xx := 0; vl_xx < lengthof(pl_str); vl_xx := vl_xx + 1) {
|
| // if leading space, dont sore it
|
| if(char2int(pl_str[ vl_xx]) == char2int(" ") and
|
| ( vl_parsedIntStr == "")) {
|
| } // leading +|- store it
|
| else if((char2int(pl_str[ vl_xx]) == char2int("+") or
|
| char2int(pl_str[ vl_xx]) == char2int("-") ) and
|
| ( vl_parsedIntStr == "")){
|
| vl_parsedIntStr := vl_parsedIntStr & pl_str[vl_xx];
|
| } // if digit, store it
|
| else if((char2int(pl_str[ vl_xx]) >= char2int("0")) and
|
| (char2int(pl_str[ vl_xx]) <= char2int("9"))) {
|
| vl_parsedIntStr := vl_parsedIntStr & pl_str[ vl_xx];
|
| } //else end of number
|
| else {
|
| //if found any digit
|
| if(lengthof( vl_parsedIntStr) > 0) {
|
| if((vl_parsedIntStr != "+" and vl_parsedIntStr != "-")){
|
| vl_buffer[sizeof( vl_buffer)] := str2int( vl_parsedIntStr);
|
| }
|
| vl_parsedIntStr := "";
|
| }
|
| }
|
| }
|
| // append the last number remaining in parsedIntStr
|
| if(lengthof( vl_parsedIntStr) > 0) {
|
| vl_buffer[sizeof( vl_buffer)] := str2int( vl_parsedIntStr);
|
| }
|
| return vl_buffer;
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_UIHandler_str2FloatList
|
| //
|
| // Purpose:
|
| // Converts a string containing non-digit char separated
|
| // numbers into a record of floats
|
| //
|
| // Parameters:
|
| // pl_str - *in* *charstring* - element to be converted
|
| //
|
| // Return Value:
|
| // EPTF_FloatList - the parameter value as an <EPTF_FloatList>
|
| //
|
| // Detailed Comments:
|
| // This function supports storage of a string as a paramValue.
|
| // Non-digit chars treated as seperators
|
| ///////////////////////////////////////////////////////////
|
| public function f_EPTF_UIHandler_str2FloatList(in charstring pl_str) return EPTF_FloatList
|
| {
|
| var EPTF_FloatList vl_buffer := {};
|
| var charstring vl_parsedFloatStr := "";
|
|
|
| for(var integer vl_xx := 0; vl_xx < lengthof(pl_str); vl_xx := vl_xx + 1) {
|
| // if leading space, dont sore it
|
| if(char2int(pl_str[ vl_xx]) == char2int(" ") and
|
| ( vl_parsedFloatStr == "")) {
|
| } // leading +|- store it
|
| else if((char2int(pl_str[ vl_xx]) == char2int("+") or
|
| char2int(pl_str[ vl_xx]) == char2int("-") ) and
|
| ( vl_parsedFloatStr == "")){
|
| vl_parsedFloatStr := vl_parsedFloatStr & pl_str[vl_xx];
|
| } // if digit, store it
|
| if ( ((char2int(pl_str[vl_xx]) >= char2int("0")) and (char2int(pl_str[vl_xx]) <= char2int("9"))) or
|
| (pl_str[vl_xx] == ".") ){
|
| vl_parsedFloatStr := vl_parsedFloatStr & pl_str[vl_xx];
|
| } //else end of number
|
| else {
|
| //if found any digit
|
| if(lengthof(vl_parsedFloatStr) > 0) {
|
| if((vl_parsedFloatStr != "+" and vl_parsedFloatStr != "-")){
|
| vl_buffer[sizeof(vl_buffer)] := str2float(vl_parsedFloatStr);
|
| }
|
| vl_parsedFloatStr := "";
|
| }
|
| }
|
| }
|
| // append the last number remaining in parsedFloatStr
|
| if(lengthof(vl_parsedFloatStr) > 0) {
|
| vl_buffer[sizeof(vl_buffer)] := str2float(vl_parsedFloatStr);
|
| }
|
| return vl_buffer;
|
| }
|
|
|
| ///////////////////////////////////////////////////////////
|
| // Function: f_EPTF_UIHandler_str2bool
|
| //
|
| // Purpose:
|
| // function to convert a string value to a boolean value
|
| //
|
| // Parameters:
|
| // pl_str - *in* *charstring* - string variable to convert, either "true" or "false"
|
| //
|
| // Return Value:
|
| // boolean
|
| //
|
| // Errors:
|
| // none
|
| //
|
| // Detailed Comments:
|
| // none
|
| ///////////////////////////////////////////////////////////
|
| public function f_EPTF_UIHandler_str2bool(in charstring pl_str) return boolean
|
| {
|
| if (f_putInLowercase(pl_str) == "true") { return true }
|
| else { return false }
|
| }
|
|
|
| group obsolete_ASN1_Compat_Functions {
|
| import from ttcn_ericsson_se_protocolModules_xtdp_xtdl all;
|
|
|
| friend module EPTF_CLL_UIHandler_WidgetFunctions;
|
| friend module EPTF_CLL_UIHandlerClient_Functions;
|
|
|
| friend function f_EPTF_UIHandler_convertAxisType(
|
| in universal charstring pl_axistype,
|
| out ttcn_ericsson_se_protocolModules_xtdp_xtdl.AxisType pl_axistype_out)
|
| {
|
| if (pl_axistype == "linear" or pl_axistype == "LINEAR"){
|
| pl_axistype_out := linear;
|
| }
|
| if (pl_axistype == "log10" or pl_axistype == "LOG10"){
|
| pl_axistype_out := log10;
|
| }
|
| if (pl_axistype == "logE" or pl_axistype == "LOGE"){
|
| pl_axistype_out := logE;
|
| }
|
| }
|
|
|
|
|
| }//ASN1_Compat_Functions
|
|
|
| }
|