3 # Copyright 2006,2007 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Radio; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street,
20 # Boston, MA 02110-1301, USA.
23 from build_utils import expand_template, copyright, open_and_log_name
24 from build_utils_codes import *
33 'trellis_viterbi_combined_XX',
37 ['bb','bs','bi','ss','si','ii'],
40 ['sb','ss','si','ib','is','ii','fb','fs','fi','cb','cs','ci'],
45 if i_code (code3) == 'b' or o_code (code3) == 'b':
52 if i_code (code3) == 's' or o_code (code3) == 's':
59 if i_code (code3) == 'i' or o_code (code3) == 'i':
66 if i_code (code3) == 'f' or o_code (code3) == 'f':
72 def is_complex (code3):
73 if i_code (code3) == 'c' or o_code (code3) == 'c':
79 def standard_dict (name, code3):
82 d['GUARD_NAME'] = 'INCLUDED_%s_H' % name.upper ()
83 d['BASE_NAME'] = re.sub ('^trellis_', '', name)
84 d['SPTR_NAME'] = '%s_sptr' % name
85 d['WARNING'] = 'WARNING: this file is machine generated. Edits will be over written'
86 d['COPYRIGHT'] = copyright
87 d['TYPE'] = i_type (code3)
88 d['I_TYPE'] = i_type (code3)
89 d['O_TYPE'] = o_type (code3)
90 d['TAP_TYPE'] = tap_type (code3)
91 d['IS_BYTE'] = is_byte (code3)
92 d['IS_SHORT'] = is_short (code3)
93 d['IS_INT'] = is_int (code3)
94 d['IS_FLOAT'] = is_float (code3)
95 d['IS_COMPLEX'] = is_complex (code3)
99 def expand_h_cc_i (root, sig):
100 # root looks like 'gr_vector_sink_X'
101 name = re.sub ('X+', sig, root)
102 d = standard_dict (name, sig)
103 expand_template (d, root + '.h.t')
104 expand_template (d, root + '.cc.t')
105 expand_template (d, root + '.i.t')
110 for r in other_roots :
111 for s in other_signatures[i]:
116 if __name__ == '__main__':