Move f_strstr_count() Osmocom_VTY_Functions.ttcn -> Misc_Helpers.ttcn
This is quite a generic string handling function which fits better in a generic utility file like Misc_Helpers.ttcn. Change-Id: I105844d2bcab6c24624be1224c1ba78b69d4b44c
This commit is contained in:
parent
a1d113ae1e
commit
830061d271
|
@ -4,9 +4,9 @@ BASEDIR=../deps
|
||||||
|
|
||||||
. ../gen_links.sh.inc
|
. ../gen_links.sh.inc
|
||||||
|
|
||||||
#DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
|
DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
|
||||||
#FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
|
FILES="TCCConversion_Functions.ttcn TCCConversion.cc"
|
||||||
#gen_links $DIR $FILES
|
gen_links $DIR $FILES
|
||||||
|
|
||||||
DIR=$BASEDIR/titan.TestPorts.USB/src
|
DIR=$BASEDIR/titan.TestPorts.USB/src
|
||||||
FILES="USB_PT.cc USB_PT.hh USB_PortType.ttcn USB_PortTypes.ttcn USB_Templates.ttcn USB_Types.ttcn USB_Component.ttcn "
|
FILES="USB_PT.cc USB_PT.hh USB_PortType.ttcn USB_PortTypes.ttcn USB_Templates.ttcn USB_Types.ttcn USB_Component.ttcn "
|
||||||
|
|
|
@ -5,6 +5,7 @@ NAME=CCID_Tests
|
||||||
FILES="
|
FILES="
|
||||||
*.ttcn
|
*.ttcn
|
||||||
Native_FunctionDefs.cc
|
Native_FunctionDefs.cc
|
||||||
|
TCCConversion.cc
|
||||||
USB_PT.cc
|
USB_PT.cc
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Misc_Helpers {
|
module Misc_Helpers {
|
||||||
|
|
||||||
import from Native_Functions all;
|
import from Native_Functions all;
|
||||||
|
import from TCCConversion_Functions all;
|
||||||
|
|
||||||
modulepar {
|
modulepar {
|
||||||
charstring mp_osmo_repo := "nightly";
|
charstring mp_osmo_repo := "nightly";
|
||||||
|
@ -61,4 +62,21 @@ function f_addrstr2addr(charstring addr) return octetstring {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return a count of how many times sub_str occurs in str. */
|
||||||
|
function f_strstr_count(in charstring str, in charstring sub_str) return integer
|
||||||
|
{
|
||||||
|
var integer count := 0;
|
||||||
|
var integer pos := 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
var integer at := f_strstr(str, sub_str, pos);
|
||||||
|
if (at < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
count := count + 1;
|
||||||
|
pos := at + 1;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,23 +228,6 @@ function f_vty_transceive_match_regexp_retry(TELNETasp_PT pt, charstring cmd, ch
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a count of how many times sub_str occurs in str. */
|
|
||||||
function f_strstr_count(in charstring str, in charstring sub_str) return integer
|
|
||||||
{
|
|
||||||
var integer count := 0;
|
|
||||||
var integer pos := 0;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
var integer at := f_strstr(str, sub_str, pos);
|
|
||||||
if (at < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
count := count + 1;
|
|
||||||
pos := at + 1;
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
private type record of charstring StrList;
|
private type record of charstring StrList;
|
||||||
|
|
||||||
/* Perform a 'show talloc-context' to get a count of the given object_strs that are still allocated.
|
/* Perform a 'show talloc-context' to get a count of the given object_strs that are still allocated.
|
||||||
|
|
|
@ -4,9 +4,9 @@ BASEDIR=../deps
|
||||||
|
|
||||||
. ../gen_links.sh.inc
|
. ../gen_links.sh.inc
|
||||||
|
|
||||||
#DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
|
DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
|
||||||
#FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
|
FILES="TCCConversion_Functions.ttcn TCCConversion.cc"
|
||||||
#gen_links $DIR $FILES
|
gen_links $DIR $FILES
|
||||||
|
|
||||||
DIR=$BASEDIR/titan.TestPorts.USB/src
|
DIR=$BASEDIR/titan.TestPorts.USB/src
|
||||||
FILES="USB_PT.cc USB_PT.hh USB_PortType.ttcn USB_PortTypes.ttcn USB_Templates.ttcn USB_Types.ttcn USB_Component.ttcn "
|
FILES="USB_PT.cc USB_PT.hh USB_PortType.ttcn USB_PortTypes.ttcn USB_Templates.ttcn USB_Types.ttcn USB_Component.ttcn "
|
||||||
|
|
|
@ -5,6 +5,7 @@ NAME=SIMTRACE_Tests
|
||||||
FILES="
|
FILES="
|
||||||
*.ttcn
|
*.ttcn
|
||||||
Native_FunctionDefs.cc
|
Native_FunctionDefs.cc
|
||||||
|
TCCConversion.cc
|
||||||
USB_PT.cc
|
USB_PT.cc
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue