summaryrefslogtreecommitdiff
path: root/grc/core
diff options
context:
space:
mode:
authorHåkon Vågsether <haakonsv@gmail.com>2018-11-23 23:25:25 +0100
committerHåkon Vågsether <haakonsv@gmail.com>2018-12-18 23:18:27 +0100
commit541a717d59cea5726c236bb5a9ebccf389e87157 (patch)
tree399a3fc7ea5192e1da665ded6a7bd3111266f030 /grc/core
parentb6d83e74194f8d9d058f4b258a102ddb5a38352d (diff)
Small fixes to get the C++ generator working again
Diffstat (limited to 'grc/core')
-rw-r--r--grc/core/blocks/block.py2
-rw-r--r--grc/core/generator/cpp_templates/CMakeLists.txt.mako9
-rw-r--r--grc/core/generator/cpp_templates/flow_graph.cpp.mako7
-rw-r--r--grc/core/generator/cpp_templates/flow_graph.hpp.mako4
4 files changed, 13 insertions, 9 deletions
diff --git a/grc/core/blocks/block.py b/grc/core/blocks/block.py
index 19b16b53d6..d795d04912 100644
--- a/grc/core/blocks/block.py
+++ b/grc/core/blocks/block.py
@@ -27,6 +27,8 @@ import six
from six.moves import range
import re
+import ast
+
from ._templates import MakoTemplates
from ._flags import Flags
diff --git a/grc/core/generator/cpp_templates/CMakeLists.txt.mako b/grc/core/generator/cpp_templates/CMakeLists.txt.mako
index 4e5c18637a..de91f1c6fa 100644
--- a/grc/core/generator/cpp_templates/CMakeLists.txt.mako
+++ b/grc/core/generator/cpp_templates/CMakeLists.txt.mako
@@ -2,12 +2,12 @@
# GNU Radio C++ Flow Graph CMakeLists.txt
#
# Title: ${title}
-# % if flow_graph.get_option('author'):
+% if flow_graph.get_option('author'):
# Author: ${flow_graph.get_option('author')}
-# % endif
-# % if flow_graph.get_option('description'):
+% endif
+% if flow_graph.get_option('description'):
# Description: ${flow_graph.get_option('description')}
-# % endif
+% endif
# Generated: ${generated_time}
#####################
@@ -56,6 +56,7 @@ set(GR_LIBRARIES
gnuradio-blocks
gnuradio-runtime
gnuradio-pmt
+ log4cpp
% for link in links:
% if link:
${link}
diff --git a/grc/core/generator/cpp_templates/flow_graph.cpp.mako b/grc/core/generator/cpp_templates/flow_graph.cpp.mako
index a692453263..51291fb42d 100644
--- a/grc/core/generator/cpp_templates/flow_graph.cpp.mako
+++ b/grc/core/generator/cpp_templates/flow_graph.cpp.mako
@@ -21,7 +21,8 @@ namespace po = boost::program_options;
using namespace gr;
<%
-class_name = flow_graph.get_option('id')
+class_name = flow_graph.get_option('id') + ('_' if flow_graph.get_option('id') == 'top_block' else '')
+
param_str = ", ".join((param.vtype + " " + param.name) for param in parameters)
param_str_without_types = ", ".join(param.name for param in parameters)
%>\
@@ -63,7 +64,7 @@ ${class_name}::${class_name} (${param_str}) : QWidget() {
% endif
% if not generate_options.startswith('hb'):
- this->tb = make_top_block("${title}");
+ this->tb = gr::make_top_block("${title}");
% endif
% if blocks:
@@ -168,7 +169,7 @@ int main (int argc, char **argv) {
% elif generate_options == 'qt_gui':
QApplication app(argc, argv);
- ${class_name} *top_block = new ${class_name}(${param_str_without_types});
+ ${class_name}* top_block = new ${class_name}(${param_str_without_types});
top_block->tb->start();
top_block->show();
diff --git a/grc/core/generator/cpp_templates/flow_graph.hpp.mako b/grc/core/generator/cpp_templates/flow_graph.hpp.mako
index 7b117a45de..6aeccd4ffe 100644
--- a/grc/core/generator/cpp_templates/flow_graph.hpp.mako
+++ b/grc/core/generator/cpp_templates/flow_graph.hpp.mako
@@ -37,7 +37,7 @@ ${inc}
using namespace gr;
<%
-class_name = flow_graph.get_option('id')
+class_name = flow_graph.get_option('id') + ('_' if flow_graph.get_option('id') == 'top_block' else '')
param_str = ", ".join((param.vtype + " " + param.name) for param in parameters)
%>\
@@ -84,7 +84,7 @@ ${indent(declarations)}
public:
% if not generate_options.startswith('hb'):
- top_block_sptr tb;
+ gr::top_block_sptr tb;
% endif
${class_name}(${param_str});
~${class_name}();