summaryrefslogtreecommitdiffstats
path: root/frekvence.php
blob: c085d212ec64ad33506399f63d47eca719051783 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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;
?>