aboutsummaryrefslogtreecommitdiff
path: root/BUG9/txt_tools.udo
diff options
context:
space:
mode:
authorRichard <q@1bpm.net>2022-01-22 22:27:01 +0000
committerRichard <q@1bpm.net>2022-01-22 22:27:01 +0000
commit44d3d5ece0a53d5316a2ccc9898b79992d81fef7 (patch)
treeb456d3007f3e8c5a122f0dc286192e8eaf90a1b1 /BUG9/txt_tools.udo
parent5afc582483c0658f3c8bac9cd854a7905e8d88c7 (diff)
downloadcsd-unfixedbugs1-44d3d5ece0a53d5316a2ccc9898b79992d81fef7.tar.gz
csd-unfixedbugs1-44d3d5ece0a53d5316a2ccc9898b79992d81fef7.tar.bz2
csd-unfixedbugs1-44d3d5ece0a53d5316a2ccc9898b79992d81fef7.zip
update
Diffstat (limited to 'BUG9/txt_tools.udo')
-rw-r--r--BUG9/txt_tools.udo82
1 files changed, 82 insertions, 0 deletions
diff --git a/BUG9/txt_tools.udo b/BUG9/txt_tools.udo
new file mode 100644
index 0000000..d34459e
--- /dev/null
+++ b/BUG9/txt_tools.udo
@@ -0,0 +1,82 @@
+#ifndef UDO_TXTTOOLS
+#define UDO_TXTTOOLS ##
+/*
+ Debugger - Unfixed Bugs : BUG #4
+
+ Text tools
+*/
+
+
+/*
+ Print a notification prepended with a line of asterisks
+
+ tt_notify Stext
+
+ Stext text to print
+*/
+opcode tt_notify, 0, S
+ Stext xin
+ Snew = "\n"
+ iwidth = 60
+ index = 0
+ while (index < iwidth) do
+ Snew = strcat(Snew, "*");
+ index += 1
+ od
+ prints strcat(strcat(Snew, "\n"), strcat(Stext, "\n\n"))
+endop
+
+
+
+/*
+ Print a notification prepended with a line of asterisks and exit
+
+ tt_notify Stext
+
+ Stext text to print
+*/
+opcode tt_notify_fatal, 0, S
+ Stext xin
+ tt_notify(Stext)
+ exitnow
+endop
+
+
+/*
+ Return a number of seconds as HH:MM:SS format
+
+ Stime tt_parsetime iseconds
+
+ iseconds seconds to parse
+
+ Stime formatted time
+
+*/
+opcode tt_parsetime, S, i
+ input xin
+ ihours = floor(input / 3600)
+ iminutes = floor((input - (ihours * 3600)) / 60)
+ iseconds = input - (ihours * 3600) - (iminutes * 60)
+ xout sprintf("%02d:%02d:%05.2f", ihours, iminutes, iseconds)
+endop
+
+
+/*
+ Strip newline from end of line: built-in opcode has some problems
+
+ Soutput tt_stripnewline Sinput
+
+ Soutput processed without newline at end if existent
+
+ Sinput line to process
+*/
+opcode tt_stripnewline, S, S
+ Sline xin
+ index = strindex(Sline, "\n")
+ if (index != -1) then
+ Sline = strsub(Sline, 0, index)
+ endif
+ xout Sline
+endop
+
+#end