summaryrefslogtreecommitdiffstats
path: root/frekvence.php
diff options
context:
space:
mode:
Diffstat (limited to 'frekvence.php')
-rwxr-xr-xfrekvence.php76
1 files changed, 76 insertions, 0 deletions
diff --git a/frekvence.php b/frekvence.php
new file mode 100755
index 0000000..c085d21
--- /dev/null
+++ b/frekvence.php
@@ -0,0 +1,76 @@
+#!/usr/bin/php
+<?php
+$i = <<<HEREDOC
+1209 dtmf_c1
+1336 dtmf_c2
+1477 dtmf_c3
+1633 dtmf_c4
+697 dtmf_r1
+770 dtmf_r2
+852 dtmf_r3
+941 dtmf_r4
+2100 band_tipka
+800 spodnja_tipka
+1000 zgornja_tipka
+1450 oranžna_tipka
+1750 plava_tipka
+HEREDOC;
+// 1092 roger_prvi preveč mažeta 3. vrstico dtmfjev
+// 869 roger_drugi če dodaš, moraš popraviti tudi v $t spodaj - ZAMIKI!
+// 123 ctcss_123 nesmiselno zaznavati skupaj - ctcss je treba zaznavati posebej!
+$f = [];
+foreach (explode("\n", $i) as $l) {
+ if (trim($l) == "")
+ break;
+ $e = explode("\t", trim($l));
+ $f[$e[0]] = $e[1];
+}
+echo "static int frekvence[] = {" . PHP_EOL;
+foreach ($f as $k => $v)
+ echo " $k, // $v" . PHP_EOL;
+echo "};" . PHP_EOL;
+echo "enum frekvenca {" . PHP_EOL;
+foreach ($f as $k => $v)
+ echo " $v, // $k" . PHP_EOL;
+echo "};" . PHP_EOL;
+echo "static char * imena_frekvenc[] = {" . PHP_EOL;
+foreach ($f as $k => $v)
+ echo " \"$v\", // $k" . PHP_EOL;
+echo "};" . PHP_EOL;
+$t = <<<HEREDOC
+ni
+dtmf_1
+dtmf_2
+dtmf_3
+dtmf_4
+dtmf_5
+dtmf_6
+dtmf_7
+dtmf_8
+dtmf_9
+dtmf_0
+dtmf_a
+dtmf_b
+dtmf_c
+dtmf_d
+dtmf_zvezdica
+dtmf_lojtra
+band
+spodnja
+zgornja
+oranžna
+plava
+HEREDOC;
+// roger1
+// roger2
+// ctcss
+$t = explode("\n", trim($t));
+echo "enum ton {" . PHP_EOL;
+foreach ($t as $ton)
+ echo " $ton," . PHP_EOL;
+echo "};" . PHP_EOL;
+echo "static char * toni[] = {" . PHP_EOL;
+foreach ($t as $ton)
+ echo " \"$ton\"," . PHP_EOL;
+echo "};" . PHP_EOL;
+?>