pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36592?usp=email )
Change subject: Move f_strstr_count() Osmocom_VTY_Functions.ttcn -> Misc_Helpers.ttcn ......................................................................
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 --- M ccid/gen_links.sh M ccid/regen_makefile.sh M library/Misc_Helpers.ttcn M library/Osmocom_VTY_Functions.ttcn M simtrace/gen_links.sh M simtrace/regen_makefile.sh 6 files changed, 38 insertions(+), 23 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved
diff --git a/ccid/gen_links.sh b/ccid/gen_links.sh index e53954b..593f624 100755 --- a/ccid/gen_links.sh +++ b/ccid/gen_links.sh @@ -4,9 +4,9 @@
. ../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 bbb7f33..c91ac12 100755 --- a/ccid/regen_makefile.sh +++ b/ccid/regen_makefile.sh @@ -5,6 +5,7 @@ FILES=" *.ttcn Native_FunctionDefs.cc + TCCConversion.cc USB_PT.cc "
diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn index dda2c2c..cbc1e70 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 @@ } }
+/* 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 3dd0429..6b0883f 100644 --- a/library/Osmocom_VTY_Functions.ttcn +++ b/library/Osmocom_VTY_Functions.ttcn @@ -228,23 +228,6 @@ 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 eef1fea..3bce04d 100755 --- a/simtrace/gen_links.sh +++ b/simtrace/gen_links.sh @@ -4,9 +4,9 @@
. ../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 baecf7d..04c8397 100755 --- a/simtrace/regen_makefile.sh +++ b/simtrace/regen_makefile.sh @@ -5,6 +5,7 @@ FILES=" *.ttcn Native_FunctionDefs.cc + TCCConversion.cc USB_PT.cc "