3 # Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
24 Generate code for uniform numeric vectors
27 import re, os, os.path
41 ('c32', 'std::complex<float>'),
42 ('c64', 'std::complex<double>')
48 * Copyright 2006 Free Software Foundation, Inc.
50 * This file is part of GNU Radio
52 * GNU Radio is free software; you can redistribute it and/or modify
53 * it under the terms of the GNU General Public License as published by
54 * the Free Software Foundation; either version 2, or (at your option)
57 * GNU Radio is distributed in the hope that it will be useful,
58 * but WITHOUT ANY WARRANTY; without even the implied warranty of
59 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60 * GNU General Public License for more details.
62 * You should have received a copy of the GNU General Public License
63 * along with GNU Radio; see the file COPYING. If not, write to
64 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
65 * Boston, MA 02111-1307, USA.
70 #ifndef INCLUDED_PMT_UNV_INT_H
71 #define INCLUDED_PMT_UNV_INT_H
89 # set srcdir to the directory that contains Makefile.am
91 srcdir = os.environ['srcdir']
97 def open_src (name, mode):
99 return open(os.path.join (srcdir, name), mode)
102 def do_substitution (d, input, out_file):
103 def repl (match_obj):
104 key = match_obj.group (1)
108 out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, input)
113 template = open_src('unv_template.h.t', 'r').read()
114 output = open('pmt_unv_int.h', 'w')
116 output.write(guard_head)
117 for tag, typ in unv_types:
118 d = { 'TAG' : tag, 'TYPE' : typ }
119 do_substitution(d, template, output)
120 output.write(guard_tail)
124 template = open_src('unv_template.cc.t', 'r').read()
125 output = open('pmt_unv.cc', 'w')
127 output.write(includes)
128 for tag, typ in unv_types:
129 d = { 'TAG' : tag, 'TYPE' : typ }
130 do_substitution(d, template, output)
137 if __name__ == '__main__':