-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgen_data.py
More file actions
executable file
·60 lines (43 loc) · 1.14 KB
/
gen_data.py
File metadata and controls
executable file
·60 lines (43 loc) · 1.14 KB
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
#!/usr/bin/env python
import re
import locale
locale.setlocale( locale.LC_ALL, 'en_US' )
fname = "gost.2009.data"
def generate():
freq = []
af = []
Lu = []
Tf = []
with open(fname) as f:
content = f.read().splitlines()
for line in content:
if not line:
continue
data = re.split('[ \t]+', line)
freq.append(data[0])
af.append(data[1])
Lu.append(data[2])
Tf.append(data[3])
print "// This file is autogenerated. Do not change manually!"
print "#ifndef ISO226_DATA_H"
print "#define ISO226_DATA_H\n"
print "static const int f_size = %d;\n" % (len(freq))
print "static int f[] = {"
print "\t",
print ",\n\t".join(freq)
print "};\n\n"
print "static double af[] = {"
print "\t",
print ",\n\t".join(af)
print "};\n\n"
print "static double Tf[] = {"
print "\t",
print ",\n\t".join(Tf)
print "};\n\n"
print "static double Lu[] = {"
print "\t",
print ",\n\t".join(Lu)
print "};\n\n"
print "#endif ISO226_DATA_H\n"
if __name__ == "__main__":
generate()