pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36593?usp=email )
Change subject: Move f_str_split() Osmocom_VTY_Functions.ttcn -> Misc_Helpers.ttcn
......................................................................
Move f_str_split() 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: I54eff3eea60ed0624919baebfe0ff7393414d6b8
---
M library/Misc_Helpers.ttcn
M library/Osmocom_VTY_Functions.ttcn
2 files changed, 31 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/93/36593/1
diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn
index cbc1e70..19e9514 100644
--- a/library/Misc_Helpers.ttcn
+++ b/library/Misc_Helpers.ttcn
@@ -79,4 +79,23 @@
return count;
}
+function f_str_split(charstring str, charstring delim := "\n") return
ro_charstring
+{
+ var integer pos := 0;
+ var ro_charstring parts := {};
+ var integer delim_pos;
+ var integer end := lengthof(str);
+ while (pos < end) {
+ delim_pos := f_strstr(str, delim, pos);
+ if (delim_pos < 0) {
+ delim_pos := end;
+ }
+ if (delim_pos > pos) {
+ parts := parts & { substr(str, pos, delim_pos - pos) };
+ }
+ pos := delim_pos + 1;
+ }
+ return parts;
+}
+
}
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 6b0883f..dd3ba3b 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -274,25 +274,6 @@
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "talloc count mismatch");
}
-public function f_str_split(charstring str, charstring delim := "\n") return
ro_charstring
-{
- var integer pos := 0;
- var ro_charstring parts := {};
- var integer delim_pos;
- var integer end := lengthof(str);
- while (pos < end) {
- delim_pos := f_strstr(str, delim, pos);
- if (delim_pos < 0) {
- delim_pos := end;
- }
- if (delim_pos > pos) {
- parts := parts & { substr(str, pos, delim_pos - pos) };
- }
- pos := delim_pos + 1;
- }
- return parts;
-}
-
public function f_verify_talloc_bytes(TELNETasp_PT pt, ro_charstring object_strs, integer
expect_bytes := 0,
integer attempts := 5, float wait_time := 3.0)
{
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36593?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I54eff3eea60ed0624919baebfe0ff7393414d6b8
Gerrit-Change-Number: 36593
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange