4 # Copyright 2003 Free Software Foundation, Inc.
6 # This file is part of GNU Radio
8 # GNU Radio is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # GNU Radio is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Radio; see the file COPYING. If not, write to
20 # the Free Software Foundation, Inc., 51 Franklin Street,
21 # Boston, MA 02110-1301, USA.
25 from generate_utils import *
27 roots = ['gr_fir_XXX', 'gr_fir_XXX_generic']
30 # figure out accumulator type. Use biggest of input, output and tap type
32 def code3_to_acc_code (code3):
33 if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c':
35 if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f':
37 if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i':
39 return 'i' # even short short short needs int accumulator
42 def code3_to_input_cast (code3):
43 if i_code (code3) == 's' and o_code (code3) == 'c':
47 def expand_h_cc (root, code3):
48 d = init_dict (root, code3)
49 expand_template (d, root + '.h.t')
50 expand_template (d, root + '.cc.t')
52 def init_dict (root, code3):
53 name = re.sub ('X+', code3, root)
54 d = standard_dict (name, code3)
55 d['FIR_TYPE'] = 'gr_fir_' + code3
56 d['INPUT_CAST'] = code3_to_input_cast (code3)
57 acc_code = code3_to_acc_code (code3)
58 d['ACC_TYPE'] = char_to_type[acc_code]
61 d['VRCOMPLEX_INCLUDE'] = '#include <gr_types.h>'
64 d['VRCOMPLEX_INCLUDE'] = ''
70 for s in fir_signatures:
74 if __name__ == '__main__':