summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/GrMiscUtils.cmake173
-rw-r--r--docs/doxygen/Doxyfile.in2
-rw-r--r--gnuradio-runtime/python/build_utils.py227
-rw-r--r--gnuradio-runtime/python/build_utils_codes.py53
-rw-r--r--gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake176
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/build_utils.py228
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py53
7 files changed, 0 insertions, 912 deletions
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 6f0c8ac270..920e8adbee 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -302,176 +302,3 @@ set(CMAKE_REQUIRED_LIBRARIES -lpthread)
)
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)
-
-########################################################################
-# Macros to generate source and header files from template
-########################################################################
-macro(GR_EXPAND_X_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated headers
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the headers
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #install rules for the generated headers
- list(APPEND generated_includes ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_H)
-
-macro(GR_EXPAND_X_CC_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_impl_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the source files
- add_custom_command(
- OUTPUT ${expanded_files_cc}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.cc.t ${ARGN}
- )
-
- #create a command to generate the header files
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #make source files depends on headers to force generation
- set_source_files_properties(${expanded_files_cc}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc})
- list(APPEND generated_headers ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_CC_H)
-
-macro(GR_EXPAND_X_CC_H_IMPL component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, '${component}')
- build_utils.expand_template(d, inp, '_impl')
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc_impl)
- unset(expanded_files_h_impl)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc)
- list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/${component}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the _impl.cc files
- add_custom_command(
- OUTPUT ${expanded_files_cc_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.cc.t ${ARGN}
- )
-
- #create a command to generate the _impl.h files
- add_custom_command(
- OUTPUT ${expanded_files_h_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.h.t ${ARGN}
- )
-
- #make _impl.cc source files depend on _impl.h to force generation
- set_source_files_properties(${expanded_files_cc_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}"
- )
-
- #make _impl.h source files depend on headers to force generation
- set_source_files_properties(${expanded_files_h_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc_impl})
- list(APPEND generated_headers ${expanded_files_h_impl})
-
-endmacro(GR_EXPAND_X_CC_H_IMPL)
diff --git a/docs/doxygen/Doxyfile.in b/docs/doxygen/Doxyfile.in
index 3be1cbc23a..698798d762 100644
--- a/docs/doxygen/Doxyfile.in
+++ b/docs/doxygen/Doxyfile.in
@@ -738,8 +738,6 @@ EXCLUDE = @abs_top_srcdir@/volk \
@abs_top_builddir@/dtools \
@abs_top_builddir@/gnuradio-runtime/lib/runtime/gr_error_handler.cc \
@abs_top_builddir@/gnuradio-runtime/swig \
- @abs_top_builddir@/gnuradio-runtime/python/build_utils.py \
- @abs_top_builddir@/gnuradio-runtime/python/build_utils_codes.py \
@abs_top_builddir@/gnuradio-runtime/python/gnuradio/gr/gr_threading.py \
@abs_top_builddir@/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py \
@abs_top_builddir@/gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py \
diff --git a/gnuradio-runtime/python/build_utils.py b/gnuradio-runtime/python/build_utils.py
deleted file mode 100644
index 82a2265cc2..0000000000
--- a/gnuradio-runtime/python/build_utils.py
+++ /dev/null
@@ -1,227 +0,0 @@
-#
-# Copyright 2004,2009,2012 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.
-#
-
-"""Misc utilities used at build time
-"""
-from __future__ import unicode_literals
-
-import re, os, os.path
-from build_utils_codes import *
-
-
-# set srcdir to the directory that contains Makefile.am
-try:
- srcdir = os.environ['srcdir']
-except KeyError as e:
- srcdir = "."
-srcdir = srcdir + '/'
-
-# set do_makefile to either true or false dependeing on the environment
-try:
- if os.environ['do_makefile'] == '0':
- do_makefile = False
- else:
- do_makefile = True
-except KeyError as e:
- do_makefile = False
-
-# set do_sources to either true or false dependeing on the environment
-try:
- if os.environ['do_sources'] == '0':
- do_sources = False
- else:
- do_sources = True
-except KeyError as e:
- do_sources = True
-
-name_dict = {}
-
-def log_output_name (name):
- (base, ext) = os.path.splitext (name)
- ext = ext[1:] # drop the leading '.'
-
- entry = name_dict.setdefault (ext, [])
- entry.append (name)
-
-def open_and_log_name (name, dir):
- global do_sources
- if do_sources:
- f = open (name, dir)
- else:
- f = None
- log_output_name (name)
- return f
-
-def expand_template (d, template_filename, extra = ""):
- '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
- '''
- global do_sources
- output_extension = extract_extension (template_filename)
- template = open_src (template_filename, 'r')
- output_name = d['NAME'] + extra + '.' + output_extension
- log_output_name (output_name)
- if do_sources:
- output = open (output_name, 'w')
- do_substitution (d, template, output)
- output.close ()
- template.close ()
-
-def output_glue (dirname):
- output_makefile_fragment ()
- output_ifile_include (dirname)
-
-def output_makefile_fragment ():
- global do_makefile
- if not do_makefile:
- return
-# overwrite the source, which must be writable; this should have been
-# checked for beforehand in the top-level Makefile.gen.gen .
- f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w')
- f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
- output_subfrag (f, 'h')
- output_subfrag (f, 'i')
- output_subfrag (f, 'cc')
- f.close ()
-
-def output_ifile_include (dirname):
- global do_sources
- if do_sources:
- f = open ('%s_generated.i' % (dirname,), 'w')
- f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
- files = name_dict.setdefault ('i', [])
- files.sort ()
- f.write ('%{\n')
- for file in files:
- f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
- f.write ('%}\n\n')
- for file in files:
- f.write ('%%include <%s>\n' % (file,))
-
-def output_subfrag (f, ext):
- files = name_dict.setdefault (ext, [])
- files.sort ()
- f.write ("GENERATED_%s =" % (ext.upper ()))
- for file in files:
- f.write (" \\\n\t%s" % (file,))
- f.write ("\n\n")
-
-def extract_extension (template_name):
- # template name is something like: GrFIRfilterXXX.h.t
- # we return everything between the penultimate . and .t
- mo = re.search (r'\.([a-z]+)\.t$', template_name)
- if not mo:
- raise ValueError("Incorrectly formed template_name '%s'" % (template_name,))
- return mo.group (1)
-
-def open_src (name, mode):
- global srcdir
- return open (os.path.join (srcdir, name), mode)
-
-def do_substitution (d, in_file, out_file):
- def repl (match_obj):
- key = match_obj.group (1)
- # print key
- return d[key]
-
- inp = in_file.read ()
- out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
- out_file.write (out)
-
-
-
-copyright = '''/* -*- c++ -*- */
-/*
- * Copyright 2003,2004 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.
- */
-'''
-
-def is_complex (code3):
- if i_code (code3) == 'c' or o_code (code3) == 'c':
- return '1'
- else:
- return '0'
-
-
-def standard_dict (name, code3, package='gr'):
- d = {}
- d['NAME'] = name
- d['NAME_IMPL'] = name+'_impl'
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper())
- d['BASE_NAME'] = re.sub ('^' + package + '_', '', name)
- d['SPTR_NAME'] = '%s_sptr' % name
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-
-def standard_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['BASE_NAME'] = name
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-def standard_impl_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['IMPL_NAME'] = name
- d['BASE_NAME'] = name.rstrip("impl").rstrip("_")
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['FIR_TYPE'] = "fir_filter_" + code3
- d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c'
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
diff --git a/gnuradio-runtime/python/build_utils_codes.py b/gnuradio-runtime/python/build_utils_codes.py
index 22a6bdb99b..e69de29bb2 100644
--- a/gnuradio-runtime/python/build_utils_codes.py
+++ b/gnuradio-runtime/python/build_utils_codes.py
@@ -1,53 +0,0 @@
-from __future__ import unicode_literals
-#
-# Copyright 2004 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.
-#
-
-def i_code (code3):
- return code3[0]
-
-def o_code (code3):
- if len (code3) >= 2:
- return code3[1]
- else:
- return code3[0]
-
-def tap_code (code3):
- if len (code3) >= 3:
- return code3[2]
- else:
- return code3[0]
-
-def i_type (code3):
- return char_to_type[i_code (code3)]
-
-def o_type (code3):
- return char_to_type[o_code (code3)]
-
-def tap_type (code3):
- return char_to_type[tap_code (code3)]
-
-
-char_to_type = {}
-char_to_type['s'] = 'short'
-char_to_type['i'] = 'int'
-char_to_type['f'] = 'float'
-char_to_type['c'] = 'gr_complex'
-char_to_type['b'] = 'unsigned char'
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
index cc8e7c17dc..beeeebe72a 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
@@ -303,179 +303,3 @@ set(CMAKE_REQUIRED_LIBRARIES -lpthread)
)
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)
-
-########################################################################
-# Macros to generate source and header files from template
-########################################################################
-macro(GR_EXPAND_X_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-sys.path.append('${CMAKE_SOURCE_DIR}/python')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated headers
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the headers
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #install rules for the generated headers
- list(APPEND generated_includes ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_H)
-
-macro(GR_EXPAND_X_CC_H component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-sys.path.append('${CMAKE_SOURCE_DIR}/python')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_impl_dict2(name, sig, '${component}')
- build_utils.expand_template(d, inp)
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the source files
- add_custom_command(
- OUTPUT ${expanded_files_cc}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.cc.t ${ARGN}
- )
-
- #create a command to generate the header files
- add_custom_command(
- OUTPUT ${expanded_files_h}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.h.t ${ARGN}
- )
-
- #make source files depends on headers to force generation
- set_source_files_properties(${expanded_files_cc}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc})
- list(APPEND generated_headers ${expanded_files_h})
-
-endmacro(GR_EXPAND_X_CC_H)
-
-macro(GR_EXPAND_X_CC_H_IMPL component root)
-
- include(GrPython)
-
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
-"#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_RUNTIME_PYTHONPATH}')
-sys.path.append('${CMAKE_SOURCE_DIR}/python')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, '${component}')
- build_utils.expand_template(d, inp, '_impl')
-")
-
- #make a list of all the generated files
- unset(expanded_files_cc_impl)
- unset(expanded_files_h_impl)
- unset(expanded_files_h)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_cc_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.cc)
- list(APPEND expanded_files_h_impl ${CMAKE_CURRENT_BINARY_DIR}/${name}_impl.h)
- list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/${component}/${name}.h)
- endforeach(sig)
- unset(name)
-
- #create a command to generate the _impl.cc files
- add_custom_command(
- OUTPUT ${expanded_files_cc_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.cc.t ${ARGN}
- )
-
- #create a command to generate the _impl.h files
- add_custom_command(
- OUTPUT ${expanded_files_h_impl}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
- COMMAND ${PYTHON_EXECUTABLE} -B
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}_impl.h.t ${ARGN}
- )
-
- #make _impl.cc source files depend on _impl.h to force generation
- set_source_files_properties(${expanded_files_cc_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h_impl}"
- )
-
- #make _impl.h source files depend on headers to force generation
- set_source_files_properties(${expanded_files_h_impl}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated files
- list(APPEND generated_sources ${expanded_files_cc_impl})
- list(APPEND generated_headers ${expanded_files_h_impl})
-
-endmacro(GR_EXPAND_X_CC_H_IMPL)
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils.py b/gr-utils/python/modtool/gr-newmod/python/build_utils.py
deleted file mode 100644
index 0b26844cbf..0000000000
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils.py
+++ /dev/null
@@ -1,228 +0,0 @@
-#
-# Copyright 2004,2009,2012 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.
-#
-
-"""Misc utilities used at build time
-"""
-from __future__ import absolute_import
-from __future__ import unicode_literals
-
-import re, os, os.path
-from .build_utils_codes import *
-
-
-# set srcdir to the directory that contains Makefile.am
-try:
- srcdir = os.environ['srcdir']
-except KeyError as e:
- srcdir = "."
-srcdir = srcdir + '/'
-
-# set do_makefile to either true or false dependeing on the environment
-try:
- if os.environ['do_makefile'] == '0':
- do_makefile = False
- else:
- do_makefile = True
-except KeyError as e:
- do_makefile = False
-
-# set do_sources to either true or false dependeing on the environment
-try:
- if os.environ['do_sources'] == '0':
- do_sources = False
- else:
- do_sources = True
-except KeyError as e:
- do_sources = True
-
-name_dict = {}
-
-def log_output_name (name):
- (base, ext) = os.path.splitext (name)
- ext = ext[1:] # drop the leading '.'
-
- entry = name_dict.setdefault (ext, [])
- entry.append (name)
-
-def open_and_log_name (name, dir):
- global do_sources
- if do_sources:
- f = open (name, dir)
- else:
- f = None
- log_output_name (name)
- return f
-
-def expand_template (d, template_filename, extra = ""):
- '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
- '''
- global do_sources
- output_extension = extract_extension (template_filename)
- template = open_src (template_filename, 'r')
- output_name = d['NAME'] + extra + '.' + output_extension
- log_output_name (output_name)
- if do_sources:
- output = open (output_name, 'w')
- do_substitution (d, template, output)
- output.close ()
- template.close ()
-
-def output_glue (dirname):
- output_makefile_fragment ()
- output_ifile_include (dirname)
-
-def output_makefile_fragment ():
- global do_makefile
- if not do_makefile:
- return
-# overwrite the source, which must be writable; this should have been
-# checked for beforehand in the top-level Makefile.gen.gen .
- f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w')
- f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
- output_subfrag (f, 'h')
- output_subfrag (f, 'i')
- output_subfrag (f, 'cc')
- f.close ()
-
-def output_ifile_include (dirname):
- global do_sources
- if do_sources:
- f = open ('%s_generated.i' % (dirname,), 'w')
- f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
- files = name_dict.setdefault ('i', [])
- files.sort ()
- f.write ('%{\n')
- for file in files:
- f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
- f.write ('%}\n\n')
- for file in files:
- f.write ('%%include <%s>\n' % (file,))
-
-def output_subfrag (f, ext):
- files = name_dict.setdefault (ext, [])
- files.sort ()
- f.write ("GENERATED_%s =" % (ext.upper ()))
- for file in files:
- f.write (" \\\n\t%s" % (file,))
- f.write ("\n\n")
-
-def extract_extension (template_name):
- # template name is something like: GrFIRfilterXXX.h.t
- # we return everything between the penultimate . and .t
- mo = re.search (r'\.([a-z]+)\.t$', template_name)
- if not mo:
- raise ValueError("Incorrectly formed template_name '%s'" % (template_name,))
- return mo.group (1)
-
-def open_src (name, mode):
- global srcdir
- return open (os.path.join (srcdir, name), mode)
-
-def do_substitution (d, in_file, out_file):
- def repl (match_obj):
- key = match_obj.group (1)
- # print key
- return d[key]
-
- inp = in_file.read ()
- out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
- out_file.write (out)
-
-
-
-copyright = '''/* -*- c++ -*- */
-/*
- * Copyright 2003,2004 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.
- */
-'''
-
-def is_complex (code3):
- if i_code (code3) == 'c' or o_code (code3) == 'c':
- return '1'
- else:
- return '0'
-
-
-def standard_dict (name, code3, package='gr'):
- d = {}
- d['NAME'] = name
- d['NAME_IMPL'] = name+'_impl'
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper())
- d['BASE_NAME'] = re.sub ('^' + package + '_', '', name)
- d['SPTR_NAME'] = '%s_sptr' % name
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-
-def standard_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['BASE_NAME'] = name
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-def standard_impl_dict2 (name, code3, package):
- d = {}
- d['NAME'] = name
- d['IMPL_NAME'] = name
- d['BASE_NAME'] = name.rstrip("impl").rstrip("_")
- d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
- d['COPYRIGHT'] = copyright
- d['FIR_TYPE'] = "fir_filter_" + code3
- d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c'
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
deleted file mode 100644
index 22a6bdb99b..0000000000
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
+++ /dev/null
@@ -1,53 +0,0 @@
-from __future__ import unicode_literals
-#
-# Copyright 2004 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.
-#
-
-def i_code (code3):
- return code3[0]
-
-def o_code (code3):
- if len (code3) >= 2:
- return code3[1]
- else:
- return code3[0]
-
-def tap_code (code3):
- if len (code3) >= 3:
- return code3[2]
- else:
- return code3[0]
-
-def i_type (code3):
- return char_to_type[i_code (code3)]
-
-def o_type (code3):
- return char_to_type[o_code (code3)]
-
-def tap_type (code3):
- return char_to_type[tap_code (code3)]
-
-
-char_to_type = {}
-char_to_type['s'] = 'short'
-char_to_type['i'] = 'int'
-char_to_type['f'] = 'float'
-char_to_type['c'] = 'gr_complex'
-char_to_type['b'] = 'unsigned char'