aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2024-04-17 19:13:22 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2024-04-18 11:07:08 +0200
commit830061d27129bbfe6c3768c96b688f37dccef288 (patch)
tree56eef8e37e7e38611ac1e00e60aa78b08dd90668
parenta1d113ae1e25751aeb9cac281b30bc9fe6e11551 (diff)
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
-rwxr-xr-xccid/gen_links.sh6
-rwxr-xr-xccid/regen_makefile.sh1
-rw-r--r--library/Misc_Helpers.ttcn18
-rw-r--r--library/Osmocom_VTY_Functions.ttcn17
-rwxr-xr-xsimtrace/gen_links.sh6
-rwxr-xr-xsimtrace/regen_makefile.sh1
6 files changed, 26 insertions, 23 deletions
diff --git a/ccid/gen_links.sh b/ccid/gen_links.sh
index e53954b6..593f6248 100755
--- a/ccid/gen_links.sh
+++ b/ccid/gen_links.sh
@@ -4,9 +4,9 @@ BASEDIR=../deps
. ../gen_links.sh.inc
-#DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
-#FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
-#gen_links $DIR $FILES
+DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
+FILES="TCCConversion_Functions.ttcn TCCConversion.cc"
+gen_links $DIR $FILES
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 "
diff --git a/ccid/regen_makefile.sh b/ccid/regen_makefile.sh
index bbb7f33b..c91ac12f 100755
--- a/ccid/regen_makefile.sh
+++ b/ccid/regen_makefile.sh
@@ -5,6 +5,7 @@ NAME=CCID_Tests
FILES="
*.ttcn
Native_FunctionDefs.cc
+ TCCConversion.cc
USB_PT.cc
"
diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn
index dda2c2c1..cbc1e70b 100644
--- a/library/Misc_Helpers.ttcn
+++ b/library/Misc_Helpers.ttcn
@@ -1,6 +1,7 @@
module Misc_Helpers {
import from Native_Functions all;
+import from TCCConversion_Functions all;
modulepar {
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;
+}
+
}
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 3dd04298..6b0883f9 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -228,23 +228,6 @@ function f_vty_transceive_match_regexp_retry(TELNETasp_PT pt, charstring cmd, ch
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;
/* Perform a 'show talloc-context' to get a count of the given object_strs that are still allocated.
diff --git a/simtrace/gen_links.sh b/simtrace/gen_links.sh
index eef1fead..3bce04d8 100755
--- a/simtrace/gen_links.sh
+++ b/simtrace/gen_links.sh
@@ -4,9 +4,9 @@ BASEDIR=../deps
. ../gen_links.sh.inc
-#DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
-#FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
-#gen_links $DIR $FILES
+DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
+FILES="TCCConversion_Functions.ttcn TCCConversion.cc"
+gen_links $DIR $FILES
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 "
diff --git a/simtrace/regen_makefile.sh b/simtrace/regen_makefile.sh
index baecf7de..04c8397e 100755
--- a/simtrace/regen_makefile.sh
+++ b/simtrace/regen_makefile.sh
@@ -5,6 +5,7 @@ NAME=SIMTRACE_Tests
FILES="
*.ttcn
Native_FunctionDefs.cc
+ TCCConversion.cc
USB_PT.cc
"