diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2009-07-20 03:47:14 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2009-07-20 03:47:14 +0000 |
commit | 6f50256f958ac60d5fc9212b24d86777c1b2ec0d (patch) | |
tree | afdde009cf81d93bcb84027937c62ef71194d9fd /pmt/src/lib/generate_unv.py | |
parent | aff2d8ad842994b1f58e0dc56b7d2fd6229377a9 (diff) |
Merged r11452:11459 from jcorgan/pmt-gruel into trunk. Trunk passes distcheck.
* Merges libpmt into libgruel
* Modifies libmblock to use libgruel
gruel::pmt_t will be the fundamental msg content for the new message passing
implemention for 3.3.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11460 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'pmt/src/lib/generate_unv.py')
-rwxr-xr-x | pmt/src/lib/generate_unv.py | 190 |
1 files changed, 0 insertions, 190 deletions
diff --git a/pmt/src/lib/generate_unv.py b/pmt/src/lib/generate_unv.py deleted file mode 100755 index 2abafa4c17..0000000000 --- a/pmt/src/lib/generate_unv.py +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -""" -Generate code for uniform numeric vectors -""" - -import re, os, os.path - - -unv_types = ( - ('u8', 'uint8_t'), - ('s8', 'int8_t'), - ('u16', 'uint16_t'), - ('s16', 'int16_t'), - ('u32', 'uint32_t'), - ('s32', 'int32_t'), - ('u64', 'uint64_t'), - ('s64', 'int64_t'), - ('f32', 'float'), - ('f64', 'double'), - ('c32', 'std::complex<float>'), - ('c64', 'std::complex<double>') - ) - -header = """\ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -""" - -guard_tail = """ -#endif -""" - -includes = """ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <vector> -#include <pmt.h> -#include "pmt_int.h" - -""" - -qa_includes = """ -#include <qa_pmt_unv.h> -#include <cppunit/TestAssert.h> -#include <pmt.h> -#include <stdio.h> - -""" - - -# set srcdir to the directory that contains Makefile.am -try: - srcdir = os.environ['srcdir'] -except KeyError, e: - srcdir = "." -srcdir = srcdir + '/' - - -def open_src (name, mode): - global srcdir - return open(os.path.join (srcdir, name), mode) - - -def guard_name(filename): - return 'INCLUDED_' + re.sub('\.', '_', filename.upper()) - -def guard_head(filename): - guard = guard_name(filename) - return """ -#ifndef %s -#define %s -""" % (guard, guard) - - -def do_substitution (d, input, out_file): - def repl (match_obj): - key = match_obj.group (1) - # print key - return d[key] - - out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, input) - out_file.write (out) - - -def generate_h(): - template = open_src('unv_template.h.t', 'r').read() - output_filename = 'pmt_unv_int.h' - output = open(output_filename, 'w') - output.write(header) - output.write(guard_head(output_filename)) - for tag, typ in unv_types: - d = { 'TAG' : tag, 'TYPE' : typ } - do_substitution(d, template, output) - output.write(guard_tail) - -def generate_cc(): - template = open_src('unv_template.cc.t', 'r').read() - output = open('pmt_unv.cc', 'w') - output.write(header) - output.write(includes) - for tag, typ in unv_types: - d = { 'TAG' : tag, 'TYPE' : typ } - do_substitution(d, template, output) - - -def generate_qa_h(): - output_filename = 'qa_pmt_unv.h' - output = open(output_filename, 'w') - output.write(header) - output.write(guard_head(output_filename)) - - output.write(''' -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_pmt_unv : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_pmt_unv); -''') - for tag, typ in unv_types: - output.write(' CPPUNIT_TEST(test_%svector);\n' % (tag,)) - output.write('''\ - CPPUNIT_TEST_SUITE_END(); - - private: -''') - for tag, typ in unv_types: - output.write(' void test_%svector();\n' % (tag,)) - output.write('};\n') - output.write(guard_tail) - -def generate_qa_cc(): - template = open_src('unv_qa_template.cc.t', 'r').read() - output = open('qa_pmt_unv.cc', 'w') - output.write(header) - output.write(qa_includes) - for tag, typ in unv_types: - d = { 'TAG' : tag, 'TYPE' : typ } - do_substitution(d, template, output) - - -def main(): - generate_h() - generate_cc() - generate_qa_h() - generate_qa_cc() - -if __name__ == '__main__': - main() |