summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/.gitignore2
-rw-r--r--gnuradio-core/src/lib/Makefile.am10
-rw-r--r--gnuradio-core/src/lib/bug_work_around_6.cc4
-rw-r--r--gnuradio-core/src/lib/filter/Makefile.am36
-rw-r--r--gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc1
-rw-r--r--gnuradio-core/src/lib/filter/complex_dotprod_generic.cc1
-rw-r--r--gnuradio-core/src/lib/filter/cpuid_x86.S60
-rw-r--r--gnuradio-core/src/lib/filter/cpuid_x86_64.S54
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c90
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i)29
-rw-r--r--gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c3
-rw-r--r--gnuradio-core/src/lib/filter/filter.i4
-rw-r--r--gnuradio-core/src/lib/filter/gcc_x86_cpuid.h178
-rw-r--r--gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc3
-rw-r--r--gnuradio-core/src/lib/filter/gr_cpu_x86.cc13
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc138
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h111
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc138
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h111
-rw-r--r--gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i34
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc91
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h45
-rw-r--r--gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc25
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc6
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h7
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i1
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h4
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc2
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc2
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_rotator.cc7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc7
-rw-r--r--gnuradio-core/src/lib/g72x/Makefile.am2
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am30
-rw-r--r--gnuradio-core/src/lib/general/complex_vec_test.cc82
-rw-r--r--gnuradio-core/src/lib/general/complex_vec_test.h27
-rw-r--r--gnuradio-core/src/lib/general/complex_vec_test.i25
-rw-r--r--gnuradio-core/src/lib/general/general.i14
-rw-r--r--gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i3
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.cc107
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.h74
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.cc110
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.h75
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.i (renamed from gnuradio-core/src/lib/runtime/gr_tmp_path.cc)40
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.i7
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.cc83
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.i (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i)17
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc6
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i7
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i7
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_feval.i7
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vcc.i4
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vfc.cc6
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vfc.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_fft_vfc.i9
-rw-r--r--gnuradio-core/src/lib/general/gr_firdes.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h4
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i3
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_fxpt.h4
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.cc59
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.h51
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.i (renamed from gnuradio-core/src/lib/runtime/gr_tmp_path.h)15
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_math.cc102
-rw-r--r--gnuradio-core/src/lib/general/gr_math.h13
-rw-r--r--gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h3
-rw-r--r--gnuradio-core/src/lib/general/gr_nop.cc24
-rw-r--r--gnuradio-core/src/lib/general/gr_nop.h23
-rw-r--r--gnuradio-core/src/lib/general/gr_nop.i11
-rw-r--r--gnuradio-core/src/lib/general/gr_null_sink.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_null_sink.h16
-rw-r--r--gnuradio-core/src/lib/general/gr_null_sink.i11
-rw-r--r--gnuradio-core/src/lib/general/gr_null_source.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_null_source.h14
-rw-r--r--gnuradio-core/src/lib/general/gr_null_source.i11
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.cc136
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.h33
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.i13
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i2
-rw-r--r--gnuradio-core/src/lib/general/gri_fft.cc28
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc4
-rw-r--r--gnuradio-core/src/lib/gengen/Makefile.am6
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t4
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t10
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t8
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t4
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t10
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t8
-rw-r--r--gnuradio-core/src/lib/hier/Makefile.am2
-rw-r--r--gnuradio-core/src/lib/io/Makefile.am11
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink_f.cc5
-rw-r--r--gnuradio-core/src/lib/io/gr_message_source.i8
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc211
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.h71
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.i35
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.cc5
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.cc1
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.h1
-rw-r--r--gnuradio-core/src/lib/io/io.i3
-rw-r--r--gnuradio-core/src/lib/missing/Makefile.am6
-rw-r--r--gnuradio-core/src/lib/missing/bug_work_around_8.cc3
-rw-r--r--gnuradio-core/src/lib/reed-solomon/Makefile.am2
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am18
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.h58
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.i6
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc68
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h87
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.i10
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.cc92
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.h73
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc86
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.h3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.cc83
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h51
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.cc1
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.h1
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc7
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flowgraph.cc3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.cc5
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_hier_block2.i7
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.i65
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.cc34
-rw-r--r--gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_block.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sys_paths.cc55
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sys_paths.h31
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.cc38
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.h87
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.cc6
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.h7
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.i43
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc8
-rw-r--r--gnuradio-core/src/lib/runtime/gr_unittests.h40
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc4
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.cc450
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.h52
-rw-r--r--gnuradio-core/src/lib/runtime/qa_runtime.cc6
-rw-r--r--gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc85
-rw-r--r--gnuradio-core/src/lib/runtime/qa_set_msg_handler.h43
-rw-r--r--gnuradio-core/src/lib/runtime/runtime.i7
-rw-r--r--gnuradio-core/src/lib/swig/.gitignore61
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.am94
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.swig.gen1548
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio.i31
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core.py (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_python.py)16
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_filter.i (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i)22
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_general.i60
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_gengen.i (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i)22
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_hier.i (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i)22
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_io.i (renamed from gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i)22
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_runtime.i57
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h45
-rw-r--r--gnuradio-core/src/lib/swig/gr_swig_block_magic.i39
-rw-r--r--gnuradio-core/src/lib/swig/guile/std_complex.i37
-rw-r--r--gnuradio-core/src/lib/swig/guile/std_vector.i437
168 files changed, 5389 insertions, 1985 deletions
diff --git a/gnuradio-core/src/lib/.gitignore b/gnuradio-core/src/lib/.gitignore
index e3bc1ee6a..0d5077da5 100644
--- a/gnuradio-core/src/lib/.gitignore
+++ b/gnuradio-core/src/lib/.gitignore
@@ -1,7 +1,5 @@
/Makefile
/Makefile.in
-/.la
-/.lo
/.deps
/.libs
/*.la
diff --git a/gnuradio-core/src/lib/Makefile.am b/gnuradio-core/src/lib/Makefile.am
index f3a3accdb..4db2ff167 100644
--- a/gnuradio-core/src/lib/Makefile.am
+++ b/gnuradio-core/src/lib/Makefile.am
@@ -24,10 +24,7 @@ include $(top_srcdir)/Makefile.common
## Process this file with automake to produce Makefile.in
# We've got to build . before swig
-SUBDIRS = missing runtime filter viterbi general gengen g72x reed-solomon io hier .
-if PYTHON
-SUBDIRS += swig
-endif
+SUBDIRS = missing runtime filter viterbi general gengen g72x reed-solomon io hier . swig
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
@@ -69,4 +66,7 @@ libgnuradio_core_qa_la_LIBADD = \
bin_PROGRAMS = gnuradio-config-info
gnuradio_config_info_SOURCES = gnuradio-config-info.cc
-gnuradio_config_info_LDADD = libgnuradio-core.la $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB)
+gnuradio_config_info_LDADD = libgnuradio-core.la \
+ $(BOOST_LDFLAGS) \
+ $(BOOST_PROGRAM_OPTIONS_LIB) \
+ $(BOOST_FILESYSTEM_LIB)
diff --git a/gnuradio-core/src/lib/bug_work_around_6.cc b/gnuradio-core/src/lib/bug_work_around_6.cc
index b829360fc..f8012af0d 100644
--- a/gnuradio-core/src/lib/bug_work_around_6.cc
+++ b/gnuradio-core/src/lib/bug_work_around_6.cc
@@ -1,3 +1,3 @@
// if libgrio has no sources, it doesn't get built correctly
-
-static int gr_bug_work_around_6 __attribute__((unused));
+#include <gruel/attributes.h>
+static int gr_bug_work_around_6 __GR_ATTR_UNUSED;
diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am
index 6d2ec1c7e..0314079a2 100644
--- a/gnuradio-core/src/lib/filter/Makefile.am
+++ b/gnuradio-core/src/lib/filter/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
+# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -26,7 +26,9 @@ include $(top_srcdir)/Makefile.common
# other performance critical items
#
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
+# $(WITH_INCLUDES) must _always_ be last
+AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) \
+ $(FFTW3F_CPPFLAGS) $(WITH_INCLUDES)
noinst_LTLIBRARIES = libfilter.la libfilter-qa.la
@@ -67,7 +69,7 @@ code_generator = \
# Source built by Python into $(builddir)
-BUILT_SOURCES = \
+BUILT_SOURCES += \
$(GENERATED_H) \
$(GENERATED_I) \
$(GENERATED_CC) \
@@ -118,8 +120,7 @@ x86_SUBCODE = \
ccomplex_dotprod_sse.S \
fcomplex_dotprod_3dnow.S \
fcomplex_dotprod_sse.S \
- short_dotprod_mmx.S \
- cpuid_x86.S
+ short_dotprod_mmx.S
x86_64_SUBCODE = \
float_dotprod_sse64.S \
@@ -132,8 +133,7 @@ x86_64_SUBCODE = \
ccomplex_dotprod_sse64.S \
fcomplex_dotprod_3dnow64.S \
fcomplex_dotprod_sse64.S \
- short_dotprod_mmx64.S \
- cpuid_x86_64.S
+ short_dotprod_mmx64.S
x86_qa_CODE = \
qa_dotprod_x86.cc \
@@ -157,7 +157,9 @@ armv7_a_CODE = \
gr_fir_sysconfig_armv7_a.cc \
gr_cpu_armv7_a.cc \
gr_fir_fff_armv7_a.cc \
- dotprod_fff_armv7_a.c
+ dotprod_fff_armv7_a.c \
+ gr_fir_ccf_armv7_a.cc \
+ dotprod_ccf_armv7_a.c
armv7_a_qa_CODE = \
qa_dotprod_armv7_a.cc
@@ -178,7 +180,7 @@ EXTRA_libfilter_la_SOURCES = \
$(armv7_a_qa_CODE)
-EXTRA_DIST = \
+EXTRA_DIST += \
3dnow_float_dotprod_really_simple.S \
3dnow_float_dotprod_simple.S \
$(code_generator)
@@ -214,7 +216,9 @@ libfilter_la_common_SOURCES = \
gr_pfb_interpolator_ccf.cc \
gr_pfb_arb_resampler_ccf.cc \
gr_pfb_clock_sync_ccf.cc \
- gr_pfb_clock_sync_fff.cc
+ gr_pfb_clock_sync_fff.cc \
+ gr_dc_blocker_cc.cc \
+ gr_dc_blocker_ff.cc
libfilter_qa_la_common_SOURCES = \
qa_filter.cc \
@@ -304,12 +308,16 @@ grinclude_HEADERS = \
gr_pfb_interpolator_ccf.h \
gr_pfb_arb_resampler_ccf.h \
gr_pfb_clock_sync_ccf.h \
- gr_pfb_clock_sync_fff.h
+ gr_pfb_clock_sync_fff.h \
+ gr_dc_blocker_cc.h \
+ gr_dc_blocker_ff.h
noinst_HEADERS = \
assembly.h \
+ gcc_x86_cpuid.h \
dotprod_fff_altivec.h \
dotprod_fff_armv7_a.h \
+ dotprod_ccf_armv7_a.h \
gr_fir_scc_simd.h \
gr_fir_scc_x86.h \
gr_fir_fcc_simd.h \
@@ -320,6 +328,7 @@ noinst_HEADERS = \
gr_fir_ccc_x86.h \
gr_fir_fff_altivec.h \
gr_fir_fff_armv7_a.h \
+ gr_fir_ccf_armv7_a.h \
gr_fir_fff_simd.h \
gr_fir_fff_x86.h \
gr_fir_fsf_simd.h \
@@ -345,7 +354,6 @@ noinst_HEADERS = \
qa_gri_fir_filter_with_buffer_scc.h
-if PYTHON
swiginclude_HEADERS = \
filter.i \
filter_generated.i \
@@ -368,8 +376,10 @@ swiginclude_HEADERS = \
gr_pfb_arb_resampler_ccf.i \
gr_pfb_clock_sync_ccf.i \
gr_pfb_clock_sync_fff.i \
+ gr_dc_blocker_cc.i \
+ gr_dc_blocker_ff.i \
$(GENERATED_I)
-endif
+
# Do creation and inclusion of other Makefiles last
diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc
index 5fc04271a..0dc0c38b7 100644
--- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc
+++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc
@@ -24,7 +24,6 @@
#include <config.h>
#endif
#include <gr_complex.h>
-#include "gr_fir_ccc_simd.h"
#include "ccomplex_dotprod_generic.h"
#include <iostream>
diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc
index 89eb6db87..8cbc4aa70 100644
--- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc
+++ b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc
@@ -24,7 +24,6 @@
#include <config.h>
#endif
#include <gr_complex.h>
-#include "gr_fir_scc_simd.h"
#include "complex_dotprod_generic.h"
diff --git a/gnuradio-core/src/lib/filter/cpuid_x86.S b/gnuradio-core/src/lib/filter/cpuid_x86.S
deleted file mode 100644
index 4e1a9404f..000000000
--- a/gnuradio-core/src/lib/filter/cpuid_x86.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Copyright 2003 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.
-#
-
-#
-# execute CPUID instruction, return EAX, EBX, ECX and EDX values in result
-#
-# void cpuid_x86 (unsigned int op, unsigned int result[4]);
-#
-
-#include "assembly.h"
-
-.file "cpuid_x86.S"
- .version "01.01"
-.text
-.globl GLOB_SYMB(cpuid_x86)
- DEF_FUNC_HEAD(cpuid_x86)
-GLOB_SYMB(cpuid_x86):
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx # must save in PIC mode, holds GOT pointer
- pushl %esi
-
- movl 8(%ebp), %eax # op
- movl 12(%ebp), %esi # result
- cpuid
- movl %eax, 0(%esi)
- movl %ebx, 4(%esi)
- movl %ecx, 8(%esi)
- movl %edx, 12(%esi)
-
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-FUNC_TAIL(cpuid_x86)
- .ident "Hand coded cpuid assembly"
-
-
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits
-#endif
diff --git a/gnuradio-core/src/lib/filter/cpuid_x86_64.S b/gnuradio-core/src/lib/filter/cpuid_x86_64.S
deleted file mode 100644
index 32b1847cd..000000000
--- a/gnuradio-core/src/lib/filter/cpuid_x86_64.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright 2003,2005 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.
-#
-
-#
-# execute CPUID instruction, return EAX, EBX, ECX and EDX values in result
-#
-# void cpuid_x86 (unsigned int op, unsigned int result[4]);
-#
-
-#include "assembly.h"
-
-.file "cpuid_x86_64.S"
- .version "01.01"
-.text
-.globl GLOB_SYMB(cpuid_x86)
- DEF_FUNC_HEAD(cpuid_x86)
-GLOB_SYMB(cpuid_x86):
- mov %rbx, %r11 # must save in PIC mode, holds GOT pointer
-
- mov %rdi, %rax # op
- cpuid
- movl %eax, 0(%rsi) # result
- movl %ebx, 4(%rsi)
- movl %ecx, 8(%rsi)
- movl %edx, 12(%rsi)
-
- mov %r11, %rbx
- retq
-
-FUNC_TAIL(cpuid_x86)
- .ident "Hand coded cpuid64 assembly"
-
-
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits
-#endif
diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
new file mode 100644
index 000000000..90bd2ee10
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dotprod_ccf_armv7_a.h>
+
+/*!
+ * \param x any value
+ * \param pow2 must be a power of 2
+ * \returns \p x rounded down to a multiple of \p pow2.
+ */
+static inline size_t
+gr_p2_round_down(size_t x, size_t pow2)
+{
+ return x & -pow2;
+}
+
+
+#if 0
+
+void
+dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n)
+{
+ size_t i;
+ res[0] = 0;
+ res[1] = 0;
+
+ for (i = 0; i < n; i++){
+ res[0] += a[2*i] * b[i];
+ res[1] += a[2*i+1] * b[i];
+ }
+}
+
+#else
+
+/*
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ */
+void
+dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n)
+{
+
+ asm volatile(
+ "vmov.f32 q14, #0.0 \n\t"
+ "vmov.f32 q15, #0.0 \n\t"
+ "1: \n\t"
+ "subs %2, %2, #4 \n\t"
+ "vld2.f32 {q0-q1}, [%0]! \n\t"
+ "vld1.f32 {q2}, [%1]! \n\t"
+ "vmla.f32 q14, q0, q2 \n\t"
+ "vmla.f32 q15, q1, q2 \n\t"
+ "bgt 1b \n\t"
+ "vpadd.f32 d0, d28, d29 \n\t"
+ "vpadd.f32 d1, d30, d31 \n\t"
+ "vpadd.f32 d0, d0, d1 \n\t"
+ "vst1.f32 {d0}, [%3] \n\t"
+
+ : "+&r"(a), "+&r"(b), "+&r"(n)
+ : "r"(res)
+ : "memory", "d0", "d1", "d2", "d3", "d4", "d5",
+ "d28", "d29", "d30", "d31" );
+}
+
+
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h
index 3ab1b056a..7ee728ac4 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i
+++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2009 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -18,13 +18,30 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef INCLUDED_DOTPROD_CCF_ARMV7_A_H
+#define INCLUDED_DOTPROD_CCF_ARMV7_A_H
-#ifndef SWIGIMPORTED
-%module(directors="1") gnuradio_swig_py_general
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
#endif
- //%feature("autodoc", "1"); // generate python docstrings
+/*!
+ * <pre>
+ *
+ * preconditions:
+ *
+ * n > 0 and a multiple of 4
+ * a 4-byte aligned
+ * b 16-byte aligned
+ *
+ * </pre>
+ */
+void dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n);
-%include "gnuradio.i" // the common stuff
+#ifdef __cplusplus
+}
+#endif
-%include "general.i"
+#endif /* INCLUDED_DOTPROD_CCF_ARMV7_A_H */
diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
index bd1b88e22..c3275c331 100644
--- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
+++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c
@@ -77,7 +77,8 @@ dotprod_fff_armv7_a(const float *a, const float *b, size_t n)
"vpadd.f32 d0, d16, d17 \n\t"
"vadd.f32 %0, s0, s1 \n\t"
: "=w"(s), "+r"(a), "+r"(b), "+r"(n)
- :: "q0", "q1", "q2", "q3", "q8", "q9");
+ :: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d16", "d17", "d18", "d19");
return s;
diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i
index 645607cba..58bb4f0d5 100644
--- a/gnuradio-core/src/lib/filter/filter.i
+++ b/gnuradio-core/src/lib/filter/filter.i
@@ -39,6 +39,8 @@
#include <gr_pfb_arb_resampler_ccf.h>
#include <gr_pfb_clock_sync_ccf.h>
#include <gr_pfb_clock_sync_fff.h>
+#include <gr_dc_blocker_cc.h>
+#include <gr_dc_blocker_ff.h>
%}
%include "gr_iir_filter_ffd.i"
@@ -62,5 +64,7 @@
%include "gr_pfb_arb_resampler_ccf.i"
%include "gr_pfb_clock_sync_ccf.i"
%include "gr_pfb_clock_sync_fff.i"
+%include "gr_dc_blocker_cc.i"
+%include "gr_dc_blocker_ff.i"
%include "filter_generated.i"
diff --git a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h
new file mode 100644
index 000000000..2d0916fb3
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+ *
+ * This file 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.
+ *
+ * This file 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.
+ *
+ * Under Section 7 of GPL version 3, you are granted additional
+ * permissions described in the GCC Runtime Library Exception, version
+ * 3.1, as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License and
+ * a copy of the GCC Runtime Library Exception along with this program;
+ * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* %ecx */
+#define bit_SSE3 (1 << 0)
+#define bit_PCLMUL (1 << 1)
+#define bit_SSSE3 (1 << 9)
+#define bit_FMA (1 << 12)
+#define bit_CMPXCHG16B (1 << 13)
+#define bit_SSE4_1 (1 << 19)
+#define bit_SSE4_2 (1 << 20)
+#define bit_MOVBE (1 << 22)
+#define bit_POPCNT (1 << 23)
+#define bit_AES (1 << 25)
+#define bit_XSAVE (1 << 26)
+#define bit_OSXSAVE (1 << 27)
+#define bit_AVX (1 << 28)
+
+/* %edx */
+#define bit_CMPXCHG8B (1 << 8)
+#define bit_CMOV (1 << 15)
+#define bit_MMX (1 << 23)
+#define bit_FXSAVE (1 << 24)
+#define bit_SSE (1 << 25)
+#define bit_SSE2 (1 << 26)
+
+/* Extended Features */
+/* %ecx */
+#define bit_LAHF_LM (1 << 0)
+#define bit_SSE4a (1 << 6)
+#define bit_SSE5 (1 << 11)
+
+/* %edx */
+#define bit_LM (1 << 29)
+#define bit_3DNOWP (1 << 30)
+#define bit_3DNOW (1 << 31)
+
+
+#if defined(__i386__) && defined(__PIC__)
+/* %ebx may be the PIC register. */
+#if __GNUC__ >= 3
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchg{l}\t{%%}ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchg{l}\t{%%}ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ nor alternatives in i386 code. */
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("xchgl\t%%ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchgl\t%%ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("xchgl\t%%ebx, %1\n\t" \
+ "cpuid\n\t" \
+ "xchgl\t%%ebx, %1\n\t" \
+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#endif
+#else
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level))
+
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
+ : "0" (level), "2" (count))
+#endif
+
+/* Return highest supported input value for cpuid instruction. ext can
+ be either 0x0 or 0x8000000 to return highest supported value for
+ basic or extended cpuid information. Function returns 0 if cpuid
+ is not supported or whatever cpuid returns in eax register. If sig
+ pointer is non-null, then first four bytes of the signature
+ (as found in ebx register) are returned in location pointed by sig. */
+
+static __inline unsigned int
+__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
+{
+ unsigned int __eax, __ebx, __ecx, __edx;
+
+#ifndef __x86_64__
+#if __GNUC__ >= 3
+ /* See if we can use cpuid. On AMD64 we always can. */
+ __asm__ ("pushf{l|d}\n\t"
+ "pushf{l|d}\n\t"
+ "pop{l}\t%0\n\t"
+ "mov{l}\t{%0, %1|%1, %0}\n\t"
+ "xor{l}\t{%2, %0|%0, %2}\n\t"
+ "push{l}\t%0\n\t"
+ "popf{l|d}\n\t"
+ "pushf{l|d}\n\t"
+ "pop{l}\t%0\n\t"
+ "popf{l|d}\n\t"
+ : "=&r" (__eax), "=&r" (__ebx)
+ : "i" (0x00200000));
+#else
+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ nor alternatives in i386 code. */
+ __asm__ ("pushfl\n\t"
+ "pushfl\n\t"
+ "popl\t%0\n\t"
+ "movl\t%0, %1\n\t"
+ "xorl\t%2, %0\n\t"
+ "pushl\t%0\n\t"
+ "popfl\n\t"
+ "pushfl\n\t"
+ "popl\t%0\n\t"
+ "popfl\n\t"
+ : "=&r" (__eax), "=&r" (__ebx)
+ : "i" (0x00200000));
+#endif
+
+ if (!((__eax ^ __ebx) & 0x00200000))
+ return 0;
+#endif
+
+ /* Host supports cpuid. Return highest supported cpuid input value. */
+ __cpuid (__ext, __eax, __ebx, __ecx, __edx);
+
+ if (__sig)
+ *__sig = __ebx;
+
+ return __eax;
+}
+
+/* Return cpuid data for requested cpuid level, as found in returned
+ eax, ebx, ecx and edx registers. The function checks if cpuid is
+ supported and returns 1 for valid cpuid information or 0 for
+ unsupported cpuid level. All pointers are required to be non-null. */
+
+static __inline int
+__get_cpuid (unsigned int __level,
+ unsigned int *__eax, unsigned int *__ebx,
+ unsigned int *__ecx, unsigned int *__edx)
+{
+ unsigned int __ext = __level & 0x80000000;
+
+ if (__get_cpuid_max (__ext, 0) < __level)
+ return 0;
+
+ __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
+ return 1;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc b/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc
index 8252509bb..f80bfd518 100644
--- a/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc
+++ b/gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.cc
@@ -36,6 +36,7 @@ gr_cma_equalizer_cc::gr_cma_equalizer_cc(int num_taps, float modulus, float mu)
: gr_adaptive_fir_ccf("cma_equalizer_cc", 1, std::vector<float>(num_taps)),
d_modulus(modulus), d_mu(mu)
{
- d_taps[0] = 1.0;
+ if (num_taps > 0)
+ d_taps[0] = 1.0;
}
diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc
index ac8a2eeb7..da970e133 100644
--- a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc
+++ b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc
@@ -21,13 +21,12 @@
*/
#include <gr_cpu.h>
+#include "gcc_x86_cpuid.h"
/*
* execute CPUID instruction, return EAX, EBX, ECX and EDX values in result
*/
-extern "C" {
-void cpuid_x86 (unsigned int op, unsigned int result[4]);
-};
+#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3)
/*
* CPUID functions returning a single datum
@@ -35,28 +34,28 @@ void cpuid_x86 (unsigned int op, unsigned int result[4]);
static inline unsigned int cpuid_eax(unsigned int op)
{
- unsigned int regs[4];
+ unsigned int regs[4] = {0,0,0,0};
cpuid_x86 (op, regs);
return regs[0];
}
static inline unsigned int cpuid_ebx(unsigned int op)
{
- unsigned int regs[4];
+ unsigned int regs[4] = {0,0,0,0};
cpuid_x86 (op, regs);
return regs[1];
}
static inline unsigned int cpuid_ecx(unsigned int op)
{
- unsigned int regs[4];
+ unsigned int regs[4] = {0,0,0,0};
cpuid_x86 (op, regs);
return regs[2];
}
static inline unsigned int cpuid_edx(unsigned int op)
{
- unsigned int regs[4];
+ unsigned int regs[4] = {0,0,0,0};
cpuid_x86 (op, regs);
return regs[3];
}
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc
new file mode 100644
index 000000000..e7d5ced25
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_dc_blocker_cc.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+moving_averager_c::moving_averager_c(int D)
+ : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0)
+{
+ d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0));
+}
+
+moving_averager_c::~moving_averager_c()
+{
+}
+
+gr_complex
+moving_averager_c::filter(gr_complex x)
+{
+ d_out_d1 = d_out;
+ d_delay_line.push_back(x);
+ d_out = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ gr_complex y = x - d_out_d1 + d_out_d2;
+ d_out_d2 = y;
+
+ return (y / (float)(d_length));
+}
+
+
+
+gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form)
+{
+ return gnuradio::get_initial_sptr(new gr_dc_blocker_cc(D, long_form));
+}
+
+
+gr_dc_blocker_cc::gr_dc_blocker_cc (int D, bool long_form)
+ : gr_sync_block ("dc_blocker_cc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_length(D), d_long_form(long_form)
+{
+ if(d_long_form) {
+ d_ma_0 = new moving_averager_c(D);
+ d_ma_1 = new moving_averager_c(D);
+ d_ma_2 = new moving_averager_c(D);
+ d_ma_3 = new moving_averager_c(D);
+ d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0));
+ }
+ else {
+ d_ma_0 = new moving_averager_c(D);
+ d_ma_1 = new moving_averager_c(D);
+ }
+}
+
+gr_dc_blocker_cc::~gr_dc_blocker_cc()
+{
+ if(d_long_form) {
+ delete d_ma_0;
+ delete d_ma_1;
+ delete d_ma_2;
+ delete d_ma_3;
+ }
+ else {
+ delete d_ma_0;
+ delete d_ma_1;
+ }
+}
+
+int
+gr_dc_blocker_cc::get_group_delay()
+{
+ if(d_long_form)
+ return (2*d_length-2);
+ else
+ return d_length - 1;
+}
+
+int
+gr_dc_blocker_cc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex*)input_items[0];
+ gr_complex *out = (gr_complex*)output_items[0];
+
+ if(d_long_form) {
+ gr_complex y1, y2, y3, y4, d;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ y3 = d_ma_2->filter(y2);
+ y4 = d_ma_3->filter(y3);
+
+ d_delay_line.push_back(d_ma_0->delayed_sig());
+ d = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ out[i] = d - y4;
+ }
+ }
+ else {
+ gr_complex y1, y2;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ out[i] = d_ma_0->delayed_sig() - y2;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h
new file mode 100644
index 000000000..de9ccc0ea
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h
@@ -0,0 +1,111 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+
+#ifndef INCLUDED_GR_DC_BLOCKER_CC_H
+#define INCLUDED_GR_DC_BLOCKER_CC_H
+
+#include <gr_sync_block.h>
+#include <deque>
+
+class gr_dc_blocker_cc;
+typedef boost::shared_ptr<gr_dc_blocker_cc> gr_dc_blocker_cc_sptr;
+gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true);
+
+/*!
+ * \class gr_dc_blocker_cc
+ * \brief a computationally efficient controllabel DC blocker
+ *
+ * \ingroup filter_blk
+ *
+ * This block implements a computationally efficient DC blocker that produces
+ * a tigher notch filter around DC for a smaller group delay than an
+ * equivalent FIR filter or using a single pole IIR filter (though the IIR
+ * filter is computationally cheaper).
+ *
+ * The block defaults to using a delay line of length 32 and the long form
+ * of the filter. Optionally, the delay line length can be changed to alter
+ * the width of the DC notch (longer lines will decrease the width).
+ *
+ * The long form of the filter produces a nearly flat response outside of
+ * the notch but at the cost of a group delay of 2D-2.
+ *
+ * The short form of the filter does not have as flat a response in the
+ * passband but has a group delay of only D-1 and is cheaper to compute.
+ *
+ * The theory behind this block can be found in the paper:
+ *
+ * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine,
+ * Mar. 2008, pp 132-134.</EM></B>
+ */
+class moving_averager_c
+{
+public:
+ moving_averager_c(int D);
+ ~moving_averager_c();
+
+ gr_complex filter(gr_complex x);
+ gr_complex delayed_sig() { return d_out; }
+
+private:
+ int d_length;
+ gr_complex d_out, d_out_d1, d_out_d2;
+ std::deque<gr_complex> d_delay_line;
+};
+
+class gr_dc_blocker_cc : public gr_sync_block
+{
+ private:
+ /*!
+ * Build the DC blocker.
+ * \param D (int) the length of the delay line
+ * \param long_form (bool) whether to use long (true, default) or short form
+ * \param channel (unsigned integer) Selects the channel to return [default=0].
+ */
+ friend gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form);
+
+ int d_length;
+ bool d_long_form;
+ moving_averager_c *d_ma_0;
+ moving_averager_c *d_ma_1;
+ moving_averager_c *d_ma_2;
+ moving_averager_c *d_ma_3;
+ std::deque<gr_complex> d_delay_line;
+
+ gr_dc_blocker_cc (int D, bool long_form);
+
+public:
+ ~gr_dc_blocker_cc ();
+
+ /*!
+ * Get the blocker's group delay that is based on length of delay lines
+ */
+ int get_group_delay();
+
+ //int set_length(int D);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i
new file mode 100644
index 000000000..b88fecbde
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_cc);
+
+gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true);
+
+class gr_dc_blocker_cc : public gr_sync_block
+{
+ private:
+ gr_dc_blocker_cc (int D, bool long_form);
+
+ public:
+ ~gr_dc_blocker_cc ();
+};
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc
new file mode 100644
index 000000000..d684bc7e8
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc
@@ -0,0 +1,138 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_dc_blocker_ff.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+
+moving_averager_f::moving_averager_f(int D)
+ : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0)
+{
+ d_delay_line = std::deque<float>(d_length-1, 0);
+}
+
+moving_averager_f::~moving_averager_f()
+{
+}
+
+float
+moving_averager_f::filter(float x)
+{
+ d_out_d1 = d_out;
+ d_delay_line.push_back(x);
+ d_out = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ float y = x - d_out_d1 + d_out_d2;
+ d_out_d2 = y;
+
+ return (y / (float)(d_length));
+}
+
+
+
+gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form)
+{
+ return gnuradio::get_initial_sptr(new gr_dc_blocker_ff(D, long_form));
+}
+
+
+gr_dc_blocker_ff::gr_dc_blocker_ff (int D, bool long_form)
+ : gr_sync_block ("dc_blocker_ff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(float))),
+ d_length(D), d_long_form(long_form)
+{
+ if(d_long_form) {
+ d_ma_0 = new moving_averager_f(D);
+ d_ma_1 = new moving_averager_f(D);
+ d_ma_2 = new moving_averager_f(D);
+ d_ma_3 = new moving_averager_f(D);
+ d_delay_line = std::deque<float>(d_length-1, 0);
+ }
+ else {
+ d_ma_0 = new moving_averager_f(D);
+ d_ma_1 = new moving_averager_f(D);
+ }
+}
+
+gr_dc_blocker_ff::~gr_dc_blocker_ff()
+{
+ if(d_long_form) {
+ delete d_ma_0;
+ delete d_ma_1;
+ delete d_ma_2;
+ delete d_ma_3;
+ }
+ else {
+ delete d_ma_0;
+ delete d_ma_1;
+ }
+}
+
+int
+gr_dc_blocker_ff::get_group_delay()
+{
+ if(d_long_form)
+ return (2*d_length-2);
+ else
+ return d_length - 1;
+}
+
+int
+gr_dc_blocker_ff::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ if(d_long_form) {
+ float y1, y2, y3, y4, d;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ y3 = d_ma_2->filter(y2);
+ y4 = d_ma_3->filter(y3);
+
+ d_delay_line.push_back(d_ma_0->delayed_sig());
+ d = d_delay_line[0];
+ d_delay_line.pop_front();
+
+ out[i] = d - y4;
+ }
+ }
+ else {
+ float y1, y2;
+ for(int i = 0; i < noutput_items; i++) {
+ y1 = d_ma_0->filter(in[i]);
+ y2 = d_ma_1->filter(y1);
+ out[i] = d_ma_0->delayed_sig() - y2;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h
new file mode 100644
index 000000000..b632d81da
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h
@@ -0,0 +1,111 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+
+#ifndef INCLUDED_GR_DC_BLOCKER_FF_H
+#define INCLUDED_GR_DC_BLOCKER_FF_H
+
+#include <gr_sync_block.h>
+#include <deque>
+
+class gr_dc_blocker_ff;
+typedef boost::shared_ptr<gr_dc_blocker_ff> gr_dc_blocker_ff_sptr;
+gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true);
+
+/*!
+ * \class gr_dc_blocker_ff
+ * \brief a computationally efficient controllabel DC blocker
+ *
+ * \ingroup filter_blk
+ *
+ * This block implements a computationally efficient DC blocker that produces
+ * a tigher notch filter around DC for a smaller group delay than an
+ * equivalent FIR filter or using a single pole IIR filter (though the IIR
+ * filter is computationally cheaper).
+ *
+ * The block defaults to using a delay line of length 32 and the long form
+ * of the filter. Optionally, the delay line length can be changed to alter
+ * the width of the DC notch (longer lines will decrease the width).
+ *
+ * The long form of the filter produces a nearly flat response outside of
+ * the notch but at the cost of a group delay of 2D-2.
+ *
+ * The short form of the filter does not have as flat a response in the
+ * passband but has a group delay of only D-1 and is cheaper to compute.
+ *
+ * The theory behind this block can be found in the paper:
+ *
+ * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine,
+ * Mar. 2008, pp 132-134.</EM></B>
+ */
+class moving_averager_f
+{
+public:
+ moving_averager_f(int D);
+ ~moving_averager_f();
+
+ float filter(float x);
+ float delayed_sig() { return d_out; }
+
+private:
+ int d_length;
+ float d_out, d_out_d1, d_out_d2;
+ std::deque<float> d_delay_line;
+};
+
+class gr_dc_blocker_ff : public gr_sync_block
+{
+ private:
+ /*!
+ * Build the DC blocker.
+ * \param D (int) the length of the delay line
+ * \param long_form (bool) whether to use long (true, default) or short form
+ * \param channel (unsigned integer) Selects the channel to return [default=0].
+ */
+ friend gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form);
+
+ int d_length;
+ bool d_long_form;
+ moving_averager_f *d_ma_0;
+ moving_averager_f *d_ma_1;
+ moving_averager_f *d_ma_2;
+ moving_averager_f *d_ma_3;
+ std::deque<float> d_delay_line;
+
+ gr_dc_blocker_ff (int D, bool long_form);
+
+public:
+ ~gr_dc_blocker_ff ();
+
+ /*!
+ * Get the blocker's group delay that is based on length of delay lines
+ */
+ int get_group_delay();
+
+ //int set_length(int D);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i
new file mode 100644
index 000000000..032145c9e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_ff);
+
+gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true);
+
+class gr_dc_blocker_ff : public gr_sync_block
+{
+ private:
+ gr_dc_blocker_ff (int D, bool long_form);
+
+ public:
+ ~gr_dc_blocker_ff ();
+};
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc
new file mode 100644
index 000000000..ac42b57b7
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_fir_ccf_armv7_a.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdexcept>
+#include <assert.h>
+#include <gr_math.h>
+#include <dotprod_ccf_armv7_a.h>
+
+#define FLOATS_PER_VEC 4
+
+gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a()
+ : gr_fir_ccf_generic(),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+}
+
+gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a (const std::vector<float> &new_taps)
+ : gr_fir_ccf_generic(new_taps),
+ d_naligned_taps(0), d_aligned_taps(0)
+{
+ set_taps(new_taps);
+}
+
+gr_fir_ccf_armv7_a::~gr_fir_ccf_armv7_a()
+{
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+}
+
+void
+gr_fir_ccf_armv7_a::set_taps(const std::vector<float> &inew_taps)
+{
+ gr_fir_ccf_generic::set_taps(inew_taps); // call superclass
+ d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC);
+
+ if (d_aligned_taps){
+ free(d_aligned_taps);
+ d_aligned_taps = 0;
+ }
+ void *p;
+ int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0]));
+ if (r != 0){
+ throw std::bad_alloc();
+ }
+ d_aligned_taps = (float *) p;
+ memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0]));
+ for (size_t i = ntaps(); i < d_naligned_taps; i++)
+ d_aligned_taps[i] = 0.0;
+}
+
+
+gr_complex
+gr_fir_ccf_armv7_a::filter (const gr_complex input[])
+{
+ if (d_naligned_taps == 0)
+ return 0.0;
+
+ gr_complex result;
+ float *presult = reinterpret_cast<float *>(&result);
+ const float *pinput = reinterpret_cast<const float *>(input);
+
+ dotprod_ccf_armv7_a(pinput, d_aligned_taps, presult, d_naligned_taps);
+ return result;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h
new file mode 100644
index 000000000..719ff4010
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2011 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GR_FIR_CCF_ARMV7_A_H
+#define INCLUDED_GR_FIR_CCF_ARMV7_A_H
+
+#include <gr_fir_ccf_generic.h>
+
+/*!
+ * \brief armv7_a using NEON coprocessor version of gr_fir_ccf
+ */
+class gr_fir_ccf_armv7_a : public gr_fir_ccf_generic
+{
+protected:
+
+ size_t d_naligned_taps; // number of taps (multiple of 4)
+ float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4
+
+public:
+ gr_fir_ccf_armv7_a();
+ gr_fir_ccf_armv7_a(const std::vector<float> &taps);
+ ~gr_fir_ccf_armv7_a();
+
+ virtual void set_taps (const std::vector<float> &taps);
+ virtual gr_complex filter (const gr_complex input[]);
+};
+
+#endif /* INCLUDED_GR_FIR_CCF_ARMV7_A*_H */
diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc
index 34c7d4c01..71e622d37 100644
--- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc
+++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2002,2008,2009,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,6 +28,7 @@
#include <gr_fir_ccf.h>
#include <gr_fir_ccf_generic.h>
+#include <gr_fir_ccf_armv7_a.h>
#include <gr_fir_fcc.h>
#include <gr_fir_fcc_generic.h>
#include <gr_fir_fff.h>
@@ -51,13 +52,13 @@ using std::cerr;
* ----------------------------------------------------------------
*/
-#if 0
static gr_fir_ccf *
-make_gr_fir_ccf_altivec(const std::vector<float> &taps)
+make_gr_fir_ccf_armv7_a (const std::vector<float> &taps)
{
- return new gr_fir_ccf_altivec(taps);
+ return new gr_fir_ccf_armv7_a(taps);
}
+#if 0
static gr_fir_fcc *
make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps)
{
@@ -107,15 +108,13 @@ gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector<float> &taps)
{
static bool first = true;
-#if 0
- if (gr_cpu::has_altivec ()){
+ if (gr_cpu::has_armv7_a ()){
if (first){
- cerr << ">>> gr_fir_ccf: using altivec\n";
+ cerr << ">>> gr_fir_ccf: using armv7_a\n";
first = false;
}
- return make_gr_fir_ccf_altivec (taps);
+ return make_gr_fir_ccf_armv7_a (taps);
}
-#endif
if (0 && first){
cerr << ">>> gr_fir_ccf: handing off to parent class\n";
@@ -245,15 +244,13 @@ gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *inf
// invoke parent..
gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info);
-#if 0
// add our stuff...
gr_fir_ccf_info t;
- if (gr_cpu::has_altivec ()){
- t.name = "altivec";
- t.create = make_gr_fir_ccf_altivec;
+ if (gr_cpu::has_armv7_a ()){
+ t.name = "armv7_a";
+ t.create = make_gr_fir_ccf_armv7_a;
(*info).push_back (t);
}
-#endif
}
void
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
index 84b0c578f..834450436 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
@@ -58,8 +58,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
process.
*/
d_int_rate = filter_size;
- d_dec_rate = (unsigned int)floor(d_int_rate/rate);
- d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_rate(rate);
// Store the last filter between calls to work
d_last_filter = 0;
@@ -81,8 +80,6 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
create_diff_taps(taps, dtaps);
create_taps(taps, d_taps, d_filters);
create_taps(dtaps, d_dtaps, d_diff_filters);
-
- set_relative_rate(rate);
}
gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
@@ -181,7 +178,6 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
// produce output as long as we can and there are enough input samples
int max_input = ninput_items[0]-(int)d_taps_per_filter;
while((i < noutput_items) && (count < max_input)) {
-
// start j by wrapping around mod the number of channels
while((j < d_int_rate) && (i < noutput_items)) {
// Take the current filter and derivative filter output
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
index cf5a79d4e..2c36c95f9 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
@@ -161,7 +161,12 @@ public:
* Print all of the filterbank taps to screen.
*/
void print_taps();
-
+ void set_rate (float rate) {
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_relative_rate(rate);
+ }
+
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
index 4f07af861..77f28acdf 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
@@ -38,4 +38,5 @@ class gr_pfb_arb_resampler_ccf : public gr_block
//void set_taps (const std::vector<float> &taps);
void print_taps();
+ void set_rate (float rate);
};
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
index 4e6ef5fc4..684ac85ce 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
@@ -84,7 +84,7 @@ class gr_fir_ccf;
* the block constructor, we just ask for "gain," which is d_alpha while d_beta is
* equal to (gain^2)/4.
*
- * The clock sync block needs to know the number of samples per second (sps), because it
+ * The clock sync block needs to know the number of samples per symbol (sps), because it
* only returns a single point representing the sample. The sps can be any positive real
* number and does not need to be an integer. The filter taps must also be specified. The
* taps are generated by first conceiving of the prototype filter that would be the signal's
@@ -115,7 +115,7 @@ class gr_pfb_clock_sync_ccf : public gr_block
private:
/*!
* Build the polyphase filterbank timing synchronizer.
- * \param sps (double) The number of samples per second in the incoming signal
+ * \param sps (double) The number of samples per symbol in the incoming signal
* \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default.
* \param taps (vector<int>) The filter taps.
* \param filter_size (uint) The number of filters in the filterbank (default = 32).
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
index 1bf4a6f4b..891905dd0 100644
--- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
@@ -99,7 +99,7 @@ gri_fft_filter_ccc_generic::compute_sizes(int ntaps)
{
int old_fftsize = d_fftsize;
d_ntaps = ntaps;
- d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2))));
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
d_nsamples = d_fftsize - d_ntaps + 1;
if (0)
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
index 74058fa93..b3fbe1d1a 100644
--- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
@@ -86,7 +86,7 @@ gri_fft_filter_fff_generic::compute_sizes(int ntaps)
{
int old_fftsize = d_fftsize;
d_ntaps = ntaps;
- d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2))));
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
d_nsamples = d_fftsize - d_ntaps + 1;
if (0)
diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
index ce71a3d88..ef41127fd 100644
--- a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
+++ b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
@@ -20,6 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/attributes.h>
#include <cppunit/TestAssert.h>
#include <qa_gr_rotator.h>
#include <gr_rotator.h>
@@ -29,7 +34,7 @@
// error vector magnitude
-__attribute__((unused)) static float
+__GR_ATTR_UNUSED static float
error_vector_mag(gr_complex a, gr_complex b)
{
return abs(a-b);
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
index e87d93ebf..ca76c8eb8 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
@@ -42,6 +42,7 @@ typedef gr_complex acc_type;
using std::vector;
+#define MAX_DATA (32767)
#define ERR_DELTA (1e-5)
#define NELEM(x) (sizeof (x) / sizeof (x[0]))
@@ -56,8 +57,8 @@ static void
random_complex (gr_complex *buf, unsigned n)
{
for (unsigned i = 0; i < n; i++){
- float re = rint (uniform () * 32767);
- float im = rint (uniform () * 32767);
+ float re = rint (uniform () * MAX_DATA);
+ float im = rint (uniform () * MAX_DATA);
buf[i] = gr_complex (re, im);
}
}
@@ -151,7 +152,7 @@ qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate)
for (int o = 0; o < (int)(ol/decimate); o++){
CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
- abs (expected_output[o]) * ERR_DELTA);
+ sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA);
}
delete f1;
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
index 3c379ea25..2fc97a78a 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
@@ -20,6 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/attributes.h>
#include <cppunit/TestAssert.h>
#include <qa_gri_mmse_fir_interpolator_cc.h>
#include <gri_mmse_fir_interpolator_cc.h>
@@ -55,7 +60,7 @@ void
qa_gri_mmse_fir_interpolator_cc::t1()
{
static const unsigned N = 100;
- gr_complex input[N + 10] __attribute__ ((aligned (8)));
+ __GR_ATTR_ALIGNED(8) gr_complex input[N + 10];
for (unsigned i = 0; i < NELEM(input); i++)
input[i] = test_fcn ((double) i);
diff --git a/gnuradio-core/src/lib/g72x/Makefile.am b/gnuradio-core/src/lib/g72x/Makefile.am
index 6c41f1911..d2700376f 100644
--- a/gnuradio-core/src/lib/g72x/Makefile.am
+++ b/gnuradio-core/src/lib/g72x/Makefile.am
@@ -24,4 +24,4 @@ include $(top_srcdir)/Makefile.common
noinst_LTLIBRARIES = libccitt.la
libccitt_la_SOURCES = g711.c g72x.c g721.c g723_24.c g723_40.c g72x.h
-EXTRA_DIST = encode.c decode.c
+EXTRA_DIST += encode.c decode.c
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index 3d8a42805..2a7a4b025 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -21,7 +21,9 @@
include $(top_srcdir)/Makefile.common
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
+# $(WITH_INCLUDES) must _always_ be last
+AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) \
+ $(FFTW3F_CPPFLAGS) $(GSL_CPPFLAGS) $(WITH_INCLUDES)
noinst_LTLIBRARIES = libgeneral.la libgeneral-qa.la
@@ -29,11 +31,12 @@ BUILT_SOURCES =
# ----------------------------------------------------------------
-EXTRA_DIST = \
+EXTRA_DIST += \
gen_sine_table.py \
gr_constants.cc.in
libgeneral_la_SOURCES = \
+ complex_vec_test.cc \
gr_additive_scrambler_bb.cc \
gr_agc_cc.cc \
gr_agc_ff.cc \
@@ -97,7 +100,6 @@ libgeneral_la_SOURCES = \
gr_lms_dfe_cc.cc \
gr_lms_dfe_ff.cc \
gr_map_bb.cc \
- gr_math.cc \
gr_misc.cc \
gr_mpsk_receiver_cc.cc \
gr_nlog10_ff.cc \
@@ -137,6 +139,7 @@ libgeneral_la_SOURCES = \
gr_rms_cf.cc \
gr_rms_ff.cc \
gr_short_to_float.cc \
+ gr_int_to_float.cc \
gr_simple_correlator.cc \
gr_simple_framer.cc \
gr_simple_squelch_cc.cc \
@@ -175,7 +178,10 @@ libgeneral_la_SOURCES = \
gr_descrambler_bb.cc \
gr_scrambler_bb.cc \
gr_probe_mpsk_snr_c.cc \
- gr_probe_density_b.cc
+ gr_probe_density_b.cc \
+ gr_annotator_alltoall.cc \
+ gr_annotator_1to1.cc \
+ gr_burst_tagger.cc
libgeneral_qa_la_SOURCES = \
qa_general.cc \
@@ -188,6 +194,7 @@ libgeneral_qa_la_SOURCES = \
qa_gri_lfsr.cc
grinclude_HEADERS = \
+ complex_vec_test.h \
gr_additive_scrambler_bb.h \
gr_agc_cc.h \
gr_agc_ff.h \
@@ -295,6 +302,7 @@ grinclude_HEADERS = \
gr_rms_cf.h \
gr_rms_ff.h \
gr_short_to_float.h \
+ gr_int_to_float.h \
gr_simple_correlator.h \
gr_simple_framer.h \
gr_simple_framer_sync.h \
@@ -344,7 +352,10 @@ grinclude_HEADERS = \
gr_descrambler_bb.h \
gr_scrambler_bb.h \
gr_probe_mpsk_snr_c.h \
- gr_probe_density_b.h
+ gr_probe_density_b.h \
+ gr_annotator_alltoall.h \
+ gr_annotator_1to1.h \
+ gr_burst_tagger.h
noinst_HEADERS = \
qa_general.h \
@@ -357,8 +368,8 @@ noinst_HEADERS = \
sine_table.h \
qa_gr_math.h
-if PYTHON
swiginclude_HEADERS = \
+ complex_vec_test.i \
general.i \
gr_additive_scrambler_bb.i \
gr_agc_cc.i \
@@ -409,6 +420,7 @@ swiginclude_HEADERS = \
gr_glfsr_source_b.i \
gr_glfsr_source_f.i \
gr_head.i \
+ gr_int_to_float.i \
gr_interleave.i \
gr_interleaved_short_to_complex.i \
gr_iqcomp_cc.i \
@@ -484,5 +496,7 @@ swiginclude_HEADERS = \
gr_descrambler_bb.i \
gr_scrambler_bb.i \
gr_probe_mpsk_snr_c.i \
- gr_probe_density_b.i
-endif
+ gr_probe_density_b.i \
+ gr_annotator_alltoall.i \
+ gr_annotator_1to1.i \
+ gr_burst_tagger.i
diff --git a/gnuradio-core/src/lib/general/complex_vec_test.cc b/gnuradio-core/src/lib/general/complex_vec_test.cc
new file mode 100644
index 000000000..df25c325e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/complex_vec_test.cc
@@ -0,0 +1,82 @@
+#include <complex_vec_test.h>
+#include <stddef.h>
+
+std::vector<std::complex<float> >
+complex_vec_test0()
+{
+ std::vector<std::complex<float> > r(5);
+
+ for (size_t i = 0; i < r.size(); i++)
+ r[i] = std::complex<float>(i, i);
+
+ return r;
+}
+
+std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input)
+{
+ std::vector<std::complex<float> > r(input.size());
+
+ for (size_t i = 0; i < input.size(); i++)
+ r[i] = std::complex<float>(input[i].real()+0.5, input[i].imag()-0.5);
+
+ return r;
+}
+
+std::complex<float>
+complex_scalar_test0()
+{
+ return std::complex<float>(5, 5);
+}
+
+std::complex<float>
+complex_scalar_test1(std::complex<float> input)
+{
+ return std::complex<float>(input.real()+0.5, input.imag()-0.5);
+}
+
+
+std::vector<float>
+float_vec_test0()
+{
+ std::vector<float> r(5);
+
+ for (size_t i = 0; i < r.size(); i++)
+ r[i] = (float) i;
+
+ return r;
+}
+
+std::vector<float>
+float_vec_test1(const std::vector<float> &input)
+{
+ std::vector<float> r(input.size());
+
+ for (size_t i = 0; i < input.size(); i++)
+ r[i] = input[i] + 0.5;
+
+ return r;
+}
+
+std::vector<int>
+int_vec_test0()
+{
+ std::vector<int> r(5);
+
+ for (size_t i = 0; i < r.size(); i++)
+ r[i] = (int) i;
+
+ return r;
+}
+
+std::vector<int>
+int_vec_test1(const std::vector<int> &input)
+{
+ std::vector<int> r(input.size());
+
+ for (size_t i = 0; i < input.size(); i++)
+ r[i] = input[i] + 1;
+
+ return r;
+}
+
diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h
new file mode 100644
index 000000000..d13dedf63
--- /dev/null
+++ b/gnuradio-core/src/lib/general/complex_vec_test.h
@@ -0,0 +1,27 @@
+#include <vector>
+#include <complex>
+
+std::vector<std::complex<float> >
+complex_vec_test0();
+
+std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input);
+
+std::complex<float>
+complex_scalar_test0();
+
+std::complex<float>
+complex_scalar_test1(std::complex<float> input);
+
+std::vector<int>
+int_vec_test0();
+
+std::vector<int>
+int_vec_test1(const std::vector<int> &input);
+
+std::vector<float>
+float_vec_test0();
+
+std::vector<float>
+float_vec_test1(const std::vector<float> &input);
+
diff --git a/gnuradio-core/src/lib/general/complex_vec_test.i b/gnuradio-core/src/lib/general/complex_vec_test.i
new file mode 100644
index 000000000..4b95633be
--- /dev/null
+++ b/gnuradio-core/src/lib/general/complex_vec_test.i
@@ -0,0 +1,25 @@
+
+std::vector<std::complex<float> >
+complex_vec_test0();
+
+std::vector<std::complex<float> >
+complex_vec_test1(const std::vector<std::complex<float> > &input);
+
+std::complex<float>
+complex_scalar_test0();
+
+std::complex<float>
+complex_scalar_test1(std::complex<float> input);
+
+std::vector<int>
+int_vec_test0();
+
+std::vector<int>
+int_vec_test1(const std::vector<int> &input);
+
+std::vector<float>
+float_vec_test0();
+
+std::vector<float>
+float_vec_test1(const std::vector<float> &input);
+
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 68cafce2e..e8a18ab19 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -42,6 +42,7 @@
#include <gr_float_to_char.h>
#include <gr_float_to_uchar.h>
#include <gr_short_to_float.h>
+#include <gr_int_to_float.h>
#include <gr_char_to_float.h>
#include <gr_uchar_to_float.h>
#include <gr_frequency_modulator_fc.h>
@@ -53,7 +54,7 @@
#include <gr_complex_to_xxx.h>
#include <gr_complex_to_interleaved_short.h>
#include <gr_interleaved_short_to_complex.h>
-#include <gr_endianness.h>
+//#include <gr_endianness.h>
#include <gr_firdes.h>
#include <gr_interleave.h>
#include <gr_deinterleave.h>
@@ -141,6 +142,10 @@
#include <gr_copy.h>
#include <gr_fll_band_edge_cc.h>
#include <gr_additive_scrambler_bb.h>
+#include <complex_vec_test.h>
+#include <gr_annotator_alltoall.h>
+#include <gr_annotator_1to1.h>
+#include <gr_burst_tagger.h>
%}
%include "gr_nop.i"
@@ -163,6 +168,7 @@
%include "gr_float_to_char.i"
%include "gr_float_to_uchar.i"
%include "gr_short_to_float.i"
+%include "gr_int_to_float.i"
%include "gr_char_to_float.i"
%include "gr_uchar_to_float.i"
%include "gr_frequency_modulator_fc.i"
@@ -173,7 +179,7 @@
%include "gr_align_on_samplenumbers_ss.i"
%include "gr_complex_to_xxx.i"
%include "gr_complex_to_interleaved_short.i"
-%include "gr_endianness.i"
+//%include "gr_endianness.i"
%include "gr_interleaved_short_to_complex.i"
%include "gr_firdes.i"
%include "gr_interleave.i"
@@ -262,3 +268,7 @@
%include "gr_copy.i"
%include "gr_fll_band_edge_cc.i"
%include "gr_additive_scrambler_bb.i"
+%include "complex_vec_test.i"
+%include "gr_annotator_alltoall.i"
+%include "gr_annotator_1to1.i"
+%include "gr_burst_tagger.i"
diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i
index 841613ca6..ea73dd46d 100644
--- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i
+++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i
@@ -22,7 +22,8 @@
GR_SWIG_BLOCK_MAGIC(gr,align_on_samplenumbers_ss);
-gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128);
+gr_align_on_samplenumbers_ss_sptr
+gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128) throw (std::exception);
class gr_align_on_samplenumbers_ss : public gr_block
{
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
new file mode 100644
index 000000000..511b356e5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_1to1.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+gr_annotator_1to1_sptr
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_annotator_1to1
+ (when, sizeof_stream_item));
+}
+
+gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_1to1",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+{
+ set_tag_propagation_policy(TPP_ONE_TO_ONE);
+
+ d_tag_counter = 0;
+ set_relative_rate(1.0);
+}
+
+gr_annotator_1to1::~gr_annotator_1to1 ()
+{
+}
+
+int
+gr_annotator_1to1::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+
+ std::vector<pmt::pmt_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items);
+
+ std::vector<pmt::pmt_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Storing the current noutput_items as the value to the "noutput_items" key
+ pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_read(0);
+ int noutputs = output_items.size();
+ for(int j = 0; j < noutput_items; j++) {
+ // the min() is a hack to make sure this doesn't segfault if there are a
+ // different number of ins and outs. This is specifically designed to test
+ // the 1-to-1 propagation policy.
+ for(int i = 0; i < std::min(noutputs, ninputs); i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ in = (const float*)input_items[i];
+ out = (float*)output_items[i];
+ out[j] = in[j];
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
new file mode 100644
index 000000000..4abc5b051
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H
+#define INCLUDED_GR_ANNOTATOR_1TO1_H
+
+#include <gr_sync_block.h>
+
+class gr_annotator_1to1;
+typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr;
+
+// public constructor
+gr_annotator_1to1_sptr
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
+
+/*!
+ * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000 items it sees. The
+ * tags contain the name and ID of the instantiated block, use "seq" as a key,
+ * and have a counter that increments by 1 for every tag produced that is used
+ * as the tag's value. The tags are propagated using the 1-to-1 policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These tags can be
+ * recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+class gr_annotator_1to1 : public gr_sync_block
+{
+ public:
+ ~gr_annotator_1to1 ();
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<pmt::pmt_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+protected:
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<pmt::pmt_t> d_stored_tags;
+
+ friend gr_annotator_1to1_sptr
+ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
new file mode 100644
index 000000000..f29ecbf53
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1);
+
+gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when,
+ size_t sizeof_stream_item);
+
+class gr_annotator_1to1 : public gr_sync_block
+{
+public:
+ std::vector<pmt::pmt_t> data() const;
+
+private:
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
new file mode 100644
index 000000000..344fd088b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_alltoall.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+gr_annotator_alltoall_sptr
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_annotator_alltoall
+ (when, sizeof_stream_item));
+}
+
+gr_annotator_alltoall::gr_annotator_alltoall (int when,
+ size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_alltoall",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+{
+ set_tag_propagation_policy(TPP_ALL_TO_ALL);
+
+ d_tag_counter = 0;
+}
+
+gr_annotator_alltoall::~gr_annotator_alltoall ()
+{
+}
+
+int
+gr_annotator_alltoall::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0, end_N;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+ end_N = abs_N + (uint64_t)(noutput_items);
+
+ std::vector<pmt::pmt_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, end_N);
+
+ std::vector<pmt::pmt_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Source ID and key for any tag that might get applied from this block
+ pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_written(0);
+ int noutputs = output_items.size();
+
+ for(int j = 0; j < noutput_items; j++) {
+ for(int i = 0; i < noutputs; i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ // Sum all of the inputs together for each output. Just 'cause.
+ out = (float*)output_items[i];
+ out[j] = 0;
+ for(int ins = 0; ins < ninputs; ins++) {
+ in = (const float*)input_items[ins];
+ out[j] += in[j];
+ }
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
new file mode 100644
index 000000000..e1e51ebf3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+
+#include <gr_sync_block.h>
+
+class gr_annotator_alltoall;
+typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr;
+
+// public constructor
+gr_annotator_alltoall_sptr
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
+
+/*!
+ * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000 items it sees. The
+ * tags contain the name and ID of the instantiated block, use "seq" as a key,
+ * and have a counter that increments by 1 for every tag produced that is used
+ * as the tag's value. The tags are propagated using the all-to-all policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These tags can be
+ * recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+class gr_annotator_alltoall : public gr_sync_block
+{
+ public:
+ ~gr_annotator_alltoall ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<pmt::pmt_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+protected:
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<pmt::pmt_t> d_stored_tags;
+
+ friend gr_annotator_alltoall_sptr
+ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_tmp_path.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
index 1f0c830cd..f9bf6dd9a 100644
--- a/gnuradio-core/src/lib/runtime/gr_tmp_path.cc
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,33 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-#include <gr_tmp_path.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall);
-const char *
-gr_tmp_path ()
-{
- static char *pp = 0;
-
- if (pp)
- return pp;
-
- char *s = getenv ("TMP");
- if (s){
- pp = strdup (s);
- return pp;
- }
+gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when,
+ size_t sizeof_stream_item);
-#ifdef P_tmpdir
- if (P_tmpdir){
- pp = strdup (P_tmpdir);
- return pp;
- }
-#endif
-
- pp = strdup ("/tmp");
- return pp;
-}
+class gr_annotator_alltoall : public gr_sync_block
+{
+public:
+ std::vector<pmt::pmt_t> data() const;
+
+private:
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
+};
diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
index 5cec882f0..be98a464b 100644
--- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
+++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -19,6 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+// Directors are only supported in Python, Java and C#. gr_feval_dd uses directors
+#ifdef SWIGPYTHON
+
GR_SWIG_BLOCK_MAGIC(gr,bin_statistics_f);
gr_bin_statistics_f_sptr
@@ -40,3 +43,5 @@ private:
public:
~gr_bin_statistics_f();
};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
new file mode 100644
index 000000000..4b3847b08
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_burst_tagger.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_burst_tagger_sptr
+gr_make_burst_tagger(size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_burst_tagger(itemsize));
+}
+
+gr_burst_tagger::gr_burst_tagger(size_t itemsize)
+ : gr_sync_block ("burst_tagger",
+ gr_make_io_signature2 (2, 2, itemsize, sizeof(short)),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize), d_state(false)
+{
+ std::stringstream str;
+ str << name() << unique_id();
+
+ d_key = pmt::pmt_string_to_symbol("burst");
+ d_id = pmt::pmt_string_to_symbol(str.str());
+}
+
+gr_burst_tagger::~gr_burst_tagger()
+{
+}
+
+int
+gr_burst_tagger::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *signal = (const char*)input_items[0];
+ const short *trigger = (const short*)input_items[1];
+ char *out = (char*)output_items[0];
+
+ memcpy(out, signal, noutput_items * d_itemsize);
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(trigger[i] > 0) {
+ if(d_state == false) {
+ d_state = true;
+ pmt::pmt_t value = pmt::PMT_T;
+ add_item_tag(0, nitems_written(0)+i, d_key, value, d_id);
+ }
+ }
+ else {
+ if(d_state == true) {
+ d_state = false;
+ pmt::pmt_t value = pmt::PMT_F;
+ add_item_tag(0, nitems_written(0)+i, d_key, value, d_id);
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h
new file mode 100644
index 000000000..8f814bea0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifndef INCLUDED_GR_BURST_TAGGER_H
+#define INCLUDED_GR_BURST_TAGGER_H
+
+#include <gr_sync_block.h>
+
+class gr_burst_tagger;
+typedef boost::shared_ptr<gr_burst_tagger> gr_burst_tagger_sptr;
+
+gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+
+/*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ */
+class gr_burst_tagger : public gr_sync_block
+{
+ size_t d_itemsize;
+ bool d_state;
+ pmt::pmt_t d_key;
+ pmt::pmt_t d_id;
+
+ friend gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+ gr_burst_tagger(size_t itemsize);
+
+ public:
+ ~gr_burst_tagger();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i
index 8f444f9c5..ebf1eea8c 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2009 Free Software Foundation, Inc.
+ * Copyright 2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SWIGIMPORTED
-%module(directors="1") gnuradio_swig_py_runtime
-#endif
+GR_SWIG_BLOCK_MAGIC(gr,burst_tagger)
- //%feature("autodoc", "1"); // generate python docstrings
+gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
-#define SW_RUNTIME
-%include "gnuradio.i" // the common stuff
-
-%include "runtime.i"
+class gr_burst_tagger : public gr_sync_block
+{
+ private:
+ gr_burst_tagger(size_t itemsize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
index 23bbf821f..7c20f7fd9 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
@@ -33,7 +33,7 @@
// Public constructor
-
+static const int FUDGE = 16;
gr_clock_recovery_mm_cc_sptr
gr_make_clock_recovery_mm_cc(float omega, float gain_omega, float mu, float gain_mu,
@@ -78,7 +78,7 @@ gr_clock_recovery_mm_cc::forecast(int noutput_items, gr_vector_int &ninput_items
unsigned ninputs = ninput_items_required.size();
for (unsigned i=0; i < ninputs; i++)
ninput_items_required[i] =
- (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
+ (int) ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE;
}
gr_complex
@@ -111,8 +111,6 @@ gr_clock_recovery_mm_cc::slicer_45deg (gr_complex sample)
algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033.
*/
-static const int FUDGE = 16;
-
int
gr_clock_recovery_mm_cc::general_work (int noutput_items,
gr_vector_int &ninput_items,
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i
index 98d326b28..27eb70b95 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i
@@ -22,9 +22,10 @@
GR_SWIG_BLOCK_MAGIC(gr,clock_recovery_mm_cc);
-gr_clock_recovery_mm_cc_sptr gr_make_clock_recovery_mm_cc (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit);
+gr_clock_recovery_mm_cc_sptr
+gr_make_clock_recovery_mm_cc (float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit) throw(std::exception);
class gr_clock_recovery_mm_cc : public gr_sync_block
{
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i
index 4f08aa760..1b2437000 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i
@@ -22,9 +22,10 @@
GR_SWIG_BLOCK_MAGIC(gr,clock_recovery_mm_ff);
-gr_clock_recovery_mm_ff_sptr gr_make_clock_recovery_mm_ff (float omega, float gain_omega,
- float mu, float gain_mu,
- float omega_relative_limit=0.001);
+gr_clock_recovery_mm_ff_sptr
+gr_make_clock_recovery_mm_ff (float omega, float gain_omega,
+ float mu, float gain_mu,
+ float omega_relative_limit=0.001) throw(std::exception);
class gr_clock_recovery_mm_ff : public gr_sync_block
{
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
index d5425bfc8..c5e1320a3 100644
--- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
+++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
@@ -39,7 +39,7 @@ gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb()
{
float RATE = 0.5;
float ebn0 = 12.0;
- float esn0 = RATE*pow(10.0, ebn0/10);
+ float esn0 = RATE*pow(10.0, ebn0/10.0);
gen_met(d_mettab, 100, esn0, 0.0, 256);
viterbi_chunks_init(d_state0);
diff --git a/gnuradio-core/src/lib/general/gr_feval.i b/gnuradio-core/src/lib/general/gr_feval.i
index 8594a6fa1..c5522805d 100644
--- a/gnuradio-core/src/lib/general/gr_feval.i
+++ b/gnuradio-core/src/lib/general/gr_feval.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -43,6 +43,9 @@
*/
+// Directors are only supported in Python, Java and C#
+#ifdef SWIGPYTHON
+
// Enable SWIG directors for these classes
%feature("director") gr_py_feval_dd;
%feature("director") gr_py_feval_cc;
@@ -197,3 +200,5 @@ long gr_feval_ll_example(gr_feval_ll *f, long x);
%rename(feval_example) gr_feval_example;
void gr_feval_example(gr_feval *f);
+
+#endif // SWIGPYTHON
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.i b/gnuradio-core/src/lib/general/gr_fft_vcc.i
index 247571374..f35316e70 100644
--- a/gnuradio-core/src/lib/general/gr_fft_vcc.i
+++ b/gnuradio-core/src/lib/general/gr_fft_vcc.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2007,2008 Free Software Foundation, Inc.
+ * Copyright 2004,2007,2008,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,7 +23,7 @@
GR_SWIG_BLOCK_MAGIC(gr, fft_vcc)
gr_fft_vcc_sptr
-gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> window, bool shift=false);
+gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, bool shift=false);
class gr_fft_vcc : public gr_sync_block
{
diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.cc b/gnuradio-core/src/lib/general/gr_fft_vfc.cc
index 608161efe..561c63740 100644
--- a/gnuradio-core/src/lib/general/gr_fft_vfc.cc
+++ b/gnuradio-core/src/lib/general/gr_fft_vfc.cc
@@ -40,12 +40,12 @@
gr_fft_vfc_sptr
-gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> window)
+gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window)
{
return gnuradio::get_initial_sptr(new gr_fft_vfc (fft_size, forward, window));
}
-gr_fft_vfc::gr_fft_vfc (int fft_size, bool forward, const std::vector<float> window)
+gr_fft_vfc::gr_fft_vfc (int fft_size, bool forward, const std::vector<float> &window)
: gr_sync_block ("fft_vfc",
gr_make_io_signature (1, 1, fft_size * sizeof (float)),
gr_make_io_signature (1, 1, fft_size * sizeof (gr_complex))),
@@ -107,7 +107,7 @@ gr_fft_vfc::work (int noutput_items,
}
bool
-gr_fft_vfc::set_window(const std::vector<float> window)
+gr_fft_vfc::set_window(const std::vector<float> &window)
{
if(window.size()==0 || window.size()==d_fft_size) {
d_window=window;
diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.h b/gnuradio-core/src/lib/general/gr_fft_vfc.h
index 054a383ef..074574477 100644
--- a/gnuradio-core/src/lib/general/gr_fft_vfc.h
+++ b/gnuradio-core/src/lib/general/gr_fft_vfc.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,7 +31,7 @@ class gr_fft_vfc;
typedef boost::shared_ptr<gr_fft_vfc> gr_fft_vfc_sptr;
gr_fft_vfc_sptr
-gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float>);
+gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window);
/*!
* \brief Compute forward FFT. float vector in / complex vector out.
@@ -41,13 +41,13 @@ gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float>);
class gr_fft_vfc : public gr_sync_block
{
friend gr_fft_vfc_sptr
- gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> window);
+ gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window);
unsigned int d_fft_size;
std::vector<float> d_window;
gri_fft_complex *d_fft;
- gr_fft_vfc (int fft_size, bool forward, const std::vector<float> window);
+ gr_fft_vfc (int fft_size, bool forward, const std::vector<float> &window);
public:
~gr_fft_vfc ();
@@ -55,7 +55,7 @@ class gr_fft_vfc : public gr_sync_block
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
- bool set_window(const std::vector<float> window);
+ bool set_window(const std::vector<float> &window);
};
diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.i b/gnuradio-core/src/lib/general/gr_fft_vfc.i
index 90c368fe6..149745b58 100644
--- a/gnuradio-core/src/lib/general/gr_fft_vfc.i
+++ b/gnuradio-core/src/lib/general/gr_fft_vfc.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,13 +23,14 @@
GR_SWIG_BLOCK_MAGIC(gr, fft_vfc)
gr_fft_vfc_sptr
-gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> window);
+gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window)
+throw(std::exception);
class gr_fft_vfc : public gr_sync_block
{
protected:
- gr_fft_vfc (int fft_size, bool forward, const std::vector<float> window);
+ gr_fft_vfc (int fft_size, bool forward, const std::vector<float> &window);
public:
- bool set_window(const std::vector<float> window);
+ bool set_window(const std::vector<float> &window);
};
diff --git a/gnuradio-core/src/lib/general/gr_firdes.cc b/gnuradio-core/src/lib/general/gr_firdes.cc
index 8efeb3438..5d192d67e 100644
--- a/gnuradio-core/src/lib/general/gr_firdes.cc
+++ b/gnuradio-core/src/lib/general/gr_firdes.cc
@@ -574,7 +574,7 @@ gr_firdes::gaussian (double gain,
vector<float> taps(ntaps);
double scale = 0;
double dt = 1.0/spb;
- double s = 1.0/(sqrt(log(2)) / (2*M_PI*bt));
+ double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt));
double t0 = -0.5 * ntaps;
double ts;
for(int i=0;i<ntaps;i++)
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
index 0f6f0d719..bff22be25 100644
--- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,6 +28,7 @@
#include <gr_io_signature.h>
#include <gr_sincos.h>
#include <math.h>
+#include <boost/math/special_functions/trunc.hpp>
gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity)
@@ -62,7 +63,7 @@ gr_frequency_modulator_fc::work (int noutput_items,
// to avoid loss of precision in the addition above.
if (fabs (d_phase) > 16 * M_PI){
- double ii = trunc (d_phase / (2 * M_PI));
+ double ii = boost::math::trunc (d_phase / (2 * M_PI));
d_phase = d_phase - (ii * 2 * M_PI);
}
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h
index 4ba05d709..55f8412ce 100644
--- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h
@@ -47,7 +47,9 @@ class gr_frequency_modulator_fc : public gr_sync_block
gr_frequency_modulator_fc (double sensitivity);
public:
-
+ void set_sensitivity(float sens) { d_sensitivity = sens; }
+ float get_sensitivity() { return d_sensitivity; }
+
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i
index 612b59026..04d9a41ba 100644
--- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i
@@ -28,4 +28,7 @@ class gr_frequency_modulator_fc : public gr_sync_block
{
private:
gr_frequency_modulator_fc (double sensitivity);
+public:
+ void set_sensitivity(float sens) { d_sensitivity = sens; }
+ float get_sensitivity() { return d_sensitivity; }
};
diff --git a/gnuradio-core/src/lib/general/gr_fxpt.cc b/gnuradio-core/src/lib/general/gr_fxpt.cc
index e752364a5..fae02c71e 100644
--- a/gnuradio-core/src/lib/general/gr_fxpt.cc
+++ b/gnuradio-core/src/lib/general/gr_fxpt.cc
@@ -30,9 +30,8 @@ const float gr_fxpt::s_sine_table[1 << NBITS][2] = {
#include "sine_table.h"
};
-// gcc 4.x fix
-const float gr_fxpt::TWO_TO_THE_31;
-const float gr_fxpt::PI;
+const float gr_fxpt::PI = 3.14159265358979323846;
+const float gr_fxpt::TWO_TO_THE_31 = 2147483648.0;
#if 0
/*
diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h
index 520729f8d..c98d31b27 100644
--- a/gnuradio-core/src/lib/general/gr_fxpt.h
+++ b/gnuradio-core/src/lib/general/gr_fxpt.h
@@ -40,8 +40,8 @@ class gr_fxpt
static const int WORDBITS = 32;
static const int NBITS = 10;
static const float s_sine_table[1 << NBITS][2];
- static const float PI = 3.14159265358979323846;
- static const float TWO_TO_THE_31 = 2147483648.0;
+ static const float PI;
+ static const float TWO_TO_THE_31;
public:
static gr_int32
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc
new file mode 100644
index 000000000..b5a19e5c0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.cc
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_int_to_float.h>
+#include <gr_io_signature.h>
+
+gr_int_to_float_sptr
+gr_make_int_to_float ()
+{
+ return gnuradio::get_initial_sptr(new gr_int_to_float ());
+}
+
+gr_int_to_float::gr_int_to_float ()
+ : gr_sync_block ("gr_int_to_float",
+ gr_make_io_signature (1, 1, sizeof (int32_t)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+{
+}
+
+int
+gr_int_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const int32_t *in = (const int32_t *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for(int i=0; i < noutput_items; i++) {
+ out[i] = (float)in[i];
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h
new file mode 100644
index 000000000..cf1223be5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+#ifndef INCLUDED_GR_INT_TO_FLOAT_H
+#define INCLUDED_GR_INT_TO_FLOAT_H
+
+#include <gr_sync_block.h>
+
+class gr_int_to_float;
+typedef boost::shared_ptr<gr_int_to_float> gr_int_to_float_sptr;
+
+gr_int_to_float_sptr
+gr_make_int_to_float ();
+
+/*!
+ * \brief Convert stream of short to a stream of float
+ * \ingroup converter_blk
+ */
+
+class gr_int_to_float : public gr_sync_block
+{
+ friend gr_int_to_float_sptr gr_make_int_to_float ();
+ gr_int_to_float ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_INT_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_tmp_path.h b/gnuradio-core/src/lib/general/gr_int_to_float.i
index 3d02043c7..8cb9e35b5 100644
--- a/gnuradio-core/src/lib/runtime/gr_tmp_path.h
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,12 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef _GR_TMP_PATH_H_
-#define _GR_TMP_PATH_H_
+GR_SWIG_BLOCK_MAGIC(gr,int_to_float)
-/*!
- * \brief return directory portion of pathname used for temporary files.
- */
-const char *gr_tmp_path ();
+gr_int_to_float_sptr gr_make_int_to_float ();
-#endif /* _GR_TMP_PATH_H_ */
+class gr_int_to_float : public gr_sync_block
+{
+ gr_int_to_float ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
index c07e177fe..85495e277 100644
--- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
@@ -38,8 +38,9 @@ gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n)
: gr_block ("keep_one_in_n",
gr_make_io_signature (1, 1, item_size),
gr_make_io_signature (1, 1, item_size)),
- d_n (n), d_count(n)
+ d_count(n)
{
+ set_n(n);
}
void
@@ -50,6 +51,8 @@ gr_keep_one_in_n::set_n(int n)
d_n = n;
d_count = n;
+
+ set_relative_rate(1.0 / (float)n);
}
int
diff --git a/gnuradio-core/src/lib/general/gr_math.cc b/gnuradio-core/src/lib/general/gr_math.cc
deleted file mode 100644
index 82dff469c..000000000
--- a/gnuradio-core/src/lib/general/gr_math.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2003 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gr_math.h>
-#include <math.h>
-
-/*
- * Greatest Common Divisor, using Euclid's algorithm.
- * [There are faster algorithms. See Knuth 4.5.2 if you care]
- */
-
-long
-gr_gcd (long m, long n)
-{
- if (m < 0)
- m = -m;
-
- if (n < 0)
- n = -n;
-
- while (n != 0){
- long t = m % n;
- m = n;
- n = t;
- }
-
- return m;
-}
-
-
-/*
- * These really need some configure hacking to figure out the right answer.
- * As a stop gap, try for a macro, and if not that, then try std::
- */
-
-// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise
-
-#if defined(isnan) || !defined(CXX_HAS_STD_ISNAN)
-
-int
-gr_isnan (double value)
-{
- return isnan (value);
-}
-
-#else
-
-int
-gr_isnan (double value)
-{
- return std::isnan (value);
-}
-
-#endif
-
-// returns a non-zero value if the value of x has its sign bit set.
-//
-// This is not the same as `x < 0.0', because IEEE 754 floating point
-// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but
-// `gr_signbit (-0.0)' will return a nonzero value.
-
-#ifdef signbit
-
-int
-gr_signbit (double x)
-{
- return signbit (x);
-}
-
-#else
-
-int
-gr_signbit (double x)
-{
- return std::signbit (x);
-}
-
-
-#endif
diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h
index ea0f20027..f5935c1da 100644
--- a/gnuradio-core/src/lib/general/gr_math.h
+++ b/gnuradio-core/src/lib/general/gr_math.h
@@ -35,19 +35,6 @@ gr_is_power_of_2(long x)
return x != 0 && (x & (x-1)) == 0;
}
-long gr_gcd (long m, long n);
-
-// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise
-int gr_isnan (double value);
-
-// returns a non-zero value if the value of x has its sign bit set.
-//
-// This is not the same as `x < 0.0', because IEEE 754 floating point
-// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but
-// `gr_signbit (-0.0)' will return a nonzero value.
-
-int gr_signbit (double x);
-
/*!
* \brief Fast arc tangent using table lookup and linear interpolation
* \ingroup misc
diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h
index 024d74ada..f17b68aa0 100644
--- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h
+++ b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h
@@ -23,6 +23,7 @@
#ifndef INCLUDED_GR_MPSK_RECEIVER_CC_H
#define INCLUDED_GR_MPSK_RECEIVER_CC_H
+#include <gruel/attributes.h>
#include <gr_block.h>
#include <gr_complex.h>
#include <fstream>
@@ -299,7 +300,7 @@ protected:
static const unsigned int DLLEN = 8;
//! delay line plus some length for overflow protection
- gr_complex d_dl[2*DLLEN] __attribute__ ((aligned(8)));
+ __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
//! index to delay line
unsigned int d_dl_idx;
diff --git a/gnuradio-core/src/lib/general/gr_nop.cc b/gnuradio-core/src/lib/general/gr_nop.cc
index e69c8b340..bd5e4fd81 100644
--- a/gnuradio-core/src/lib/general/gr_nop.cc
+++ b/gnuradio-core/src/lib/general/gr_nop.cc
@@ -25,18 +25,30 @@
#endif
#include <gr_nop.h>
#include <gr_io_signature.h>
+#include <boost/bind.hpp>
+
+gr_nop_sptr
+gr_make_nop (size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item));
+}
gr_nop::gr_nop (size_t sizeof_stream_item)
: gr_block ("nop",
- gr_make_io_signature (0, -1, sizeof_stream_item),
- gr_make_io_signature (0, -1, sizeof_stream_item))
+ gr_make_io_signature (0, -1, sizeof_stream_item),
+ gr_make_io_signature (0, -1, sizeof_stream_item)),
+ d_nmsgs_recvd(0)
{
+ // Arrange to have count_received_msgs called when messages are received.
+ set_msg_handler(boost::bind(&gr_nop::count_received_msgs, this, _1));
}
-gr_block_sptr
-gr_make_nop (size_t sizeof_stream_item)
+// Trivial message handler that just counts them.
+// (N.B., This feature is used in qa_set_msg_handler)
+void
+gr_nop::count_received_msgs(pmt::pmt_t msg)
{
- return gnuradio::get_initial_sptr (new gr_nop (sizeof_stream_item));
+ d_nmsgs_recvd++;
}
int
@@ -51,5 +63,3 @@ gr_nop::general_work (int noutput_items,
return noutput_items;
}
-
-
diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h
index 60b20c5ab..354c2f9fc 100644
--- a/gnuradio-core/src/lib/general/gr_nop.h
+++ b/gnuradio-core/src/lib/general/gr_nop.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,24 +26,35 @@
#include <gr_block.h>
#include <stddef.h> // size_t
+class gr_nop;
+typedef boost::shared_ptr<gr_nop> gr_nop_sptr;
+
+gr_nop_sptr
+gr_make_nop (size_t sizeof_stream_item);
+
/*!
* \brief Does nothing. Used for testing only.
* \ingroup misc_blk
*/
class gr_nop : public gr_block
{
- friend gr_block_sptr gr_make_nop (size_t sizeof_stream_item);
-
+ friend gr_nop_sptr gr_make_nop (size_t sizeof_stream_item);
gr_nop (size_t sizeof_stream_item);
+protected:
+ int d_nmsgs_recvd;
+
+ // Method that just counts any received messages.
+ void count_received_msgs(pmt::pmt_t msg);
+
public:
virtual int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
-};
-gr_block_sptr
-gr_make_nop (size_t sizeof_stream_item);
+ int nmsgs_received() const { return d_nmsgs_recvd; }
+
+};
#endif /* INCLUDED_GR_NOP_H */
diff --git a/gnuradio-core/src/lib/general/gr_nop.i b/gnuradio-core/src/lib/general/gr_nop.i
index 8220e5c6c..85354d421 100644
--- a/gnuradio-core/src/lib/general/gr_nop.i
+++ b/gnuradio-core/src/lib/general/gr_nop.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,11 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-%ignore gr_nop;
+GR_SWIG_BLOCK_MAGIC(gr,nop)
+
+gr_nop_sptr gr_make_nop (size_t sizeof_stream_item);
+
class gr_nop : public gr_block {
- friend gr_block_sptr gr_make_nop (size_t sizeof_stream_item);
+private:
gr_nop (size_t sizeof_stream_item);
};
-%rename(nop) gr_make_nop;
-gr_block_sptr gr_make_nop (size_t sizeof_stream_item);
diff --git a/gnuradio-core/src/lib/general/gr_null_sink.cc b/gnuradio-core/src/lib/general/gr_null_sink.cc
index 0b7f2d9e8..67ef57a46 100644
--- a/gnuradio-core/src/lib/general/gr_null_sink.cc
+++ b/gnuradio-core/src/lib/general/gr_null_sink.cc
@@ -34,7 +34,7 @@ gr_null_sink::gr_null_sink (size_t sizeof_stream_item)
{
}
-gr_block_sptr
+gr_null_sink_sptr
gr_make_null_sink (size_t sizeof_stream_item)
{
return gnuradio::get_initial_sptr (new gr_null_sink (sizeof_stream_item));
diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gnuradio-core/src/lib/general/gr_null_sink.h
index 66df5d138..6d00382a5 100644
--- a/gnuradio-core/src/lib/general/gr_null_sink.h
+++ b/gnuradio-core/src/lib/general/gr_null_sink.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,15 +26,20 @@
#include <gr_sync_block.h>
#include <stddef.h> // size_t
+class gr_null_sink;
+typedef boost::shared_ptr<gr_null_sink> gr_null_sink_sptr;
+
+gr_null_sink_sptr
+gr_make_null_sink (size_t sizeof_stream_item);
+
+
/*!
* \brief Bit bucket
* \ingroup sink_blk
*/
-
class gr_null_sink : public gr_sync_block
{
- friend gr_block_sptr gr_make_null_sink (size_t sizeof_stream_item);
-
+ friend gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item);
gr_null_sink (size_t sizeof_stream_item);
public:
@@ -45,7 +50,4 @@ class gr_null_sink : public gr_sync_block
};
-gr_block_sptr
-gr_make_null_sink (size_t sizeof_stream_item);
-
#endif /* INCLUDED_GR_NULL_SINK_H */
diff --git a/gnuradio-core/src/lib/general/gr_null_sink.i b/gnuradio-core/src/lib/general/gr_null_sink.i
index fc4bcffda..e739ce118 100644
--- a/gnuradio-core/src/lib/general/gr_null_sink.i
+++ b/gnuradio-core/src/lib/general/gr_null_sink.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,11 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-%ignore gr_null_sink;
+GR_SWIG_BLOCK_MAGIC(gr,null_sink)
+
+gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item);
+
class gr_null_sink : public gr_sync_block {
- friend gr_block_sptr gr_make_null_sink (size_t sizeof_stream_item);
+private:
gr_null_sink (size_t sizeof_stream_item);
};
-%rename(null_sink) gr_make_null_sink;
-gr_block_sptr gr_make_null_sink (size_t sizeof_stream_item);
diff --git a/gnuradio-core/src/lib/general/gr_null_source.cc b/gnuradio-core/src/lib/general/gr_null_source.cc
index b65c39035..85fd2db4b 100644
--- a/gnuradio-core/src/lib/general/gr_null_source.cc
+++ b/gnuradio-core/src/lib/general/gr_null_source.cc
@@ -35,7 +35,7 @@ gr_null_source::gr_null_source (size_t sizeof_stream_item)
{
}
-gr_block_sptr
+gr_null_source_sptr
gr_make_null_source (size_t sizeof_stream_item)
{
return gnuradio::get_initial_sptr (new gr_null_source (sizeof_stream_item));
diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gnuradio-core/src/lib/general/gr_null_source.h
index 63b1939bf..b1a46a195 100644
--- a/gnuradio-core/src/lib/general/gr_null_source.h
+++ b/gnuradio-core/src/lib/general/gr_null_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,14 +25,19 @@
#include <gr_sync_block.h>
+class gr_null_source;
+typedef boost::shared_ptr<gr_null_source> gr_null_source_sptr;
+
+gr_null_source_sptr
+gr_make_null_source (size_t sizeof_stream_item);
+
/*!
* \brief A source of zeros.
* \ingroup source_blk
*/
-
class gr_null_source : public gr_sync_block
{
- friend gr_block_sptr gr_make_null_source (size_t sizeof_stream_item);
+ friend gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item);
gr_null_source (size_t sizeof_stream_item);
@@ -43,7 +48,4 @@ class gr_null_source : public gr_sync_block
};
-gr_block_sptr
-gr_make_null_source (size_t sizeof_stream_item);
-
#endif /* INCLUDED_GR_NULL_SOURCE_H */
diff --git a/gnuradio-core/src/lib/general/gr_null_source.i b/gnuradio-core/src/lib/general/gr_null_source.i
index f9ddef86f..133161d0a 100644
--- a/gnuradio-core/src/lib/general/gr_null_source.i
+++ b/gnuradio-core/src/lib/general/gr_null_source.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,11 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-%ignore gr_null_source;
+GR_SWIG_BLOCK_MAGIC(gr,null_source)
+
+gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item);
+
class gr_null_source : public gr_sync_block {
- friend gr_block_sptr gr_make_null_source (size_t sizeof_stream_item);
+private:
gr_null_source (size_t sizeof_stream_item);
};
-%rename(null_source) gr_make_null_source;
-gr_block_sptr gr_make_null_source (size_t sizeof_stream_item);
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
index 3457370eb..279945766 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
+++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
@@ -281,7 +281,7 @@ gr_ofdm_frame_sink::set_sym_value_out(const std::vector<gr_complex> &sym_positio
d_sym_position = sym_position;
d_sym_value_out = sym_value_out;
- d_nbits = (unsigned long)ceil(log10(d_sym_value_out.size()) / log10(2.0));
+ d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0));
return true;
}
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
index 370b029cd..cc4aba0cb 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
+++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
@@ -113,7 +113,7 @@ gr_ofdm_mapper_bcv::gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constella
throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers");
}
- d_nbits = (unsigned long)ceil(log10(d_constellation.size()) / log10(2.0));
+ d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0));
}
gr_ofdm_mapper_bcv::~gr_ofdm_mapper_bcv(void)
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i
index 30c692926..3850220ba 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i
+++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i
@@ -26,7 +26,7 @@ gr_ofdm_mapper_bcv_sptr
gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation,
unsigned int msgq_limit,
unsigned int bits_per_symbol,
- unsigned int fft_length);
+ unsigned int fft_length) throw(std::exception);
class gr_ofdm_mapper_bcv : public gr_sync_block
diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc
index 3189e01c0..a24b1da8c 100644
--- a/gnuradio-core/src/lib/general/gr_throttle.cc
+++ b/gnuradio-core/src/lib/general/gr_throttle.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010 Free Software Foundation, Inc.
+ * Copyright 2005-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,92 +26,64 @@
#include <gr_throttle.h>
#include <gr_io_signature.h>
-#include <errno.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#if !defined(HAVE_NANOSLEEP) && defined(HAVE_SSLEEP)
-#include <windows.h>
-#endif
-
+#include <cstring>
+#include <boost/thread/thread.hpp>
-#ifdef HAVE_NANOSLEEP
-void
-gr_nanosleep(struct timespec *ts)
-{
- struct timespec *req = ts;
- struct timespec rem;
- int r = nanosleep(req, &rem);
- while (r < 0 && errno == EINTR){
- req = &rem;
- r = nanosleep(req, &rem);
- }
- if (r < 0)
- perror ("gr_nanosleep");
-}
-#endif
-
-gr_throttle_sptr
-gr_make_throttle(size_t itemsize, double samples_per_sec)
-{
- return gnuradio::get_initial_sptr(new gr_throttle(itemsize, samples_per_sec));
-}
+class gr_throttle_impl : public gr_throttle{
+public:
+ gr_throttle_impl(size_t itemsize):
+ gr_sync_block("throttle",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ /* NOP */
+ }
-gr_throttle::gr_throttle(size_t itemsize, double samples_per_sec)
- : gr_sync_block("throttle",
- gr_make_io_signature(1, 1, itemsize),
- gr_make_io_signature(1, 1, itemsize)),
- d_itemsize(itemsize), d_samples_per_sec(samples_per_sec),
- d_total_samples(0)
-{
-#ifdef HAVE_GETTIMEOFDAY
- gettimeofday(&d_start, 0);
-#endif
-}
+ void set_sample_rate(double rate){
+ //changing the sample rate performs a reset of state params
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
+ d_samps_per_us = rate/1e6;
+ }
-gr_throttle::~gr_throttle()
-{
-}
+ int work (
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ //calculate the expected number of samples to have passed through
+ boost::system_time now = boost::get_system_time();
+ boost::int64_t ticks = (now - d_start).ticks();
+ uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
-int
-gr_throttle::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const char *in = (const char *) input_items[0];
- char *out = (char *) output_items[0];
+ //if the expected samples was less, we need to throttle back
+ if (d_total_samples > expected_samps){
+ boost::this_thread::sleep(boost::posix_time::microseconds(
+ long((d_total_samples - expected_samps)/d_samps_per_us)
+ ));
+ }
-#if defined(HAVE_GETTIMEOFDAY)
- //
- // If our average sample rate exceeds our target sample rate,
- // delay long enough to reduce to our target rate.
- //
- struct timeval now;
- gettimeofday(&now, 0);
- long t_usec = now.tv_usec - d_start.tv_usec;
- long t_sec = now.tv_sec - d_start.tv_sec;
- double t = (double)t_sec + (double)t_usec * 1e-6;
- if (t < 1e-6) // avoid unlikely divide by zero
- t = 1e-6;
+ //copy all samples output[i] <= input[i]
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+ std::memcpy(out, in, noutput_items * d_itemsize);
+ d_total_samples += noutput_items;
+ return noutput_items;
+ }
- double actual_samples_per_sec = d_total_samples / t;
- if (actual_samples_per_sec > d_samples_per_sec){ // need to delay
- double delay = d_total_samples / d_samples_per_sec - t;
-#ifdef HAVE_NANOSLEEP
- struct timespec ts;
- ts.tv_sec = (time_t)floor(delay);
- ts.tv_nsec = (long)((delay - floor(delay)) * 1e9);
- gr_nanosleep(&ts);
-#elif HAVE_SSLEEP
- Sleep( (DWORD)(delay*1000) );
-#endif
- }
-#endif
+private:
+ boost::system_time d_start;
+ size_t d_itemsize;
+ uint64_t d_total_samples;
+ double d_samps_per_tick, d_samps_per_us;
+};
- memcpy(out, in, noutput_items * d_itemsize);
- d_total_samples += noutput_items;
- return noutput_items;
+gr_throttle::sptr
+gr_make_throttle(size_t itemsize, double samples_per_sec)
+{
+ gr_throttle::sptr throttle(new gr_throttle_impl(itemsize));
+ throttle->set_sample_rate(samples_per_sec);
+ return throttle;
}
diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h
index a1c9773c9..a82821f77 100644
--- a/gnuradio-core/src/lib/general/gr_throttle.h
+++ b/gnuradio-core/src/lib/general/gr_throttle.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,15 +23,6 @@
#define INCLUDED_GR_THROTTLE_H
#include <gr_sync_block.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-class gr_throttle;
-typedef boost::shared_ptr<gr_throttle> gr_throttle_sptr;
-
-
-gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
/*!
* \brief throttle flow of samples such that the average rate does not exceed samples_per_sec.
@@ -44,25 +35,15 @@ gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
* controlling the rate of samples. That should be controlled by a
* source or sink tied to sample clock. E.g., a USRP or audio card.
*/
-class gr_throttle : public gr_sync_block
+class gr_throttle : virtual public gr_sync_block
{
- friend gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
- size_t d_itemsize;
- double d_samples_per_sec;
- double d_total_samples;
-#ifdef HAVE_SYS_TIME_H
- struct timeval d_start;
-#endif
-
- gr_throttle(size_t itemsize, double samples_per_sec);
-
public:
- ~gr_throttle();
+ typedef boost::shared_ptr<gr_throttle> sptr;
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
+ //! Sets the sample rate in samples per second
+ virtual void set_sample_rate(double rate) = 0;
};
-
+
+gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i
index 21f7703ef..0b1ec165f 100644
--- a/gnuradio-core/src/lib/general/gr_throttle.i
+++ b/gnuradio-core/src/lib/general/gr_throttle.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,11 +20,10 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,throttle);
+%{
+#include <gr_throttle.h>
+%}
-gr_throttle_sptr gr_make_throttle (size_t itemsize, double samples_per_sec);
+GR_SWIG_BLOCK_MAGIC(gr,throttle);
-class gr_throttle : public gr_sync_block
-{
- gr_throttle (size_t itemsize, double samples_per_sec);
-};
+%include <gr_throttle.h>
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
index 5f9a8f134..2e9aa406b 100644
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
+++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
@@ -22,7 +22,7 @@
GR_SWIG_BLOCK_MAGIC(gr,unpack_k_bits_bb)
-gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k);
+gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception);
class gr_unpack_k_bits_bb : public gr_sync_interpolator
{
diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc
index e535f28c7..f20b15ca0 100644
--- a/gnuradio-core/src/lib/general/gri_fft.cc
+++ b/gnuradio-core/src/lib/general/gri_fft.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2008 Free Software Foundation, Inc.
+ * Copyright 2003,2008,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,6 +21,7 @@
*/
#include <gri_fft.h>
+#include <gr_sys_paths.h>
#include <fftw3.h>
#include <gr_complex.h>
#include <stdlib.h>
@@ -29,6 +30,9 @@
#include <cassert>
#include <stdexcept>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
boost::mutex &
gri_fft_planner::mutex()
@@ -38,26 +42,18 @@ gri_fft_planner::mutex()
return s_planning_mutex;
}
-static char *
+static const char *
wisdom_filename ()
{
- static const char *filename = ".gr_fftw_wisdom";
-
- char *home = getenv ("HOME");
- if (home){
- char *p = new char[strlen (home) + strlen (filename) + 2];
- strcpy (p, home);
- strcat (p, "/");
- strcat (p, filename);
- return p;
- }
- return 0;
+ static fs::path path;
+ path = fs::path(gr_appdata_path()) / ".gr_fftw_wisdom";
+ return path.string().c_str();
}
static void
gri_fftw_import_wisdom ()
{
- char *filename = wisdom_filename ();
+ const char *filename = wisdom_filename ();
FILE *fp = fopen (filename, "r");
if (fp != 0){
int r = fftwf_import_wisdom_from_file (fp);
@@ -66,13 +62,12 @@ gri_fftw_import_wisdom ()
fprintf (stderr, "gri_fftw: can't import wisdom from %s\n", filename);
}
}
- delete [] filename;
}
static void
gri_fftw_export_wisdom ()
{
- char *filename = wisdom_filename ();
+ const char *filename = wisdom_filename ();
FILE *fp = fopen (filename, "w");
if (fp != 0){
fftwf_export_wisdom_to_file (fp);
@@ -82,7 +77,6 @@ gri_fftw_export_wisdom ()
fprintf (stderr, "gri_fftw: ");
perror (filename);
}
- delete [] filename;
}
// ----------------------------------------------------------------
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
index 9885b3852..113006a22 100644
--- a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
@@ -53,7 +53,7 @@ qa_gr_fxpt_vco::t0 ()
float input[SIN_COS_BLOCK_SIZE];
for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
- input[i] = sin(i);
+ input[i] = sin(double(i));
}
for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
@@ -85,7 +85,7 @@ qa_gr_fxpt_vco::t1 ()
double max_error = 0;
for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
- input[i] = sin(i);
+ input[i] = sin(double(i));
}
ref_vco.cos (ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL);
diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am
index 4978ad1c5..5fbb6f52c 100644
--- a/gnuradio-core/src/lib/gengen/Makefile.am
+++ b/gnuradio-core/src/lib/gengen/Makefile.am
@@ -115,7 +115,7 @@ core_generator = \
gr_moving_average_XX.i.t
# Source built by Python into $(builddir)
-BUILT_SOURCES = \
+BUILT_SOURCES += \
$(GENERATED_H) \
$(GENERATED_I) \
$(GENERATED_CC) \
@@ -123,7 +123,7 @@ BUILT_SOURCES = \
# ----------------------------------------------------------------
-EXTRA_DIST = \
+EXTRA_DIST += \
$(core_generator)
libgengen_la_SOURCES = \
@@ -135,13 +135,11 @@ grinclude_HEADERS = \
gr_noise_type.h \
gr_sig_source_waveform.h
-if PYTHON
swiginclude_HEADERS = \
$(GENERATED_I) \
gr_endianness.i \
gengen.i \
gengen_generated.i
-endif
# Do creation and inclusion of other Makefiles last
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t
index 2a0a3ba3f..f49be062e 100755
--- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t
@@ -30,12 +30,12 @@
#include <gr_io_signature.h>
@SPTR_NAME@
-gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k)
+gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k)
{
return gnuradio::get_initial_sptr (new @NAME@ (k));
}
-@NAME@::@NAME@ (const std::vector<@I_TYPE@> k)
+@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k)
: gr_sync_block ("@BASE_NAME@",
gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()),
gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size()))
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t
index 33b6fc396..574fc686c 100755
--- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,7 +30,7 @@
class @NAME@;
typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k);
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
/*!
* \brief output vector = input vector + constant vector
@@ -38,14 +38,14 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
*/
class @NAME@ : public gr_sync_block
{
- friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k);
+ friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
std::vector<@I_TYPE@> d_k; // the constant
- @NAME@ (const std::vector<@I_TYPE@> k);
+ @NAME@ (const std::vector<@I_TYPE@> &k);
public:
const std::vector<@I_TYPE@> k () const { return d_k; }
- void set_k (const std::vector<@I_TYPE@> k) { d_k = k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
int work (int noutput_items,
gr_vector_const_void_star &input_items,
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t
index a2e7dd70b..ad1643a7e 100755
--- a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,14 +24,14 @@
GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
-@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k);
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
class @NAME@ : public gr_sync_block
{
private:
- @NAME@ (const std::vector<@I_TYPE@> k);
+ @NAME@ (const std::vector<@I_TYPE@> &k);
public:
std::vector<@I_TYPE@> k () const { return d_k; }
- void set_k (const std::vector<@I_TYPE@> k) { d_k = k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
};
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t
index 8286453f1..5725c1c46 100755
--- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t
@@ -30,12 +30,12 @@
#include <gr_io_signature.h>
@SPTR_NAME@
-gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k)
+gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k)
{
return gnuradio::get_initial_sptr (new @NAME@ (k));
}
-@NAME@::@NAME@ (const std::vector<@I_TYPE@> k)
+@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k)
: gr_sync_block ("@BASE_NAME@",
gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()),
gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size()))
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t
index 22334505a..81e781895 100755
--- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,7 +30,7 @@
class @NAME@;
typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k);
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
/*!
* \brief output vector = input vector * constant vector (element-wise)
@@ -38,14 +38,14 @@ typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
*/
class @NAME@ : public gr_sync_block
{
- friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k);
+ friend @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
std::vector<@I_TYPE@> d_k; // the constant
- @NAME@ (const std::vector<@I_TYPE@> k);
+ @NAME@ (const std::vector<@I_TYPE@> &k);
public:
const std::vector<@I_TYPE@> k () const { return d_k; }
- void set_k (const std::vector<@I_TYPE@> k) { d_k = k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
int work (int noutput_items,
gr_vector_const_void_star &input_items,
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t
index a2e7dd70b..ad1643a7e 100755
--- a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,14 +24,14 @@
GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
-@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> k);
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
class @NAME@ : public gr_sync_block
{
private:
- @NAME@ (const std::vector<@I_TYPE@> k);
+ @NAME@ (const std::vector<@I_TYPE@> &k);
public:
std::vector<@I_TYPE@> k () const { return d_k; }
- void set_k (const std::vector<@I_TYPE@> k) { d_k = k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
};
diff --git a/gnuradio-core/src/lib/hier/Makefile.am b/gnuradio-core/src/lib/hier/Makefile.am
index e2e7fe886..b525d19b4 100644
--- a/gnuradio-core/src/lib/hier/Makefile.am
+++ b/gnuradio-core/src/lib/hier/Makefile.am
@@ -32,8 +32,6 @@ libhier_la_SOURCES = \
grinclude_HEADERS = \
gr_channel_model.h
-if PYTHON
swiginclude_HEADERS = \
hier.i \
gr_channel_model.i
-endif
diff --git a/gnuradio-core/src/lib/io/Makefile.am b/gnuradio-core/src/lib/io/Makefile.am
index c52554645..442d5e3a9 100644
--- a/gnuradio-core/src/lib/io/Makefile.am
+++ b/gnuradio-core/src/lib/io/Makefile.am
@@ -56,7 +56,8 @@ libio_la_SOURCES = \
gr_udp_source.cc \
gr_wavfile_sink.cc \
gr_wavfile_source.cc \
- gri_wavfile.cc
+ gri_wavfile.cc \
+ gr_tagged_file_sink.cc
grinclude_HEADERS = \
gr_file_sink.h \
@@ -89,9 +90,9 @@ grinclude_HEADERS = \
gr_udp_source.h \
gr_wavfile_source.h \
gr_wavfile_sink.h \
- gri_wavfile.h
+ gri_wavfile.h \
+ gr_tagged_file_sink.h
-if PYTHON
swiginclude_HEADERS = \
io.i \
gr_file_sink.i \
@@ -111,5 +112,5 @@ swiginclude_HEADERS = \
gr_udp_sink.i \
gr_udp_source.i \
gr_wavfile_source.i \
- gr_wavfile_sink.i
-endif
+ gr_wavfile_sink.i \
+ gr_tagged_file_sink.i
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
index a37189c24..fc0c12ce6 100644
--- a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
+++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2009,2010 Free Software Foundation, Inc.
+ * Copyright 2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,7 @@
#include <gr_histo_sink_f.h>
#include <gr_io_signature.h>
+#include <boost/math/special_functions/round.hpp>
static float get_clean_num(float num){
if (num == 0) return 0;
@@ -101,7 +102,7 @@ gr_histo_sink_f::send_frame(void){
int index;
float bin_width = (maximum - minimum)/(d_num_bins-1);
for (unsigned int i = 0; i < d_sample_count; i++){
- index = round((d_samps[i] - minimum)/bin_width);
+ index = boost::math::iround((d_samps[i] - minimum)/bin_width);
/* ensure the index range in case a small floating point error is involed */
if (index < 0) index = 0;
if (index >= (int)d_num_bins) index = d_num_bins-1;
diff --git a/gnuradio-core/src/lib/io/gr_message_source.i b/gnuradio-core/src/lib/io/gr_message_source.i
index 8a9c762d0..e4e2016d0 100644
--- a/gnuradio-core/src/lib/io/gr_message_source.i
+++ b/gnuradio-core/src/lib/io/gr_message_source.i
@@ -22,6 +22,14 @@
GR_SWIG_BLOCK_MAGIC(gr,message_source);
+#ifdef SWIGGUILE
+// Rename these. Without this, the primitive bindings are OK, but the
+// goops bindings try to create a bogus generic-function...
+// See core.scm for the second part of the workaround.
+%rename(message_source_limit_ctor) gr_make_message_source(size_t itemsize, int msgq_limit);
+%rename(message_source_msgq_ctor) gr_make_message_source(size_t itemsize, gr_msg_queue_sptr msgq);
+#endif
+
gr_message_source_sptr gr_make_message_source (size_t itemsize, int msgq_limit=0);
gr_message_source_sptr gr_make_message_source (size_t itemsize, gr_msg_queue_sptr msgq);
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
new file mode 100644
index 000000000..154611c32
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -0,0 +1,211 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_tagged_file_sink.h>
+#include <gr_io_signature.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <iostream>
+#include <gr_tag_info.h>
+
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize, double samp_rate)
+ : gr_sync_block ("tagged_file_sink",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (0, 0, 0)),
+ d_itemsize (itemsize), d_n(0), d_sample_rate(samp_rate)
+{
+ d_state = NOT_IN_BURST;
+ d_last_N = 0;
+ d_timeval = 0;
+}
+
+gr_tagged_file_sink_sptr
+gr_make_tagged_file_sink (size_t itemsize, double samp_rate)
+{
+ return gnuradio::get_initial_sptr(new gr_tagged_file_sink (itemsize, samp_rate));
+}
+
+gr_tagged_file_sink::~gr_tagged_file_sink ()
+{
+}
+
+int
+gr_tagged_file_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *inbuf = (char *) input_items[0];
+
+ uint64_t start_N = nitems_read(0);
+ uint64_t end_N = start_N + (uint64_t)(noutput_items);
+ pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst");
+ //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::key_time
+
+ std::vector<pmt::pmt_t> all_tags;
+ get_tags_in_range(all_tags, 0, start_N, end_N);
+
+ std::sort(all_tags.begin(), all_tags.end(), gr_tags::nitems_compare);
+
+ std::vector<pmt::pmt_t>::iterator vitr = all_tags.begin();
+
+ int idx = 0, idx_stop = 0;
+ while(idx < noutput_items) {
+ if(d_state == NOT_IN_BURST) {
+ while(vitr != all_tags.end()) {
+ if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) &&
+ pmt::pmt_is_true(gr_tags::get_value(*vitr))) {
+
+ uint64_t N = gr_tags::get_nitems(*vitr);
+ idx = (int)(N - start_N);
+
+ //std::cout << std::endl << "Found start of burst: "
+ // << idx << ", " << N << std::endl;
+
+ // Find time burst occurred by getting latest time tag and extrapolating
+ // to new time based on sample rate of this block.
+ std::vector<pmt::pmt_t> time_tags;
+ //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time);
+ get_tags_in_range(time_tags, 0, d_last_N, N,
+ pmt::pmt_string_to_symbol("time"));
+ if(time_tags.size() > 0) {
+ pmt::pmt_t tag = time_tags[time_tags.size()-1];
+
+ uint64_t time_nitems = gr_tags::get_nitems(tag);
+
+ // Get time based on last time tag from USRP
+ pmt::pmt_t time = gr_tags::get_value(tag);
+ int tsecs = pmt::pmt_to_long(pmt::pmt_tuple_ref(time, 0));
+ double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1));
+
+ // Get new time from last time tag + difference in time to when
+ // burst tag occured based on the sample rate
+ double delta = (double)(N - time_nitems) / d_sample_rate;
+ d_timeval = (double)tsecs + tfrac + delta;
+
+ //std::cout.setf(std::ios::fixed, std::ios::floatfield);
+ //std::cout.precision(8);
+ //std::cout << "Time found: " << (double)tsecs + tfrac << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ //std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl;
+ }
+ else {
+ // if no time tag, use last seen tag and update time based on
+ // sample rate of the block
+ d_timeval += (double)(N - d_last_N) / d_sample_rate;
+ //std::cout << "Time not found" << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ }
+ d_last_N = N;
+
+ std::stringstream filename;
+ filename.setf(std::ios::fixed, std::ios::floatfield);
+ filename.precision(8);
+ filename << "file" << d_n << "_" << d_timeval << ".dat";
+ d_n++;
+
+ int fd;
+ if ((fd = ::open (filename.str().c_str(),
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror (filename.str().c_str());
+ return -1;
+ }
+
+ // FIXME:
+ //if ((d_handle = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL){
+ if ((d_handle = fdopen (fd, "wb")) == NULL){
+ perror (filename.str().c_str());
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ //std::cout << "Created new file: " << filename.str() << std::endl;
+
+ d_state = IN_BURST;
+ break;
+ }
+
+ vitr++;
+ }
+ if(d_state == NOT_IN_BURST)
+ return noutput_items;
+ }
+ else { // In burst
+ while(vitr != all_tags.end()) {
+ if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) &&
+ pmt::pmt_is_false(gr_tags::get_value(*vitr))) {
+ uint64_t N = gr_tags::get_nitems(*vitr);
+ idx_stop = (int)N - start_N;
+
+ //std::cout << "Found end of burst: "
+ // << idx_stop << ", " << N << std::endl;
+
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
+ idx = idx_stop;
+ d_state = NOT_IN_BURST;
+ vitr++;
+ fclose(d_handle);
+ break;
+ }
+ else {
+ vitr++;
+ }
+ }
+ if(d_state == IN_BURST) {
+ int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
+ idx = noutput_items;
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
new file mode 100644
index 000000000..2e0a5c63a
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifndef INCLUDED_GR_TAGGED_FILE_SINK_H
+#define INCLUDED_GR_TAGGED_FILE_SINK_H
+
+#include <gr_sync_block.h>
+#include <cstdio> // for FILE
+
+class gr_tagged_file_sink;
+typedef boost::shared_ptr<gr_tagged_file_sink> gr_tagged_file_sink_sptr;
+
+gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize,
+ double samp_rate);
+
+/*!
+ * \brief Write stream to file descriptor.
+ * \ingroup sink_blk
+ */
+
+class gr_tagged_file_sink : public gr_sync_block
+{
+ friend gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize,
+ double samp_rate);
+
+ private:
+ enum {
+ NOT_IN_BURST = 0,
+ IN_BURST
+ };
+
+ size_t d_itemsize;
+ int d_state;
+ FILE *d_handle;
+ int d_n;
+ double d_sample_rate;
+ uint64_t d_last_N;
+ double d_timeval;
+
+ protected:
+ gr_tagged_file_sink (size_t itemsize, double samp_rate);
+
+ public:
+ ~gr_tagged_file_sink ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.i b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i
new file mode 100644
index 000000000..1408adfc1
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,tagged_file_sink)
+
+gr_tagged_file_sink_sptr
+gr_make_tagged_file_sink (size_t itemsize, double samp_rate);
+
+class gr_tagged_file_sink : public gr_sync_block
+{
+ protected:
+ gr_tagged_file_sink (size_t itemsize, double samp_rate);
+
+ public:
+ ~gr_tagged_file_sink ();
+};
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
index b60a6e3ab..a96aadc72 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -33,6 +33,7 @@
#include <cmath>
#include <fcntl.h>
#include <gruel/thread.h>
+#include <boost/math/special_functions/round.hpp>
// win32 (mingw/msvc) specific
#ifdef HAVE_IO_H
@@ -224,7 +225,7 @@ gr_wavfile_sink::convert_to_short(float sample)
sample = d_min_sample_val;
}
- return (short int) roundf(sample);
+ return (short int) boost::math::iround(sample);
}
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.cc b/gnuradio-core/src/lib/io/gr_wavfile_source.cc
index d00dd3028..136e52611 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_source.cc
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.cc
@@ -27,7 +27,6 @@
#include <gr_wavfile_source.h>
#include <gr_io_signature.h>
#include <gri_wavfile.h>
-#include <cstdio>
#include <sys/types.h>
#include <fcntl.h>
#include <stdexcept>
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.h b/gnuradio-core/src/lib/io/gr_wavfile_source.h
index 0c663f0a0..e434a6b4c 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_source.h
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.h
@@ -24,6 +24,7 @@
#define INCLUDED_GR_WAVFILE_SOURCE_H
#include <gr_sync_block.h>
+#include <cstdio> // for FILE
class gr_wavfile_source;
typedef boost::shared_ptr<gr_wavfile_source> gr_wavfile_source_sptr;
diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i
index 3538942ca..365577cd4 100644
--- a/gnuradio-core/src/lib/io/io.i
+++ b/gnuradio-core/src/lib/io/io.i
@@ -43,7 +43,7 @@
#include <gr_udp_source.h>
#include <gr_wavfile_sink.h>
#include <gr_wavfile_source.h>
-
+#include <gr_tagged_file_sink.h>
%}
%include "gr_file_sink_base.i"
@@ -64,4 +64,5 @@
%include "gr_udp_source.i"
%include "gr_wavfile_sink.i"
%include "gr_wavfile_source.i"
+%include "gr_tagged_file_sink.i"
diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am
index 238370910..1cc6014a1 100644
--- a/gnuradio-core/src/lib/missing/Makefile.am
+++ b/gnuradio-core/src/lib/missing/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2003,2004,2008,2009 Free Software Foundation, Inc.
+# Copyright 2003,2004,2008,2009,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,9 +21,9 @@
include $(top_srcdir)/Makefile.common
-AM_CPPFLAGS = $(GNURADIO_INCLUDES) $(WITH_INCLUDES)
+AM_CPPFLAGS = $(GRUEL_INCLUDES) $(GNURADIO_INCLUDES) $(WITH_INCLUDES)
-EXTRA_DIST = \
+EXTRA_DIST += \
getopt.h \
getopt.c \
gettimeofday.c \
diff --git a/gnuradio-core/src/lib/missing/bug_work_around_8.cc b/gnuradio-core/src/lib/missing/bug_work_around_8.cc
index b2cbdb3d9..5e431a210 100644
--- a/gnuradio-core/src/lib/missing/bug_work_around_8.cc
+++ b/gnuradio-core/src/lib/missing/bug_work_around_8.cc
@@ -1,2 +1,3 @@
// if libmisc has no sources, it doesn't get built correctly
-static int gr_bug_work_around_8 __attribute__((unused));
+#include <gruel/attributes.h>
+static int gr_bug_work_around_8 __GR_ATTR_UNUSED;
diff --git a/gnuradio-core/src/lib/reed-solomon/Makefile.am b/gnuradio-core/src/lib/reed-solomon/Makefile.am
index b7bd939b0..5548f4280 100644
--- a/gnuradio-core/src/lib/reed-solomon/Makefile.am
+++ b/gnuradio-core/src/lib/reed-solomon/Makefile.am
@@ -29,7 +29,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
TESTS = rstest
-EXTRA_DIST = \
+EXTRA_DIST += \
README.karn
noinst_LTLIBRARIES = librs.la
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index f67e8843d..eca92e526 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2003,2004,2007,2008,2009,2010 Free Software Foundation, Inc.
+# Copyright 2003,2004,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -58,7 +58,7 @@ libruntime_la_SOURCES = \
gr_sync_block.cc \
gr_sync_decimator.cc \
gr_sync_interpolator.cc \
- gr_tmp_path.cc \
+ gr_sys_paths.cc \
gr_top_block.cc \
gr_top_block_impl.cc \
gr_tpb_detail.cc \
@@ -68,7 +68,8 @@ libruntime_la_SOURCES = \
gr_vmcircbuf_mmap_tmpfile.cc \
gr_vmcircbuf_createfilemapping.cc \
gr_vmcircbuf_sysv_shm.cc \
- gr_select_handler.cc
+ gr_select_handler.cc \
+ gr_tag_info.cc
libruntime_qa_la_SOURCES = \
qa_gr_block.cc \
@@ -79,6 +80,8 @@ libruntime_qa_la_SOURCES = \
qa_gr_top_block.cc \
qa_gr_io_signature.cc \
qa_gr_vmcircbuf.cc \
+ qa_block_tags.cc \
+ qa_set_msg_handler.cc \
qa_runtime.cc
grinclude_HEADERS = \
@@ -118,10 +121,11 @@ grinclude_HEADERS = \
gr_tpb_detail.h \
gr_tpb_thread_body.h \
gr_timer.h \
- gr_tmp_path.h \
+ gr_sys_paths.h \
gr_types.h \
gr_unittests.h \
- gr_vmcircbuf.h
+ gr_vmcircbuf.h \
+ gr_tag_info.h
noinst_HEADERS = \
gr_vmcircbuf_mmap_shm_open.h \
@@ -136,9 +140,10 @@ noinst_HEADERS = \
qa_gr_io_signature.h \
qa_gr_top_block.h \
qa_gr_vmcircbuf.h \
+ qa_block_tags.h \
+ qa_set_msg_handler.h \
qa_runtime.h
-if PYTHON
swiginclude_HEADERS = \
gr_basic_block.i \
gr_block.i \
@@ -158,4 +163,3 @@ swiginclude_HEADERS = \
gr_sync_interpolator.i \
gr_top_block.i \
runtime.i
-endif
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.cc b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
index 2fa1066cb..0e0dad16b 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.cc
@@ -56,7 +56,7 @@ gr_basic_block::~gr_basic_block()
}
gr_basic_block_sptr
-gr_basic_block::basic_block()
+gr_basic_block::to_basic_block()
{
return shared_from_this();
}
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h
index b8797fdc6..3b0cd51dd 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2006,2008,2009,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,7 @@
#include <gr_runtime_types.h>
#include <gr_sptr_magic.h>
#include <boost/enable_shared_from_this.hpp>
+#include <boost/function.hpp>
#include <gr_msg_accepter.h>
#include <string>
@@ -42,9 +43,27 @@
class gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block>
{
+ typedef boost::function<void(pmt::pmt_t)> msg_handler_t;
+
+private:
+ /*
+ * This function is called by the runtime system to dispatch messages.
+ *
+ * The thread-safety guarantees mentioned in set_msg_handler are implemented
+ * by the callers of this method.
+ */
+ void dispatch_msg(pmt::pmt_t msg)
+ {
+ if (d_msg_handler) // Is there a handler?
+ d_msg_handler(msg); // Yes, invoke it.
+ };
+
+ msg_handler_t d_msg_handler;
+
protected:
friend class gr_flowgraph;
friend class gr_flat_flowgraph; // TODO: will be redundant
+ friend class gr_tpb_thread_body;
enum vcolor { WHITE, GREY, BLACK };
@@ -54,6 +73,8 @@ protected:
long d_unique_id;
vcolor d_color;
+ gr_basic_block(void){} //allows pure virtual interface sub-classes
+
//! Protected constructor prevents instantiation by non-derived classes
gr_basic_block(const std::string &name,
gr_io_signature_sptr input_signature,
@@ -81,7 +102,7 @@ public:
std::string name() const { return d_name; }
gr_io_signature_sptr input_signature() const { return d_input_signature; }
gr_io_signature_sptr output_signature() const { return d_output_signature; }
- gr_basic_block_sptr basic_block(); // Needed for Python type coercion
+ gr_basic_block_sptr to_basic_block(); // Needed for Python/Guile type coercion
/*!
* \brief Confirm that ninputs and noutputs is an acceptable combination.
@@ -99,15 +120,34 @@ public:
virtual bool check_topology(int ninputs, int noutputs) { return true; }
/*!
- * \brief Block message handler.
- *
- * \param msg Arbitrary message encapsulated as pmt::pmt_t
+ * \brief Set the callback that is fired when messages are available.
*
- * This function is called by the runtime system whenever there are
- * messages in its queue. Blocks should override this to receive
- * messages; the default behavior is to drop them on the floor.
+ * \p msg_handler can be any kind of function pointer or function object
+ * that has the signature:
+ * <pre>
+ * void msg_handler(pmt::pmt msg);
+ * </pre>
+ *
+ * (You may want to use boost::bind to massage your callable into the
+ * correct form. See gr_nop.{h,cc} for an example that sets up a class
+ * method as the callback.)
+ *
+ * Blocks that desire to handle messages must call this method in their
+ * constructors to register the handler that will be invoked when messages
+ * are available.
+ *
+ * If the block inherits from gr_block, the runtime system will ensure that
+ * msg_handler is called in a thread-safe manner, such that work and
+ * msg_handler will never be called concurrently. This allows msg_handler
+ * to update state variables without having to worry about thread-safety
+ * issues with work, general_work or another invocation of msg_handler.
+ *
+ * If the block inherits from gr_hier_block2, the runtime system will
+ * ensure that no reentrant calls are made to msg_handler.
*/
- virtual void handle_msg(pmt::pmt_t msg) { };
+ template <typename T> void set_msg_handler(T msg_handler){
+ d_msg_handler = msg_handler_t(msg_handler);
+ }
};
inline bool operator<(gr_basic_block_sptr lhs, gr_basic_block_sptr rhs)
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.i b/gnuradio-core/src/lib/runtime/gr_basic_block.i
index 60e08aac3..03d4725d5 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -40,13 +40,15 @@ public:
gr_io_signature_sptr input_signature() const;
gr_io_signature_sptr output_signature() const;
long unique_id() const;
- gr_basic_block_sptr basic_block();
+ gr_basic_block_sptr to_basic_block();
bool check_topology (int ninputs, int noutputs);
};
%rename(block_ncurrently_allocated) gr_basic_block_ncurrently_allocated;
long gr_basic_block_ncurrently_allocated();
+#ifdef SWIGPYTHON
%pythoncode %{
gr_basic_block_sptr.__repr__ = lambda self: "<gr_basic_block %s (%d)>" % (self.name(), self.unique_id ())
%}
+#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 8915f3360..81a55af9d 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -36,7 +36,8 @@ gr_block::gr_block (const std::string &name,
d_output_multiple (1),
d_relative_rate (1.0),
d_history(1),
- d_fixed_rate(false)
+ d_fixed_rate(false),
+ d_tag_propagation_policy(TPP_ALL_TO_ALL)
{
}
@@ -117,6 +118,69 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput)
throw std::runtime_error("Unimplemented");
}
+uint64_t
+gr_block::nitems_read(unsigned int which_input)
+{
+ if(d_detail) {
+ return d_detail->nitems_read(which_input);
+ }
+ else {
+ //throw std::runtime_error("No block_detail associated with block yet");
+ return 0;
+ }
+}
+
+uint64_t
+gr_block::nitems_written(unsigned int which_output)
+{
+ if(d_detail) {
+ return d_detail->nitems_written(which_output);
+ }
+ else {
+ //throw std::runtime_error("No block_detail associated with block yet");
+ return 0;
+ }
+}
+
+void
+gr_block::add_item_tag(unsigned int which_output,
+ uint64_t offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid)
+{
+ d_detail->add_item_tag(which_output, offset, key, value, srcid);
+}
+
+void
+gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_output,
+ uint64_t start, uint64_t end)
+{
+ d_detail->get_tags_in_range(v, which_output, start, end);
+}
+
+void
+gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_output,
+ uint64_t start, uint64_t end,
+ const pmt::pmt_t &key)
+{
+ d_detail->get_tags_in_range(v, which_output, start, end, key);
+}
+
+gr_block::tag_propagation_policy_t
+gr_block::tag_propagation_policy()
+{
+ return d_tag_propagation_policy;
+}
+
+void
+gr_block::set_tag_propagation_policy(tag_propagation_policy_t p)
+{
+ d_tag_propagation_policy = p;
+}
+
std::ostream&
operator << (std::ostream& os, const gr_block *m)
{
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index b6f724dde..fc22f9ea8 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2007,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2007,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -63,6 +63,12 @@ class gr_block : public gr_basic_block {
WORK_DONE = -1
};
+ enum tag_propagation_policy_t {
+ TPP_DONT = 0,
+ TPP_ALL_TO_ALL = 1,
+ TPP_ONE_TO_ONE = 2
+ };
+
virtual ~gr_block ();
/*!
@@ -198,6 +204,26 @@ class gr_block : public gr_basic_block {
*/
virtual int fixed_rate_noutput_to_ninput(int noutput);
+ /*!
+ * \brief Return the number of items read on input stream which_input
+ */
+ uint64_t nitems_read(unsigned int which_input);
+
+ /*!
+ * \brief Return the number of items written on output stream which_output
+ */
+ uint64_t nitems_written(unsigned int which_output);
+
+ /*!
+ * \brief Asks for the policy used by the scheduler to moved tags downstream.
+ */
+ tag_propagation_policy_t tag_propagation_policy();
+
+ /*!
+ * \brief Set the policy by the scheduler to determine how tags are moved downstream.
+ */
+ void set_tag_propagation_policy(tag_propagation_policy_t p);
+
// ----------------------------------------------------------------------------
private:
@@ -207,15 +233,72 @@ class gr_block : public gr_basic_block {
gr_block_detail_sptr d_detail; // implementation details
unsigned d_history;
bool d_fixed_rate;
+ tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream
protected:
-
+ gr_block (void){} //allows pure virtual interface sub-classes
gr_block (const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature);
void set_fixed_rate(bool fixed_rate){ d_fixed_rate = fixed_rate; }
+
+ /*!
+ * \brief Adds a new tag onto the given output buffer.
+ *
+ * \param which_output an integer of which output stream to attach the tag
+ * \param abs_offset a uint64 number of the absolute item number
+ * assicated with the tag. Can get from nitems_written.
+ * \param key the tag key as a PMT symbol
+ * \param value any PMT holding any value for the given key
+ * \param srcid optional source ID specifier; defaults to PMT_F
+ */
+ void add_item_tag(unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid=pmt::PMT_F);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range.
+ *
+ * Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range
+ * with a given key.
+ *
+ * Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ * \param key a PMT symbol key to filter only tags of this key
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key);
+
// These are really only for internal use, but leaving them public avoids
// having to work up an ever-varying list of friends
diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i
index c2e2aa4b8..bb0c5f221 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_block.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -49,12 +49,10 @@ class gr_block : public gr_basic_block {
bool start();
bool stop();
+ uint64_t nitems_read(unsigned int which_input);
+ uint64_t nitems_written(unsigned int which_output);
+
// internal use
gr_block_detail_sptr detail () const { return d_detail; }
void set_detail (gr_block_detail_sptr detail) { d_detail = detail; }
};
-
-%pythoncode %{
-gr_block_sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
-gr_block_sptr.block = lambda self: self
-%}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
index 38d4a13ca..a360240c0 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,8 @@
#include <gr_block_detail.h>
#include <gr_buffer.h>
+using namespace pmt;
+
static long s_ncurrently_allocated = 0;
long
@@ -88,16 +90,20 @@ gr_block_detail::set_done (bool done)
void
gr_block_detail::consume (int which_input, int how_many_items)
{
- if (how_many_items > 0)
+ if (how_many_items > 0) {
input (which_input)->update_read_pointer (how_many_items);
+ }
}
+
void
gr_block_detail::consume_each (int how_many_items)
{
- if (how_many_items > 0)
- for (int i = 0; i < ninputs (); i++)
+ if (how_many_items > 0) {
+ for (int i = 0; i < ninputs (); i++) {
d_input[i]->update_read_pointer (how_many_items);
+ }
+ }
}
void
@@ -112,16 +118,88 @@ gr_block_detail::produce (int which_output, int how_many_items)
void
gr_block_detail::produce_each (int how_many_items)
{
- if (how_many_items > 0){
- for (int i = 0; i < noutputs (); i++)
+ if (how_many_items > 0) {
+ for (int i = 0; i < noutputs (); i++) {
d_output[i]->update_write_pointer (how_many_items);
+ }
d_produce_or |= how_many_items;
}
}
void
-gr_block_detail::_post(pmt::pmt_t msg)
+gr_block_detail::_post(pmt_t msg)
{
d_tpb.insert_tail(msg);
}
+
+uint64_t
+gr_block_detail::nitems_read(unsigned int which_input)
+{
+ if(which_input >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::n_input_items");
+ return d_input[which_input]->nitems_read();
+}
+
+uint64_t
+gr_block_detail::nitems_written(unsigned int which_output)
+{
+ if(which_output >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::n_output_items");
+ return d_output[which_output]->nitems_written();
+}
+
+void
+gr_block_detail::add_item_tag(unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt_t &key,
+ const pmt_t &value,
+ const pmt_t &srcid)
+{
+ if(!pmt_is_symbol(key)) {
+ throw pmt_wrong_type("gr_block_detail::add_item_tag key", key);
+ }
+ else {
+ // build tag tuple
+ pmt_t nitem = pmt_from_uint64(abs_offset);
+ pmt_t tuple = pmt_make_tuple(nitem, srcid, key, value);
+
+ // Add tag to gr_buffer's deque tags
+ d_output[which_output]->add_item_tag(tuple);
+ }
+}
+
+void
+gr_block_detail::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end)
+{
+ // get from gr_buffer_reader's deque of tags
+ d_input[which_input]->get_tags_in_range(v, abs_start, abs_end);
+}
+
+void
+gr_block_detail::get_tags_in_range(std::vector<pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt_t &key)
+{
+ std::vector<pmt_t> found_items;
+
+ v.resize(0);
+
+ // get from gr_buffer_reader's deque of tags
+ d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end);
+
+ // Filter further by key name
+ pmt_t itemkey;
+ std::vector<pmt_t>::iterator itr;
+ for(itr = found_items.begin(); itr != found_items.end(); itr++) {
+ itemkey = pmt_tuple_ref(*itr, 2);
+ if(pmt_eqv(key, itemkey)) {
+ v.push_back(*itr);
+ }
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h
index c5787a5ad..d7ec3b136 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,6 +25,7 @@
#include <gr_runtime_types.h>
#include <gr_tpb_detail.h>
+#include <gr_tag_info.h>
#include <stdexcept>
/*!
@@ -88,6 +89,75 @@ class gr_block_detail {
*/
void _post(pmt::pmt_t msg);
+ // Return the number of items read on input stream which_input
+ uint64_t nitems_read(unsigned int which_input);
+
+ // Return the number of items written on output stream which_output
+ uint64_t nitems_written(unsigned int which_output);
+
+
+ /*!
+ * \brief Adds a new tag to the given output stream.
+ *
+ * This takes the input parameters and builds a PMT tuple
+ * from it. It then calls gr_buffer::add_item_tag(pmt::pmt_t t),
+ * which appends the tag onto its deque.
+ *
+ * \param which_output an integer of which output stream to attach the tag
+ * \param abs_offset a uint64 number of the absolute item number
+ * assicated with the tag. Can get from nitems_written.
+ * \param key the tag key as a PMT symbol
+ * \param value any PMT holding any value for the given key
+ * \param srcid a PMT source ID specifier
+ */
+ void add_item_tag(unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range.
+ *
+ * Pass-through function to gr_buffer_reader to get a vector of tags
+ * in given range. Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range
+ * with a given key.
+ *
+ * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a vector of
+ * tags from the buffers. This function then provides a secondary filter to
+ * the tags to extract only tags with the given 'key'.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ * \param key a PMT symbol to select only tags of this key
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key);
+
gr_tpb_detail d_tpb; // used by thread-per-block scheduler
int d_produce_or;
@@ -100,7 +170,6 @@ class gr_block_detail {
std::vector<gr_buffer_sptr> d_output;
bool d_done;
-
gr_block_detail (unsigned int ninputs, unsigned int noutputs);
friend class gr_tpb_detail;
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index 2c21a0b0f..a8d0bc1c8 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -87,7 +87,79 @@ min_available_space (gr_block_detail *d, int output_multiple)
return min_space;
}
+static bool
+propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
+ const std::vector<uint64_t> &start_nitems_read, double rrate,
+ std::vector<pmt::pmt_t> &rtags)
+{
+ // Move tags downstream
+ // if a sink, we don't need to move downstream
+ if(d->sink_p()) {
+ return true;
+ }
+ switch(policy) {
+ case gr_block::TPP_DONT:
+ return true;
+ break;
+ case gr_block::TPP_ALL_TO_ALL:
+ // every tag on every input propogates to everyone downstream
+ for(int i = 0; i < d->ninputs(); i++) {
+ d->get_tags_in_range(rtags, i, start_nitems_read[i],
+ d->nitems_read(i));
+
+ std::vector<pmt::pmt_t>::iterator t;
+ if(rrate == 1.0) {
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ for(int o = 0; o < d->noutputs(); o++)
+ d->output(o)->add_item_tag(*t);
+ }
+ }
+ else {
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
+ pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate),
+ pmt::pmt_tuple_ref(*t, 1),
+ pmt::pmt_tuple_ref(*t, 2),
+ pmt::pmt_tuple_ref(*t, 3));
+
+ for(int o = 0; o < d->noutputs(); o++)
+ d->output(o)->add_item_tag(newtup);
+ }
+ }
+ }
+ break;
+ case gr_block::TPP_ONE_TO_ONE:
+ // tags from input i only go to output i
+ // this requires d->ninputs() == d->noutputs; this is checked when this
+ // type of tag-propagation system is selected in gr_block_detail
+ if(d->ninputs() == d->noutputs()) {
+ for(int i = 0; i < d->ninputs(); i++) {
+ d->get_tags_in_range(rtags, i, start_nitems_read[i],
+ d->nitems_read(i));
+
+ std::vector<pmt::pmt_t>::iterator t;
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
+ pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate),
+ pmt::pmt_tuple_ref(*t, 1),
+ pmt::pmt_tuple_ref(*t, 2),
+ pmt::pmt_tuple_ref(*t, 3));
+ d->output(i)->add_item_tag(newtup);
+ }
+ }
+ }
+ else {
+ std::cerr << "Error: gr_block_executor: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl;
+ return false;
+ }
+
+ break;
+ default:
+ return true;
+ }
+ return true;
+}
gr_block_executor::gr_block_executor (gr_block_sptr block)
: d_block(block), d_log(0)
@@ -134,6 +206,7 @@ gr_block_executor::run_one_iteration()
d_input_items.resize (0);
d_input_done.resize(0);
d_output_items.resize (d->noutputs ());
+ d_start_nitems_read.resize(0);
// determine the minimum available output space
noutput_items = min_available_space (d, m->output_multiple ());
@@ -155,6 +228,7 @@ gr_block_executor::run_one_iteration()
d_input_items.resize (d->ninputs ());
d_input_done.resize(d->ninputs());
d_output_items.resize (0);
+ d_start_nitems_read.resize(d->ninputs());
LOG(*d_log << " sink\n");
max_items_avail = 0;
@@ -198,6 +272,7 @@ gr_block_executor::run_one_iteration()
d_input_items.resize (d->ninputs ());
d_input_done.resize(d->ninputs());
d_output_items.resize (d->noutputs ());
+ d_start_nitems_read.resize(d->ninputs());
max_items_avail = 0;
for (int i = 0; i < d->ninputs (); i++){
@@ -294,12 +369,21 @@ gr_block_executor::run_one_iteration()
for (int i = 0; i < d->noutputs (); i++)
d_output_items[i] = d->output(i)->write_pointer();
+ // determine where to start looking for new tags
+ for (int i = 0; i < d->ninputs(); i++)
+ d_start_nitems_read[i] = d->nitems_read(i);
+
// Do the actual work of the block
int n = m->general_work (noutput_items, d_ninput_items,
d_input_items, d_output_items);
LOG(*d_log << " general_work: noutput_items = " << noutput_items
<< " result = " << n << std::endl);
+ if(!propagate_tags(m->tag_propagation_policy(), d,
+ d_start_nitems_read, m->relative_rate(),
+ d_returned_tags))
+ goto were_done;
+
if (n == gr_block::WORK_DONE)
goto were_done;
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h
index 41b5ede7c..77ace5522 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h
@@ -25,6 +25,7 @@
#include <gr_runtime_types.h>
#include <fstream>
+#include <gruel/pmt.h>
//class gr_block_executor;
//typedef boost::shared_ptr<gr_block_executor> gr_block_executor_sptr;
@@ -47,6 +48,8 @@ protected:
gr_vector_const_void_star d_input_items;
std::vector<bool> d_input_done;
gr_vector_void_star d_output_items;
+ std::vector<uint64_t> d_start_nitems_read; //stores where tag counts are before work
+ std::vector<pmt::pmt_t> d_returned_tags;
public:
gr_block_executor(gr_block_sptr block);
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc
index db2db5d6d..fa3722714 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.cc
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,6 +31,7 @@
#include <iostream>
#include <assert.h>
#include <algorithm>
+#include <boost/math/common_factor_rt.hpp>
static long s_buffer_count = 0; // counts for debugging storage mgmt
static long s_buffer_reader_count = 0;
@@ -73,14 +74,15 @@ static long s_buffer_reader_count = 0;
static long
minimum_buffer_items (long type_size, long page_size)
{
- return page_size / gr_gcd (type_size, page_size);
+ return page_size / boost::math::gcd (type_size, page_size);
}
gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link)
: d_base (0), d_bufsize (0), d_vmcircbuf (0),
d_sizeof_item (sizeof_item), d_link(link),
- d_write_index (0), d_done (false)
+ d_write_index (0), d_abs_write_offset(0), d_done (false),
+ d_last_min_items_read(0)
{
if (!allocate_buffer (nitems, sizeof_item))
throw std::bad_alloc ();
@@ -156,8 +158,16 @@ gr_buffer::space_available ()
// Find out the maximum amount of data available to our readers
int most_data = d_readers[0]->items_available ();
- for (unsigned int i = 1; i < d_readers.size (); i++)
+ uint64_t min_items_read = d_readers[0]->nitems_read();
+ for (size_t i = 1; i < d_readers.size (); i++) {
most_data = std::max (most_data, d_readers[i]->items_available ());
+ min_items_read = std::min(min_items_read, d_readers[i]->nitems_read());
+ }
+
+ if(min_items_read != d_last_min_items_read) {
+ prune_tags(d_last_min_items_read);
+ d_last_min_items_read = min_items_read;
+ }
// The -1 ensures that the case d_write_index == d_read_index is
// unambiguous. It indicates that there is no data for the reader
@@ -177,6 +187,7 @@ gr_buffer::update_write_pointer (int nitems)
{
gruel::scoped_lock guard(*mutex());
d_write_index = index_add (d_write_index, nitems);
+ d_abs_write_offset += nitems;
}
void
@@ -215,6 +226,45 @@ gr_buffer::drop_reader (gr_buffer_reader *reader)
d_readers.erase (result);
}
+void
+gr_buffer::add_item_tag(const pmt::pmt_t &tag)
+{
+ gruel::scoped_lock guard(*mutex());
+ d_item_tags.push_back(tag);
+}
+
+void
+gr_buffer::prune_tags(uint64_t max_time)
+{
+ /* NOTE: this function _should_ lock the mutex before editing
+ d_item_tags. In practice, this function is only called at
+ runtime by min_available_space in gr_block_executor.cc,
+ which locks the mutex itself.
+
+ If this function is used elsewhere, remember to lock the
+ buffer's mutex al la the scoped_lock line below.
+ */
+ //gruel::scoped_lock guard(*mutex());
+ std::deque<pmt::pmt_t>::iterator itr = d_item_tags.begin();
+
+ uint64_t item_time;
+
+ // Since tags are not guarenteed to be in any particular order,
+ // we need to erase here instead of pop_front. An erase in the
+ // middle invalidates all iterators; so this resets the iterator
+ // to find more. Mostly, we wil be erasing from the front and
+ // therefore lose little time this way.
+ while(itr != d_item_tags.end()) {
+ item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
+ if(item_time < max_time) {
+ d_item_tags.erase(itr);
+ itr = d_item_tags.begin();
+ }
+ else
+ itr++;
+ }
+}
+
long
gr_buffer_ncurrently_allocated ()
{
@@ -225,7 +275,7 @@ gr_buffer_ncurrently_allocated ()
gr_buffer_reader::gr_buffer_reader(gr_buffer_sptr buffer, unsigned int read_index,
gr_block_sptr link)
- : d_buffer(buffer), d_read_index(read_index), d_link(link)
+ : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link)
{
s_buffer_reader_count++;
}
@@ -253,6 +303,29 @@ gr_buffer_reader::update_read_pointer (int nitems)
{
gruel::scoped_lock guard(*mutex());
d_read_index = d_buffer->index_add (d_read_index, nitems);
+ d_abs_read_offset += nitems;
+}
+
+void
+gr_buffer_reader::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ uint64_t abs_start,
+ uint64_t abs_end)
+{
+ gruel::scoped_lock guard(*mutex());
+
+ v.resize(0);
+ std::deque<pmt::pmt_t>::iterator itr = d_buffer->get_tags_begin();
+
+ uint64_t item_time;
+ while(itr != d_buffer->get_tags_end()) {
+ item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
+
+ if((item_time >= abs_start) && (item_time < abs_end)) {
+ v.push_back(*itr);
+ }
+
+ itr++;
+ }
}
long
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index 207bfe7c5..e5725d386 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,8 @@
#include <gr_runtime_types.h>
#include <boost/weak_ptr.hpp>
#include <gruel/thread.h>
+#include <gruel/pmt.h>
+#include <deque>
class gr_vmcircbuf;
@@ -88,6 +90,26 @@ class gr_buffer {
gruel::mutex *mutex() { return &d_mutex; }
+ uint64_t nitems_written() { return d_abs_write_offset; }
+
+
+ /*!
+ * \brief Adds a new tag to the buffer.
+ *
+ * \param tag a PMT tuple containing the new tag
+ */
+ void add_item_tag(const pmt::pmt_t &tag);
+
+ /*!
+ * \brief Removes all tags before \p max_time from buffer
+ *
+ * \param max_time the time (item number) to trim up until.
+ */
+ void prune_tags(uint64_t max_time);
+
+ std::deque<pmt::pmt_t>::iterator get_tags_begin() { return d_item_tags.begin(); }
+ std::deque<pmt::pmt_t>::iterator get_tags_end() { return d_item_tags.end(); }
+
// -------------------------------------------------------------------------
private:
@@ -106,11 +128,15 @@ class gr_buffer {
boost::weak_ptr<gr_block> d_link; // block that writes to this buffer
//
- // The mutex protects d_write_index, d_done and the d_read_index's in the buffer readers.
+ // The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags
+ // and the d_read_index's and d_abs_read_offset's in the buffer readers.
//
gruel::mutex d_mutex;
unsigned int d_write_index; // in items [0,d_bufsize)
+ uint64_t d_abs_write_offset; // num items written since the start
bool d_done;
+ std::deque<pmt::pmt_t> d_item_tags;
+ uint64_t d_last_min_items_read;
unsigned
index_add (unsigned a, unsigned b)
@@ -220,11 +246,31 @@ class gr_buffer_reader {
gruel::mutex *mutex() { return d_buffer->mutex(); }
+ uint64_t nitems_read() { return d_abs_read_offset; }
+
/*!
* \brief Return the block that reads via this reader.
+ *
*/
gr_block_sptr link() { return gr_block_sptr(d_link); }
+
+ /*!
+ * \brief Given a [start,end), returns a vector all tags in the range.
+ *
+ * Get a vector of tags in given range. Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
// -------------------------------------------------------------------------
private:
@@ -236,6 +282,7 @@ class gr_buffer_reader {
gr_buffer_sptr d_buffer;
unsigned int d_read_index; // in items [0,d->buffer.d_bufsize)
+ uint64_t d_abs_read_offset; // num items seen since the start
boost::weak_ptr<gr_block> d_link; // block that reads via this buffer reader
//! constructor is private. Use gr_buffer::add_reader to create instances
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.cc b/gnuradio-core/src/lib/runtime/gr_error_handler.cc
index 6dbb0a5d2..4b4cdacef 100644
--- a/gnuradio-core/src/lib/runtime/gr_error_handler.cc
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.cc
@@ -48,7 +48,6 @@
#include <assert.h>
#include <stdexcept>
#include <unistd.h>
-#include <stdio.h>
#ifdef HAVE_IO_H
#include <io.h>
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.h b/gnuradio-core/src/lib/runtime/gr_error_handler.h
index 530a2c23c..aedb6f41f 100644
--- a/gnuradio-core/src/lib/runtime/gr_error_handler.h
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.h
@@ -45,6 +45,7 @@
#include <stdarg.h>
#include <string>
+#include <cstdio> // for FILE
/*!
* \brief abstract error handler
diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
index 031eb6dfd..5d1057e0f 100644
--- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
+++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
@@ -264,16 +264,13 @@ void gr_flat_flowgraph::dump()
int no = detail->noutputs();
for (int i = 0; i < no; i++) {
gr_buffer_sptr buffer = detail->output(i);
- std::cout << " output " << i << ": " << buffer
- << " space=" << buffer->space_available() << std::endl;
+ std::cout << " output " << i << ": " << buffer << std::endl;
}
for (int i = 0; i < ni; i++) {
gr_buffer_reader_sptr reader = detail->input(i);
std::cout << " reader " << i << ": " << reader
- << " reading from buffer=" << reader->buffer()
- << " avail=" << reader->items_available() << " items"
- << std::endl;
+ << " reading from buffer=" << reader->buffer() << std::endl;
}
}
diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
index 27f6257cc..0d3bbb011 100644
--- a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
+++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,6 +28,7 @@
#include <gr_io_signature.h>
#include <stdexcept>
#include <sstream>
+#include <iterator>
#define GR_FLOWGRAPH_DEBUG 0
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
index e3a25e1a8..d6e317136 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
@@ -61,6 +61,11 @@ gr_hier_block2::self()
return shared_from_this();
}
+gr_hier_block2_sptr
+gr_hier_block2::to_hier_block2()
+{
+ return cast_to_hier_block2_sptr(shared_from_this());
+}
void
gr_hier_block2::connect(gr_basic_block_sptr block)
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
index f50b1cb94..0a40c36b7 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h
@@ -147,6 +147,8 @@ public:
// This is a public method for ease of code organization, but should be
// ignored by the user.
gr_flat_flowgraph_sptr flatten() const;
+
+ gr_hier_block2_sptr to_hier_block2(); // Needed for Python/Guile type coercion
};
inline gr_hier_block2_sptr cast_to_hier_block2_sptr(gr_basic_block_sptr block) {
diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.i b/gnuradio-core/src/lib/runtime/gr_hier_block2.i
index a62f50e84..32b656e24 100644
--- a/gnuradio-core/src/lib/runtime/gr_hier_block2.i
+++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.i
@@ -34,6 +34,11 @@ gr_hier_block2_sptr gr_make_hier_block2(const std::string name,
gr_io_signature_sptr output_signature)
throw (std::runtime_error);
+// Rename connect and disconnect so that we can more easily build a
+// better interface in scripting land.
+%rename(primitive_connect) gr_hier_block2::connect;
+%rename(primitive_disconnect) gr_hier_block2::disconnect;
+
class gr_hier_block2 : public gr_basic_block
{
private:
@@ -57,4 +62,6 @@ public:
void disconnect_all();
void lock();
void unlock();
+
+ gr_hier_block2_sptr to_hier_block2(); // Needed for Python/Guile type coercion
};
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
index 9ca92b6ec..c9214bef3 100644
--- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i
+++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2009 Free Software Foundation, Inc.
+ * Copyright 2005,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -81,6 +81,7 @@ public:
* functions into the gr.msg_queue wrapper class, so that everything
* appears normal. (An evil laugh is heard in the distance...)
*/
+#ifdef SWIGPYTHON
%inline %{
gr_message_sptr gr_py_msg_queue__delete_head(gr_msg_queue_sptr q) {
gr_message_sptr msg;
@@ -103,3 +104,65 @@ gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head
gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail
gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail
%}
+#endif // SWIGPYTHON
+
+/*
+ * Similar trickery as above, only this time for Guile
+ */
+#ifdef SWIGGUILE
+
+%{
+ struct arg_holder {
+ gr_msg_queue_sptr q;
+ gr_message_sptr msg;
+ };
+
+ static void *
+ insert_tail_shim(void *arg)
+ {
+ arg_holder *a = (arg_holder *)arg;
+ a->q->insert_tail(a->msg);
+ return 0;
+ }
+
+ static void *
+ delete_head_shim(void *arg)
+ {
+ arg_holder *a = (arg_holder *)arg;
+ a->msg = a->q->delete_head();
+ return 0;
+ }
+%}
+
+%inline %{
+
+ // handle and insert_tail are equivalent
+ static void
+ handle(gr_msg_queue_sptr q, gr_message_sptr msg)
+ {
+ arg_holder a;
+ a.q = q;
+ a.msg = msg;
+ scm_without_guile(insert_tail_shim, (void *) &a);
+ }
+
+ static void
+ insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg)
+ {
+ arg_holder a;
+ a.q = q;
+ a.msg = msg;
+ scm_without_guile(insert_tail_shim, (void *) &a);
+ }
+
+ static gr_message_sptr
+ delete_head(gr_msg_queue_sptr q)
+ {
+ arg_holder a;
+ a.q = q;
+ scm_without_guile(delete_head_shim, (void *) &a);
+ return a.msg;
+ }
+%}
+
+#endif // SWIGGUILE
diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc
index 5f7412248..c2ca047a8 100644
--- a/gnuradio-core/src/lib/runtime/gr_preferences.cc
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2010 Free Software Foundation, Inc.
+ * Copyright 2003,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,6 +25,7 @@
#endif
#include <gr_preferences.h>
+#include <gr_sys_paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -33,12 +34,9 @@
#include <unistd.h>
#include <string.h>
-
-#ifdef MKDIR_TAKES_ONE_ARG
-#define gr_mkdir(pathname, mode) mkdir(pathname)
-#else
-#define gr_mkdir(pathname, mode) mkdir((pathname), (mode))
-#endif
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
/*
* The simplest thing that could possibly work:
@@ -48,27 +46,19 @@
static const char *
pathname (const char *key)
{
- static char buf[200];
- snprintf (buf, sizeof (buf), "%s/.gnuradio/prefs/%s", getenv ("HOME"), key);
- return buf;
+ static fs::path path;
+ path = fs::path(gr_appdata_path()) / ".gnuradio" / "prefs" / key;
+ return path.string().c_str();
}
static void
ensure_dir_path ()
{
- char path[200];
- struct stat statbuf;
-
- snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME"));
- if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
- return;
-
- // blindly try to make it // FIXME make this robust. C++ SUCKS!
+ fs::path path = fs::path(gr_appdata_path()) / ".gnuradio";
+ if (!fs::is_directory(path)) fs::create_directory(path);
- snprintf (path, sizeof (path), "%s/.gnuradio", getenv ("HOME"));
- gr_mkdir (path, 0750);
- snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME"));
- gr_mkdir (path, 0750);
+ path = path / "prefs";
+ if (!fs::is_directory(path)) fs::create_directory(path);
}
const char *
diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i
index 5e9032449..2378a1880 100644
--- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i
+++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.i
@@ -42,6 +42,7 @@ class gr_single_threaded_scheduler {
gr_single_threaded_scheduler (const std::vector<gr_block_sptr> &modules);
};
+#ifdef SWIGPYTHON
%inline %{
void sts_pyrun (gr_single_threaded_scheduler_sptr s) {
Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
@@ -49,3 +50,5 @@ class gr_single_threaded_scheduler {
Py_END_ALLOW_THREADS; // acquire global interpreter lock
}
%}
+#endif
+
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.h b/gnuradio-core/src/lib/runtime/gr_sync_block.h
index 3a5d89d19..c5a6a50f1 100644
--- a/gnuradio-core/src/lib/runtime/gr_sync_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_sync_block.h
@@ -34,7 +34,7 @@
class gr_sync_block : public gr_block
{
protected:
-
+ gr_sync_block (void){} //allows pure virtual interface sub-classes
gr_sync_block (const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature);
diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.cc b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc
new file mode 100644
index 000000000..9d10a3ccd
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2011 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.
+ */
+
+#include <gr_sys_paths.h>
+#include <cstdlib> //getenv
+#include <cstdio> //P_tmpdir (maybe)
+
+const char *gr_tmp_path(){
+ const char *path;
+
+ //first case, try TMP environment variable
+ path = getenv("TMP");
+ if (path) return path;
+
+ //second case, try P_tmpdir when its defined
+ #ifdef P_tmpdir
+ if (P_tmpdir) return P_tmpdir;
+ #endif /*P_tmpdir*/
+
+ //fall-through case, nothing worked
+ return "/tmp";
+}
+
+const char *gr_appdata_path(){
+ const char *path;
+
+ //first case, try HOME environment variable (unix)
+ path = getenv("HOME");
+ if (path) return path;
+
+ //second case, try APPDATA environment variable (windows)
+ path = getenv("APPDATA");
+ if (path) return path;
+
+ //fall-through case, nothing worked
+ return gr_tmp_path();
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.h b/gnuradio-core/src/lib/runtime/gr_sys_paths.h
new file mode 100644
index 000000000..aa8249775
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 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.
+ */
+
+#ifndef _GR_SYS_PATHS_H_
+#define _GR_SYS_PATHS_H_
+
+//! directory to create temporary files
+const char *gr_tmp_path();
+
+//! directory to store application data
+const char *gr_appdata_path();
+
+#endif /* _GR_SYS_PATHS_H_ */
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.cc b/gnuradio-core/src/lib/runtime/gr_tag_info.cc
new file mode 100644
index 000000000..f15329f9b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tag_info.cc
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_tag_info.h>
+#include <gruel/pmt.h>
+
+namespace gr_tags {
+/*
+ const pmt::pmt_t key_time = pmt::pmt_string_to_symbol("time");
+ const pmt::pmt_t key_sample_rate = pmt::pmt_string_to_symbol("sample_rate");
+ const pmt::pmt_t key_frequency = pmt::pmt_string_to_symbol("frequency");
+ const pmt::pmt_t key_rssi = pmt::pmt_string_to_symbol("rssi");
+ const pmt::pmt_t key_rx_gain = pmt::pmt_string_to_symbol("gain");
+*/
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h
new file mode 100644
index 000000000..5a1e1555a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifndef INCLUDED_GR_TAG_INFO_H
+#define INCLUDED_GR_TAG_INFO_H
+
+#include <gruel/pmt.h>
+
+namespace gr_tags {
+
+ enum {
+ TAG_NITEM_REF = 0,
+ TAG_SRCID_REF,
+ TAG_KEY_REF,
+ TAG_VALUE_REF
+ };
+
+ /*
+ extern const pmt::pmt_t key_time;
+ extern const pmt::pmt_t key_sample_rate;
+ extern const pmt::pmt_t key_frequency;
+ extern const pmt::pmt_t key_rssi;
+ extern const pmt::pmt_t key_gain;
+ */
+
+ /*!
+ * \brief Returns the item \p tag occurred at (as a uint64_t)
+ */
+ static inline uint64_t
+ get_nitems(const pmt::pmt_t &tag) {
+ return pmt::pmt_to_uint64(pmt::pmt_tuple_ref(tag, TAG_NITEM_REF));
+ }
+
+ /*!
+ * \brief Returns the source ID of \p tag (as a PMT)
+ */
+ static inline pmt::pmt_t
+ get_srcid(const pmt::pmt_t &tag) {
+ return pmt::pmt_tuple_ref(tag, TAG_SRCID_REF);
+ }
+
+ /*!
+ * \brief Returns the key of \p tag (as a PMT symbol)
+ */
+ static inline pmt::pmt_t
+ get_key(const pmt::pmt_t &tag) {
+ return pmt::pmt_tuple_ref(tag, TAG_KEY_REF);
+ }
+
+ /*!
+ * \brief Returns the value of \p tag (as a PMT)
+ */
+ static inline pmt::pmt_t
+ get_value(const pmt::pmt_t &tag) {
+ return pmt::pmt_tuple_ref(tag, TAG_VALUE_REF);
+ }
+
+ /*!
+ * \brief Comparison function to test which tag, \p x or \p y, came first in time
+ */
+ static inline bool
+ nitems_compare(pmt::pmt_t x, pmt::pmt_t y) {
+ return get_nitems(x) < get_nitems(y);
+ }
+
+}; /* namespace tags */
+
+#endif /* GR_TAG_INFO */
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc
index 09e46dfbb..f341525c0 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc
@@ -95,3 +95,9 @@ gr_top_block::dump()
{
d_impl->dump();
}
+
+gr_top_block_sptr
+gr_top_block::to_top_block()
+{
+ return cast_to_top_block_sptr(shared_from_this());
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h
index 8052954e3..ed244cb7c 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.h
@@ -105,6 +105,13 @@ public:
* Displays flattened flowgraph edges and block connectivity
*/
void dump();
+
+ gr_top_block_sptr to_top_block(); // Needed for Python/Guile type coercion
};
+inline gr_top_block_sptr cast_to_top_block_sptr(gr_basic_block_sptr block) {
+ return boost::dynamic_pointer_cast<gr_top_block, gr_basic_block>(block);
+}
+
+
#endif /* INCLUDED_GR_TOP_BLOCK_H */
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i
index 670e5b5e5..90fa18b94 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -42,13 +42,17 @@ public:
void start() throw (std::runtime_error);
void stop();
- void wait();
- void run();
+ //void wait();
+ //void run() throw (std::runtime_error);
void lock();
void unlock() throw (std::runtime_error);
void dump();
+
+ gr_top_block_sptr to_top_block(); // Needed for Python/Guile type coercion
};
+#ifdef SWIGPYTHON
+
%inline %{
void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
{
@@ -64,3 +68,36 @@ void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
Py_END_ALLOW_THREADS; // acquire global interpreter lock
}
%}
+
+#endif
+
+#ifdef SWIGGUILE
+
+%{
+ struct tb_arg_holder {
+ gr_top_block_sptr tb;
+ };
+
+ static void *
+ tb_wait_shim(void *arg)
+ {
+ tb_arg_holder *a = (tb_arg_holder *)arg;
+ a->tb->wait();
+ return 0;
+ }
+
+%}
+
+%inline %{
+
+ static void
+ top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
+ {
+ tb_arg_holder a;
+ a.tb = r;
+ scm_without_guile(tb_wait_shim, (void *) &a);
+ }
+
+%}
+
+#endif
diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
index 03eef17d9..faa888697 100644
--- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
+++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2009 Free Software Foundation, Inc.
+ * Copyright 2008,2009,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -43,7 +43,7 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block)
// handle any queued up messages
while ((msg = d->d_tpb.delete_head_nowait()))
- block->handle_msg(msg);
+ block->dispatch_msg(msg);
d->d_tpb.clear_changed();
s = d_exec.run_one_iteration();
@@ -73,7 +73,7 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block)
// handle all pending messages
while ((msg = d->d_tpb.delete_head_nowait_already_holding_mutex())){
guard.unlock(); // release lock while processing msg
- block->handle_msg(msg);
+ block->dispatch_msg(msg);
guard.lock();
}
}
@@ -93,7 +93,7 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block)
// handle all pending messages
while ((msg = d->d_tpb.delete_head_nowait_already_holding_mutex())){
guard.unlock(); // release lock while processing msg
- block->handle_msg(msg);
+ block->dispatch_msg(msg);
guard.lock();
}
}
diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h
index 70aa6f294..59149bb2e 100644
--- a/gnuradio-core/src/lib/runtime/gr_unittests.h
+++ b/gnuradio-core/src/lib/runtime/gr_unittests.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,37 +31,11 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
-#ifdef MKDIR_TAKES_ONE_ARG
-#define gr_mkdir(pathname, mode) mkdir(pathname)
-#else
-#define gr_mkdir(pathname, mode) mkdir((pathname), (mode))
-#endif
-
-/*
- * Mostly taken from gr_preferences.cc/h
- * The simplest thing that could possibly work:
- * the key is the filename; the value is the file contents.
- */
-
-static void
-ensure_unittest_path (const char *path)
-{
- struct stat statbuf;
- if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
- return;
-
- // blindly try to make it // FIXME make this robust. C++ SUCKS!
- gr_mkdir (path, 0750);
+static std::string get_unittest_path(const std::string &filename){
+ boost::filesystem::path path = boost::filesystem::current_path() / ".unittests";
+ if (!boost::filesystem::is_directory(path)) boost::filesystem::create_directory(path);
+ return (path / filename).string();
}
-
-static void
-get_unittest_path (const char *filename, char *fullpath, size_t pathsize)
-{
- char path[200];
- snprintf (path, sizeof(path), "./.unittests");
- snprintf (fullpath, pathsize, "%s/%s", path, filename);
-
- ensure_unittest_path(path);
-}
-
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
index 65fe0c488..42c459484 100644
--- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2005 Free Software Foundation, Inc.
+ * Copyright 2003,2005,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -36,7 +36,6 @@
#include <errno.h>
#include <stdio.h>
#include <gr_pagesize.h>
-#include <gr_tmp_path.h>
#include <gr_vmcircbuf_createfilemapping.h>
#ifdef HAVE_CREATEFILEMAPPING
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc
index 3017036ef..4f7ae39cd 100644
--- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2003,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -37,7 +37,7 @@
#include <errno.h>
#include <stdio.h>
#include <gr_pagesize.h>
-#include <gr_tmp_path.h>
+#include <gr_sys_paths.h>
gr_vmcircbuf_mmap_shm_open::gr_vmcircbuf_mmap_shm_open (int size)
diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc
index faae4b396..ee8b0c485 100644
--- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc
+++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2003,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -39,7 +39,7 @@
#include <stdio.h>
#include <string.h>
#include <gr_pagesize.h>
-#include <gr_tmp_path.h>
+#include <gr_sys_paths.h>
gr_vmcircbuf_mmap_tmpfile::gr_vmcircbuf_mmap_tmpfile (int size)
: gr_vmcircbuf (size)
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
new file mode 100644
index 000000000..07ce5c276
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
@@ -0,0 +1,450 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_block_tags.h>
+#include <gr_block.h>
+#include <gr_top_block.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_head.h>
+#include <gr_annotator_alltoall.h>
+#include <gr_annotator_1to1.h>
+#include <gr_keep_one_in_n.h>
+#include <gr_firdes.h>
+#include <gruel/pmt.h>
+
+
+// ----------------------------------------------------------------
+
+using namespace pmt;
+
+// set to 1 to turn on debug output
+// The debug output fully checks that the tags seen are what are expected. While
+// this behavior currently works with our implementation, there is no guarentee
+// that the tags will be coming in this specific order, so it's dangerous to
+// rely on this as a test of the tag system working. We would really want to
+// tags we know we should see and then test that they all occur once, but in no
+// particular order.
+#define QA_TAGS_DEBUG 0
+
+void
+qa_block_tags::t0 ()
+{
+ unsigned int N = 1000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_block_sptr snk (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, snk, 0);
+
+ //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error);
+ //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0);
+
+ tb->run();
+
+ CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument);
+ CPPUNIT_ASSERT(src->nitems_written(0) >= N);
+ CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000);
+ CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument);
+}
+
+
+void
+qa_block_tags::t1 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags3 = ann3->data();
+ std::vector<pmt::pmt_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t1" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+void
+qa_block_tags::t2 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk2 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann1, 1);
+ tb->connect(ann1, 0, ann2, 0);
+ tb->connect(ann1, 1, ann3, 0);
+ tb->connect(ann1, 2, ann4, 0);
+
+ tb->connect(ann2, 0, snk0, 0);
+ tb->connect(ann3, 0, snk1, 0);
+ tb->connect(ann4, 0, snk2, 0);
+
+ tb->run();
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags1 = ann1->data();
+ std::vector<pmt::pmt_t> tags2 = ann2->data();
+ std::vector<pmt::pmt_t> tags3 = ann4->data();
+ std::vector<pmt::pmt_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8);
+
+ // Make sure the rest all have 12 tags
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+
+ pmt_t expected_tags2[12];
+ expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(6));
+ expected_tags2[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags2[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags2[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(9));
+ expected_tags2[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags2[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ pmt_t expected_tags4[12];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags4[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(5));
+ expected_tags4[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(8));
+ expected_tags4[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags4[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(11));
+ expected_tags4[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags4[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t2" << std::endl;
+
+ // For annotator[2-4], we know it gets tags from ann0 and ann1
+ // but the tags from the different outputs of ann1 are different for each.
+ // Just testing ann2 and ann4; if they are correct it would be
+ // inconceivable for ann3 to have it wrong.
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
+ }
+
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t3 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(head, 0, ann0, 1);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags3 = ann3->data();
+ std::vector<pmt::pmt_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t3" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t4 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ // using 1-to-1 tag propagation without having equal number of
+ // ins and outs. Make sure this works; will just exit run early.
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, snk0, 0);
+ tb->connect(ann2, 0, snk1, 0);
+
+ std::cerr << std::endl
+ << "NOTE: This is supposed to produce an error from gr_block_executor"
+ << std::endl;
+ tb->run();
+}
+
+
+void
+qa_block_tags::t5 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(float)));
+ gr_block_sptr head (gr_make_head(sizeof(float), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(float)));
+
+ // Rate change blocks
+ gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann1, 0, dec10, 0);
+ tb->connect(dec10, 0, ann2, 0);
+ tb->connect(ann2, 0, snk0, 0);
+
+ tb->run();
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags1 = ann1->data();
+ std::vector<pmt::pmt_t> tags2 = ann2->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4);
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags1[5];
+ expected_tags1[0] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags1[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags1[2] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags1[3] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(3));
+
+ pmt_t expected_tags2[10];
+ expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt_from_uint64(1000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt_from_uint64(1000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[6] = mp(pmt_from_uint64(3000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[7] = mp(pmt_from_uint64(3000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4));
+ expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4));
+
+ std::cout << std::endl << "qa_block_tags::t5" << std::endl;
+
+ // annotator 1 gets tags from annotator 0
+ std::cout << "tags1.size(): " << tags1.size() << std::endl;
+ for(size_t i = 0; i < tags1.size(); i++) {
+ std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i]));
+ }
+
+ // annotator 2 gets tags from annotators 0 and 1
+ std::cout << std::endl;
+ std::cout << "tags2.size(): " << tags2.size() << std::endl;
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
+ }
+#endif
+}
+
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h
new file mode 100644
index 000000000..b0d211390
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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.
+ */
+
+#ifndef INCLUDED_QA_BLOCK_TAGS_H
+#define INCLUDED_QA_BLOCK_TAGS_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_block_tags : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_block_tags);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+ void t4 ();
+ void t5 ();
+
+};
+
+
+#endif /* INCLUDED_QA_BLOCK_TAGS_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc
index 31e3a82d6..c0bee8ea0 100644
--- a/gnuradio-core/src/lib/runtime/qa_runtime.cc
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2007 Free Software Foundation, Inc.
+ * Copyright 2002,2007,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -38,6 +38,8 @@
#include <qa_gr_hier_block2.h>
#include <qa_gr_hier_block2_derived.h>
#include <qa_gr_buffer.h>
+#include <qa_block_tags.h>
+#include <qa_set_msg_handler.h>
CppUnit::TestSuite *
qa_runtime::suite ()
@@ -52,6 +54,8 @@ qa_runtime::suite ()
s->addTest (qa_gr_hier_block2::suite ());
s->addTest (qa_gr_hier_block2_derived::suite ());
s->addTest (qa_gr_buffer::suite ());
+ s->addTest (qa_block_tags::suite ());
+ s->addTest (qa_set_msg_handler::suite ());
return s;
}
diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc
new file mode 100644
index 000000000..35ef5527e
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_set_msg_handler.h>
+#include <gr_top_block.h>
+#include <gr_head.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_nop.h>
+#include <gruel/msg_passing.h>
+#include <iostream>
+#include <boost/thread/thread.hpp>
+
+
+#define VERBOSE 0
+
+using namespace pmt;
+
+/*
+ * The gr_nop block has been instrumented so that it counts
+ * the number of messages sent to it. We use this feature
+ * to confirm that gr_nop's call to set_msg_handler is working
+ * correctly.
+ */
+
+void qa_set_msg_handler::t0()
+{
+ static const int NMSGS = 10;
+
+ if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n";
+
+ gr_top_block_sptr tb = gr_make_top_block("top");
+
+ gr_block_sptr src = gr_make_null_source(sizeof(int));
+ gr_nop_sptr nop = gr_make_nop(sizeof(int));
+ gr_block_sptr dst = gr_make_null_sink(sizeof(int));
+
+ tb->connect(src, 0, nop, 0);
+ tb->connect(nop, 0, dst, 0);
+
+ // Must start graph before sending messages
+ tb->start();
+
+ // Send them...
+ for (int i = 0; i < NMSGS; i++){
+ send(nop, mp(mp("example-msg"), mp(i)));
+ }
+
+ // And send a message to null_source to confirm that the default
+ // message handling action (which should be a nop) doesn't dump
+ // core.
+ send(src, mp(mp("example-msg"), mp(0)));
+
+ // Give the messages a chance to be processed
+ boost::this_thread::sleep(boost::posix_time::milliseconds(100));
+
+ tb->stop();
+ tb->wait();
+
+ // Confirm that the nop block received the right number of messages.
+ CPPUNIT_ASSERT_EQUAL(NMSGS, nop->nmsgs_received());
+}
diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h
new file mode 100644
index 000000000..e73fffbcd
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2011 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.
+ */
+
+#ifndef INCLUDED_QA_SET_MSG_HANDLER_H
+#define INCLUDED_QA_SET_MSG_HANDLER_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_set_msg_handler : public CppUnit::TestCase
+{
+ CPPUNIT_TEST_SUITE(qa_set_msg_handler);
+
+ CPPUNIT_TEST(t0);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+
+ void t0();
+};
+
+#endif /* INCLUDED_QA_SET_MSG_HANDLER_H */
diff --git a/gnuradio-core/src/lib/runtime/runtime.i b/gnuradio-core/src/lib/runtime/runtime.i
index 20cf68a03..ca89b8fbd 100644
--- a/gnuradio-core/src/lib/runtime/runtime.i
+++ b/gnuradio-core/src/lib/runtime/runtime.i
@@ -40,6 +40,13 @@
#include <gr_top_block.h>
%}
+%constant int sizeof_char = sizeof(char);
+%constant int sizeof_short = sizeof(short);
+%constant int sizeof_int = sizeof(int);
+%constant int sizeof_float = sizeof(float);
+%constant int sizeof_double = sizeof(double);
+%constant int sizeof_gr_complex = sizeof(gr_complex);
+
%include <gr_io_signature.i>
%include <gr_buffer.i>
%include <gr_basic_block.i>
diff --git a/gnuradio-core/src/lib/swig/.gitignore b/gnuradio-core/src/lib/swig/.gitignore
index 9d7d01056..a6f145618 100644
--- a/gnuradio-core/src/lib/swig/.gitignore
+++ b/gnuradio-core/src/lib/swig/.gitignore
@@ -10,27 +10,40 @@
/swigrun.py
/swigrun_wrap.c
/Makefile.swigdeps.new
-/gnuradio_swig_py_runtime.d
-/gnuradio_swig_py_general.d
-/gnuradio_swig_py_gengen.d
-/gnuradio_swig_py_filter.d
-/gnuradio_swig_py_io.d
-/gnuradio_swig_bug_workaround.h
-/gnuradio_swig_py_runtime.cc
-/gnuradio_swig_py_runtime.h
-/gnuradio_swig_py_runtime.py
-/gnuradio_swig_py_general.cc
-/gnuradio_swig_py_general.h
-/gnuradio_swig_py_general.py
-/gnuradio_swig_py_gengen.cc
-/gnuradio_swig_py_gengen.h
-/gnuradio_swig_py_gengen.py
-/gnuradio_swig_py_filter.cc
-/gnuradio_swig_py_filter.h
-/gnuradio_swig_py_filter.py
-/gnuradio_swig_py_io.cc
-/gnuradio_swig_py_io.h
-/gnuradio_swig_py_io.py
-/gnuradio_swig_py_hier.cc
-/gnuradio_swig_py_hier.h
-/gnuradio_swig_py_hier.py
+gnuradio_core_filter.cc
+gnuradio_core_filter.d
+gnuradio_core_filter.h
+gnuradio_core_filter.py
+gnuradio_core_filter.scm
+gnuradio_core_filter-primitive.scm
+gnuradio_core_general.cc
+gnuradio_core_general.d
+gnuradio_core_general.h
+gnuradio_core_general.py
+gnuradio_core_general.scm
+gnuradio_core_general-primitive.scm
+gnuradio_core_gengen.cc
+gnuradio_core_gengen.d
+gnuradio_core_gengen.h
+gnuradio_core_gengen.py
+gnuradio_core_gengen.scm
+gnuradio_core_gengen-primitive.scm
+gnuradio_core_hier.cc
+gnuradio_core_hier.d
+gnuradio_core_hier.h
+gnuradio_core_hier.py
+gnuradio_core_hier.scm
+gnuradio_core_hier-primitive.scm
+gnuradio_core_io.cc
+gnuradio_core_io.d
+gnuradio_core_io.h
+gnuradio_core_io.py
+gnuradio_core_io.scm
+gnuradio_core_io-primitive.scm
+gnuradio_core_runtime.cc
+gnuradio_core_runtime.d
+gnuradio_core_runtime.h
+gnuradio_core_runtime.py
+gnuradio_core_runtime.scm
+gnuradio_core_runtime-primitive.scm
+
diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am
index 1a50b8c8e..f8e7640ae 100644
--- a/gnuradio-core/src/lib/swig/Makefile.am
+++ b/gnuradio-core/src/lib/swig/Makefile.am
@@ -20,12 +20,26 @@
#
include $(top_srcdir)/Makefile.common
+include $(top_srcdir)/Makefile.swig
-if PYTHON
AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \
$(WITH_INCLUDES)
-EXTRA_DIST = gen-swig-bug-fix
+# ----------------------------------------------------------------
+# We've split the previously monstrous gnuradio_core into 6
+# smaller pieces. This reduces compile time coupling and creates
+# smaller pieces for the compiler to digest. prior to this change, on
+# X86_64, g++'s resident set size was 650MB!
+# ----------------------------------------------------------------
+
+TOP_SWIG_IFILES = \
+ gnuradio_core_runtime.i \
+ gnuradio_core_general.i \
+ gnuradio_core_gengen.i \
+ gnuradio_core_filter.i \
+ gnuradio_core_io.i \
+ gnuradio_core_hier.i
+
# SWIG headers get installed in ${prefix}/include/gnuradio/swig
swiginclude_HEADERS = \
@@ -33,71 +47,45 @@ swiginclude_HEADERS = \
gr_swig_block_magic.i \
gr_shared_ptr.i
+# SWIG headers that get installed in ${prefix}/include/gnuradio/swig/...
+nobase_swiginclude_HEADERS = \
+ guile/std_complex.i \
+ guile/std_vector.i
+
+
# special install for this top-level Python script which includes all
# of the split Python libraries.
ourpythondir = $(grpythondir)/gr
-ourpython_PYTHON = gnuradio_swig_python.py
+ourpython_PYTHON = gnuradio_core.py
# ----------------------------------------------------------------
# FIXME As of swig 1.3.31, this still seems to be required...
+# gnuradio_swig_bug_workaround.h : gnuradio_core_runtime.py $(srcdir)/gen-swig-bug-fix
+# $(PYTHON) $(srcdir)/gen-swig-bug-fix python/gnuradio_core_runtime.cc $@
-gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime.cc $(srcdir)/gen-swig-bug-fix
- $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime.cc $@
+EXTRA_DIST += gen-swig-bug-fix
# C/C++ headers get installed in ${prefix}/include/gnuradio
-grinclude_HEADERS = \
- gnuradio_swig_bug_workaround.h
+grinclude_HEADERS = gnuradio_swig_bug_workaround.h
-# ----------------------------------------------------------------
-# We've split the previously monstrous gnuradio_swig_python into 6
-# smaller pieces. This reduces compile time coupling and creates
-# smaller pieces for the compiler to digest. prior to this change, on
-# X86_64, g++'s resident set size was 650MB!
-# ----------------------------------------------------------------
-
-TOP_SWIG_IFILES = \
- gnuradio_swig_py_runtime.i \
- gnuradio_swig_py_general.i \
- gnuradio_swig_py_gengen.i \
- gnuradio_swig_py_filter.i \
- gnuradio_swig_py_io.i \
- gnuradio_swig_py_hier.i
# Install so that they end up available as:
# import gnuradio.gr
# This ends up at:
# ${prefix}/lib/python${python_version}/site-packages/gnuradio/gr
-gnuradio_swig_py_runtime_pythondir_category = gnuradio/gr
-gnuradio_swig_py_general_pythondir_category = gnuradio/gr
-gnuradio_swig_py_gengen_pythondir_category = gnuradio/gr
-gnuradio_swig_py_filter_pythondir_category = gnuradio/gr
-gnuradio_swig_py_io_pythondir_category = gnuradio/gr
-gnuradio_swig_py_hier_pythondir_category = gnuradio/gr
+gnuradio_core_runtime_pythondir_category = gnuradio/gr
+gnuradio_core_general_pythondir_category = gnuradio/gr
+gnuradio_core_gengen_pythondir_category = gnuradio/gr
+gnuradio_core_filter_pythondir_category = gnuradio/gr
+gnuradio_core_io_pythondir_category = gnuradio/gr
+gnuradio_core_hier_pythondir_category = gnuradio/gr
# additional libraries for linking with each SWIG-generated library
-gnuradio_swig_py_runtime_la_swig_libadd = $(GNURADIO_CORE_LA)
-gnuradio_swig_py_general_la_swig_libadd = $(GNURADIO_CORE_LA)
-gnuradio_swig_py_gengen_la_swig_libadd = $(GNURADIO_CORE_LA)
-gnuradio_swig_py_filter_la_swig_libadd = $(GNURADIO_CORE_LA)
-gnuradio_swig_py_io_la_swig_libadd = $(GNURADIO_CORE_LA)
-gnuradio_swig_py_hier_la_swig_libadd = $(GNURADIO_CORE_LA)
-
-include $(top_srcdir)/Makefile.swig
-
-# add some of the variables generated inside the Makefile.swig
-
-# include the SWIG-generated .h files in the BUILT SOURCES, since they
-# aren't by default when using Makefile.swig; order doesn't matter.
-BUILT_SOURCES = \
- gnuradio_swig_py_runtime.h \
- gnuradio_swig_py_general.h \
- gnuradio_swig_py_gengen.h \
- gnuradio_swig_py_filter.h \
- gnuradio_swig_py_io.h \
- gnuradio_swig_py_hier.h \
- $(grinclude_HEADERS) \
- $(swig_built_sources)
-
-# Do not distribute the output of SWIG
-no_dist_files = $(swig_built_sources)
-endif
+gnuradio_core_runtime_la_swig_libadd = $(GNURADIO_CORE_LA)
+gnuradio_core_general_la_swig_libadd = $(GNURADIO_CORE_LA)
+gnuradio_core_gengen_la_swig_libadd = $(GNURADIO_CORE_LA)
+gnuradio_core_filter_la_swig_libadd = $(GNURADIO_CORE_LA)
+gnuradio_core_io_la_swig_libadd = $(GNURADIO_CORE_LA)
+gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA)
+
+SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE
diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen
index e24ba5a96..0c3247565 100644
--- a/gnuradio-core/src/lib/swig/Makefile.swig.gen
+++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen
@@ -20,27 +20,37 @@
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for gnuradio_swig_py_runtime.i
+# Makefile.swig.gen for gnuradio_core_runtime.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_runtime
+## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_runtime
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_runtime
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_runtime
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-gnuradio_swig_py_runtime_pythondir_category ?= gnuradio/gnuradio_swig_py_runtime
-gnuradio_swig_py_runtime_pylibdir_category ?= $(gnuradio_swig_py_runtime_pythondir_category)
-gnuradio_swig_py_runtime_pythondir = $(pythondir)/$(gnuradio_swig_py_runtime_pythondir_category)
-gnuradio_swig_py_runtime_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_runtime_pylibdir_category)
+gnuradio_core_runtime_pythondir_category ?= gnuradio/gnuradio_core_runtime
+gnuradio_core_runtime_pylibdir_category ?= $(gnuradio_core_runtime_pythondir_category)
+gnuradio_core_runtime_pythondir = $(pythondir)/$(gnuradio_core_runtime_pythondir_category)
+gnuradio_core_runtime_pylibdir = $(pyexecdir)/$(gnuradio_core_runtime_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_runtime_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/gnuradio_core_runtime
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_runtime_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-gnuradio_swig_py_runtime_swigincludedir = $(swigincludedir)
+gnuradio_core_runtime_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -57,205 +67,81 @@ gnuradio_swig_py_runtime_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/gnuradio_swig_py_runtime-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-gnuradio_swig_py_runtime_swiginclude_HEADERS = \
- gnuradio_swig_py_runtime.i \
- $(gnuradio_swig_py_runtime_swiginclude_headers)
+gnuradio_core_runtime_swiginclude_HEADERS = \
+ gnuradio_core_runtime.i \
+ $(gnuradio_core_runtime_swiginclude_headers)
+
+if PYTHON
+gnuradio_core_runtime_pylib_LTLIBRARIES = \
+ _gnuradio_core_runtime.la
-gnuradio_swig_py_runtime_pylib_LTLIBRARIES = \
- _gnuradio_swig_py_runtime.la
+_gnuradio_core_runtime_la_SOURCES = \
+ python/gnuradio_core_runtime.cc \
+ $(gnuradio_core_runtime_la_swig_sources)
-_gnuradio_swig_py_runtime_la_SOURCES = \
- gnuradio_swig_py_runtime.cc \
- $(gnuradio_swig_py_runtime_la_swig_sources)
+gnuradio_core_runtime_python_PYTHON = \
+ gnuradio_core_runtime.py \
+ $(gnuradio_core_runtime_python)
-_gnuradio_swig_py_runtime_la_LIBADD = \
+_gnuradio_core_runtime_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(gnuradio_swig_py_runtime_la_swig_libadd)
+ $(gnuradio_core_runtime_la_swig_libadd)
-_gnuradio_swig_py_runtime_la_LDFLAGS = \
+_gnuradio_core_runtime_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(gnuradio_swig_py_runtime_la_swig_ldflags)
+ $(gnuradio_core_runtime_la_swig_ldflags)
-_gnuradio_swig_py_runtime_la_CXXFLAGS = \
+_gnuradio_core_runtime_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(gnuradio_swig_py_runtime_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(gnuradio_core_runtime_la_swig_cxxflags)
-gnuradio_swig_py_runtime_python_PYTHON = \
- gnuradio_swig_py_runtime.py \
- $(gnuradio_swig_py_runtime_python)
+python/gnuradio_core_runtime.cc: gnuradio_core_runtime.py
+gnuradio_core_runtime.py: gnuradio_core_runtime.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/gnuradio_core_runtime.d
-gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc: gnuradio_swig_py_runtime.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/gnuradio_swig_py_runtime-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_runtime-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/gnuradio_swig_py_runtime-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp; \
- exit $$?; \
- fi;
-
-$(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## Call SWIG to generate the various output files; special
-## post-processing on 'mingw32' host OS for the dependency file.
-##
- if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_runtime_swig_args) \
- -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \
- -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \
- > $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \
- $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std; \
- $(MV) $(DEPDIR)/gnuradio_swig_py_runtime.Sd $(DEPDIR)/gnuradio_swig_py_runtime.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/gnuradio_swig_py_runtime.Std $(DEPDIR)/gnuradio_swig_py_runtime.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp
+endif # end of if python
+
+if GUILE
+
+gnuradio_core_runtime_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-gnuradio_core_runtime.la
+libguile_gnuradio_gnuradio_core_runtime_la_SOURCES = \
+ guile/gnuradio_core_runtime.cc \
+ $(gnuradio_core_runtime_la_swig_sources)
+nobase_gnuradio_core_runtime_scm_DATA = \
+ gnuradio/gnuradio_core_runtime.scm \
+ gnuradio/gnuradio_core_runtime-primitive.scm
+libguile_gnuradio_gnuradio_core_runtime_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(gnuradio_core_runtime_la_swig_libadd)
+libguile_gnuradio_gnuradio_core_runtime_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(gnuradio_core_runtime_la_swig_ldflags)
+libguile_gnuradio_gnuradio_core_runtime_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(gnuradio_core_runtime_la_swig_cxxflags)
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+guile/gnuradio_core_runtime.cc: gnuradio/gnuradio_core_runtime.scm
+gnuradio/gnuradio_core_runtime.scm: gnuradio_core_runtime.i
+gnuradio/gnuradio_core_runtime-primitive.scm: gnuradio/gnuradio_core_runtime.scm
+
+# Include the guile dependencies for this file
+-include guile/gnuradio_core_runtime.d
+
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime.d@am__quote@
# -*- Makefile -*-
#
@@ -279,27 +165,37 @@ $(DEPDIR)/gnuradio_swig_py_runtime-generate-stamp:
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for gnuradio_swig_py_general.i
+# Makefile.swig.gen for gnuradio_core_general.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_general
+## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_general
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_general
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_general
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-gnuradio_swig_py_general_pythondir_category ?= gnuradio/gnuradio_swig_py_general
-gnuradio_swig_py_general_pylibdir_category ?= $(gnuradio_swig_py_general_pythondir_category)
-gnuradio_swig_py_general_pythondir = $(pythondir)/$(gnuradio_swig_py_general_pythondir_category)
-gnuradio_swig_py_general_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_general_pylibdir_category)
+gnuradio_core_general_pythondir_category ?= gnuradio/gnuradio_core_general
+gnuradio_core_general_pylibdir_category ?= $(gnuradio_core_general_pythondir_category)
+gnuradio_core_general_pythondir = $(pythondir)/$(gnuradio_core_general_pythondir_category)
+gnuradio_core_general_pylibdir = $(pyexecdir)/$(gnuradio_core_general_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_general_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/gnuradio_core_general
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_general_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-gnuradio_swig_py_general_swigincludedir = $(swigincludedir)
+gnuradio_core_general_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -316,205 +212,81 @@ gnuradio_swig_py_general_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/gnuradio_swig_py_general-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += gnuradio_swig_py_general.py gnuradio_swig_py_general.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-gnuradio_swig_py_general_swiginclude_HEADERS = \
- gnuradio_swig_py_general.i \
- $(gnuradio_swig_py_general_swiginclude_headers)
+gnuradio_core_general_swiginclude_HEADERS = \
+ gnuradio_core_general.i \
+ $(gnuradio_core_general_swiginclude_headers)
+
+if PYTHON
+gnuradio_core_general_pylib_LTLIBRARIES = \
+ _gnuradio_core_general.la
-gnuradio_swig_py_general_pylib_LTLIBRARIES = \
- _gnuradio_swig_py_general.la
+_gnuradio_core_general_la_SOURCES = \
+ python/gnuradio_core_general.cc \
+ $(gnuradio_core_general_la_swig_sources)
-_gnuradio_swig_py_general_la_SOURCES = \
- gnuradio_swig_py_general.cc \
- $(gnuradio_swig_py_general_la_swig_sources)
+gnuradio_core_general_python_PYTHON = \
+ gnuradio_core_general.py \
+ $(gnuradio_core_general_python)
-_gnuradio_swig_py_general_la_LIBADD = \
+_gnuradio_core_general_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(gnuradio_swig_py_general_la_swig_libadd)
+ $(gnuradio_core_general_la_swig_libadd)
-_gnuradio_swig_py_general_la_LDFLAGS = \
+_gnuradio_core_general_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(gnuradio_swig_py_general_la_swig_ldflags)
+ $(gnuradio_core_general_la_swig_ldflags)
-_gnuradio_swig_py_general_la_CXXFLAGS = \
+_gnuradio_core_general_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(gnuradio_swig_py_general_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(gnuradio_core_general_la_swig_cxxflags)
-gnuradio_swig_py_general_python_PYTHON = \
- gnuradio_swig_py_general.py \
- $(gnuradio_swig_py_general_python)
+python/gnuradio_core_general.cc: gnuradio_core_general.py
+gnuradio_core_general.py: gnuradio_core_general.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/gnuradio_core_general.d
-gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general.cc: gnuradio_swig_py_general.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/gnuradio_swig_py_general-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_general-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/gnuradio_swig_py_general-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/gnuradio_swig_py_general-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/gnuradio_swig_py_general-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/gnuradio_swig_py_general-generate-stamp; \
- exit $$?; \
- fi;
-
-$(DEPDIR)/gnuradio_swig_py_general-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## Call SWIG to generate the various output files; special
-## post-processing on 'mingw32' host OS for the dependency file.
-##
- if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_general_swig_args) \
- -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \
- -module gnuradio_swig_py_general -o gnuradio_swig_py_general.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \
- > $(DEPDIR)/gnuradio_swig_py_general.Sd; \
- $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std; \
- $(MV) $(DEPDIR)/gnuradio_swig_py_general.Sd $(DEPDIR)/gnuradio_swig_py_general.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/gnuradio_swig_py_general.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_general.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/gnuradio_swig_py_general.Std $(DEPDIR)/gnuradio_swig_py_general.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/gnuradio_swig_py_general.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_general.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/gnuradio_swig_py_general-generate-stamp
+endif # end of if python
+
+if GUILE
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+gnuradio_core_general_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-gnuradio_core_general.la
+libguile_gnuradio_gnuradio_core_general_la_SOURCES = \
+ guile/gnuradio_core_general.cc \
+ $(gnuradio_core_general_la_swig_sources)
+nobase_gnuradio_core_general_scm_DATA = \
+ gnuradio/gnuradio_core_general.scm \
+ gnuradio/gnuradio_core_general-primitive.scm
+libguile_gnuradio_gnuradio_core_general_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(gnuradio_core_general_la_swig_libadd)
+libguile_gnuradio_gnuradio_core_general_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(gnuradio_core_general_la_swig_ldflags)
+libguile_gnuradio_gnuradio_core_general_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(gnuradio_core_general_la_swig_cxxflags)
+
+guile/gnuradio_core_general.cc: gnuradio/gnuradio_core_general.scm
+gnuradio/gnuradio_core_general.scm: gnuradio_core_general.i
+gnuradio/gnuradio_core_general-primitive.scm: gnuradio/gnuradio_core_general.scm
+
+# Include the guile dependencies for this file
+-include guile/gnuradio_core_general.d
+
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general.d@am__quote@
# -*- Makefile -*-
#
@@ -538,27 +310,37 @@ $(DEPDIR)/gnuradio_swig_py_general-generate-stamp:
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for gnuradio_swig_py_gengen.i
+# Makefile.swig.gen for gnuradio_core_gengen.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_gengen
+## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_gengen
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_gengen
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_gengen
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-gnuradio_swig_py_gengen_pythondir_category ?= gnuradio/gnuradio_swig_py_gengen
-gnuradio_swig_py_gengen_pylibdir_category ?= $(gnuradio_swig_py_gengen_pythondir_category)
-gnuradio_swig_py_gengen_pythondir = $(pythondir)/$(gnuradio_swig_py_gengen_pythondir_category)
-gnuradio_swig_py_gengen_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_gengen_pylibdir_category)
+gnuradio_core_gengen_pythondir_category ?= gnuradio/gnuradio_core_gengen
+gnuradio_core_gengen_pylibdir_category ?= $(gnuradio_core_gengen_pythondir_category)
+gnuradio_core_gengen_pythondir = $(pythondir)/$(gnuradio_core_gengen_pythondir_category)
+gnuradio_core_gengen_pylibdir = $(pyexecdir)/$(gnuradio_core_gengen_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_gengen_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/gnuradio_core_gengen
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_gengen_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-gnuradio_swig_py_gengen_swigincludedir = $(swigincludedir)
+gnuradio_core_gengen_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -575,205 +357,81 @@ gnuradio_swig_py_gengen_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/gnuradio_swig_py_gengen-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-gnuradio_swig_py_gengen_swiginclude_HEADERS = \
- gnuradio_swig_py_gengen.i \
- $(gnuradio_swig_py_gengen_swiginclude_headers)
+gnuradio_core_gengen_swiginclude_HEADERS = \
+ gnuradio_core_gengen.i \
+ $(gnuradio_core_gengen_swiginclude_headers)
+
+if PYTHON
+gnuradio_core_gengen_pylib_LTLIBRARIES = \
+ _gnuradio_core_gengen.la
-gnuradio_swig_py_gengen_pylib_LTLIBRARIES = \
- _gnuradio_swig_py_gengen.la
+_gnuradio_core_gengen_la_SOURCES = \
+ python/gnuradio_core_gengen.cc \
+ $(gnuradio_core_gengen_la_swig_sources)
-_gnuradio_swig_py_gengen_la_SOURCES = \
- gnuradio_swig_py_gengen.cc \
- $(gnuradio_swig_py_gengen_la_swig_sources)
+gnuradio_core_gengen_python_PYTHON = \
+ gnuradio_core_gengen.py \
+ $(gnuradio_core_gengen_python)
-_gnuradio_swig_py_gengen_la_LIBADD = \
+_gnuradio_core_gengen_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(gnuradio_swig_py_gengen_la_swig_libadd)
+ $(gnuradio_core_gengen_la_swig_libadd)
-_gnuradio_swig_py_gengen_la_LDFLAGS = \
+_gnuradio_core_gengen_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(gnuradio_swig_py_gengen_la_swig_ldflags)
+ $(gnuradio_core_gengen_la_swig_ldflags)
-_gnuradio_swig_py_gengen_la_CXXFLAGS = \
+_gnuradio_core_gengen_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(gnuradio_swig_py_gengen_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(gnuradio_core_gengen_la_swig_cxxflags)
-gnuradio_swig_py_gengen_python_PYTHON = \
- gnuradio_swig_py_gengen.py \
- $(gnuradio_swig_py_gengen_python)
+python/gnuradio_core_gengen.cc: gnuradio_core_gengen.py
+gnuradio_core_gengen.py: gnuradio_core_gengen.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/gnuradio_core_gengen.d
-gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: gnuradio_swig_py_gengen.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/gnuradio_swig_py_gengen-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_gengen-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/gnuradio_swig_py_gengen-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp; \
- exit $$?; \
- fi;
-
-$(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## Call SWIG to generate the various output files; special
-## post-processing on 'mingw32' host OS for the dependency file.
-##
- if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_gengen_swig_args) \
- -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \
- -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \
- > $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \
- $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std; \
- $(MV) $(DEPDIR)/gnuradio_swig_py_gengen.Sd $(DEPDIR)/gnuradio_swig_py_gengen.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/gnuradio_swig_py_gengen.Std $(DEPDIR)/gnuradio_swig_py_gengen.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp
+endif # end of if python
+
+if GUILE
+
+gnuradio_core_gengen_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-gnuradio_core_gengen.la
+libguile_gnuradio_gnuradio_core_gengen_la_SOURCES = \
+ guile/gnuradio_core_gengen.cc \
+ $(gnuradio_core_gengen_la_swig_sources)
+nobase_gnuradio_core_gengen_scm_DATA = \
+ gnuradio/gnuradio_core_gengen.scm \
+ gnuradio/gnuradio_core_gengen-primitive.scm
+libguile_gnuradio_gnuradio_core_gengen_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(gnuradio_core_gengen_la_swig_libadd)
+libguile_gnuradio_gnuradio_core_gengen_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(gnuradio_core_gengen_la_swig_ldflags)
+libguile_gnuradio_gnuradio_core_gengen_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(gnuradio_core_gengen_la_swig_cxxflags)
+
+guile/gnuradio_core_gengen.cc: gnuradio/gnuradio_core_gengen.scm
+gnuradio/gnuradio_core_gengen.scm: gnuradio_core_gengen.i
+gnuradio/gnuradio_core_gengen-primitive.scm: gnuradio/gnuradio_core_gengen.scm
+
+# Include the guile dependencies for this file
+-include guile/gnuradio_core_gengen.d
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen.d@am__quote@
# -*- Makefile -*-
#
@@ -797,27 +455,37 @@ $(DEPDIR)/gnuradio_swig_py_gengen-generate-stamp:
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for gnuradio_swig_py_filter.i
+# Makefile.swig.gen for gnuradio_core_filter.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_filter
+## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_filter
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_filter
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_filter
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-gnuradio_swig_py_filter_pythondir_category ?= gnuradio/gnuradio_swig_py_filter
-gnuradio_swig_py_filter_pylibdir_category ?= $(gnuradio_swig_py_filter_pythondir_category)
-gnuradio_swig_py_filter_pythondir = $(pythondir)/$(gnuradio_swig_py_filter_pythondir_category)
-gnuradio_swig_py_filter_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_filter_pylibdir_category)
+gnuradio_core_filter_pythondir_category ?= gnuradio/gnuradio_core_filter
+gnuradio_core_filter_pylibdir_category ?= $(gnuradio_core_filter_pythondir_category)
+gnuradio_core_filter_pythondir = $(pythondir)/$(gnuradio_core_filter_pythondir_category)
+gnuradio_core_filter_pylibdir = $(pyexecdir)/$(gnuradio_core_filter_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_filter_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/gnuradio_core_filter
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_filter_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-gnuradio_swig_py_filter_swigincludedir = $(swigincludedir)
+gnuradio_core_filter_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -834,205 +502,81 @@ gnuradio_swig_py_filter_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/gnuradio_swig_py_filter-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-gnuradio_swig_py_filter_swiginclude_HEADERS = \
- gnuradio_swig_py_filter.i \
- $(gnuradio_swig_py_filter_swiginclude_headers)
+gnuradio_core_filter_swiginclude_HEADERS = \
+ gnuradio_core_filter.i \
+ $(gnuradio_core_filter_swiginclude_headers)
+
+if PYTHON
+gnuradio_core_filter_pylib_LTLIBRARIES = \
+ _gnuradio_core_filter.la
-gnuradio_swig_py_filter_pylib_LTLIBRARIES = \
- _gnuradio_swig_py_filter.la
+_gnuradio_core_filter_la_SOURCES = \
+ python/gnuradio_core_filter.cc \
+ $(gnuradio_core_filter_la_swig_sources)
-_gnuradio_swig_py_filter_la_SOURCES = \
- gnuradio_swig_py_filter.cc \
- $(gnuradio_swig_py_filter_la_swig_sources)
+gnuradio_core_filter_python_PYTHON = \
+ gnuradio_core_filter.py \
+ $(gnuradio_core_filter_python)
-_gnuradio_swig_py_filter_la_LIBADD = \
+_gnuradio_core_filter_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(gnuradio_swig_py_filter_la_swig_libadd)
+ $(gnuradio_core_filter_la_swig_libadd)
-_gnuradio_swig_py_filter_la_LDFLAGS = \
+_gnuradio_core_filter_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(gnuradio_swig_py_filter_la_swig_ldflags)
+ $(gnuradio_core_filter_la_swig_ldflags)
-_gnuradio_swig_py_filter_la_CXXFLAGS = \
+_gnuradio_core_filter_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(gnuradio_swig_py_filter_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(gnuradio_core_filter_la_swig_cxxflags)
-gnuradio_swig_py_filter_python_PYTHON = \
- gnuradio_swig_py_filter.py \
- $(gnuradio_swig_py_filter_python)
+python/gnuradio_core_filter.cc: gnuradio_core_filter.py
+gnuradio_core_filter.py: gnuradio_core_filter.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/gnuradio_core_filter.d
-gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: gnuradio_swig_py_filter.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/gnuradio_swig_py_filter-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_filter-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/gnuradio_swig_py_filter-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp; \
- exit $$?; \
- fi;
-
-$(DEPDIR)/gnuradio_swig_py_filter-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## Call SWIG to generate the various output files; special
-## post-processing on 'mingw32' host OS for the dependency file.
-##
- if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_filter_swig_args) \
- -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \
- -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \
- > $(DEPDIR)/gnuradio_swig_py_filter.Sd; \
- $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std; \
- $(MV) $(DEPDIR)/gnuradio_swig_py_filter.Sd $(DEPDIR)/gnuradio_swig_py_filter.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/gnuradio_swig_py_filter.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_filter.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/gnuradio_swig_py_filter.Std $(DEPDIR)/gnuradio_swig_py_filter.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/gnuradio_swig_py_filter.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp
+endif # end of if python
+
+if GUILE
+
+gnuradio_core_filter_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-gnuradio_core_filter.la
+libguile_gnuradio_gnuradio_core_filter_la_SOURCES = \
+ guile/gnuradio_core_filter.cc \
+ $(gnuradio_core_filter_la_swig_sources)
+nobase_gnuradio_core_filter_scm_DATA = \
+ gnuradio/gnuradio_core_filter.scm \
+ gnuradio/gnuradio_core_filter-primitive.scm
+libguile_gnuradio_gnuradio_core_filter_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(gnuradio_core_filter_la_swig_libadd)
+libguile_gnuradio_gnuradio_core_filter_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(gnuradio_core_filter_la_swig_ldflags)
+libguile_gnuradio_gnuradio_core_filter_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(gnuradio_core_filter_la_swig_cxxflags)
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+guile/gnuradio_core_filter.cc: gnuradio/gnuradio_core_filter.scm
+gnuradio/gnuradio_core_filter.scm: gnuradio_core_filter.i
+gnuradio/gnuradio_core_filter-primitive.scm: gnuradio/gnuradio_core_filter.scm
+
+# Include the guile dependencies for this file
+-include guile/gnuradio_core_filter.d
+
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter.d@am__quote@
# -*- Makefile -*-
#
@@ -1056,27 +600,37 @@ $(DEPDIR)/gnuradio_swig_py_filter-generate-stamp:
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for gnuradio_swig_py_io.i
+# Makefile.swig.gen for gnuradio_core_io.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_io
+## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_io
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_io
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_io
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-gnuradio_swig_py_io_pythondir_category ?= gnuradio/gnuradio_swig_py_io
-gnuradio_swig_py_io_pylibdir_category ?= $(gnuradio_swig_py_io_pythondir_category)
-gnuradio_swig_py_io_pythondir = $(pythondir)/$(gnuradio_swig_py_io_pythondir_category)
-gnuradio_swig_py_io_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_io_pylibdir_category)
+gnuradio_core_io_pythondir_category ?= gnuradio/gnuradio_core_io
+gnuradio_core_io_pylibdir_category ?= $(gnuradio_core_io_pythondir_category)
+gnuradio_core_io_pythondir = $(pythondir)/$(gnuradio_core_io_pythondir_category)
+gnuradio_core_io_pylibdir = $(pyexecdir)/$(gnuradio_core_io_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_io_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/gnuradio_core_io
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_io_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-gnuradio_swig_py_io_swigincludedir = $(swigincludedir)
+gnuradio_core_io_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -1093,205 +647,81 @@ gnuradio_swig_py_io_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/gnuradio_swig_py_io-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += gnuradio_swig_py_io.py gnuradio_swig_py_io.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-gnuradio_swig_py_io_swiginclude_HEADERS = \
- gnuradio_swig_py_io.i \
- $(gnuradio_swig_py_io_swiginclude_headers)
+gnuradio_core_io_swiginclude_HEADERS = \
+ gnuradio_core_io.i \
+ $(gnuradio_core_io_swiginclude_headers)
+
+if PYTHON
+gnuradio_core_io_pylib_LTLIBRARIES = \
+ _gnuradio_core_io.la
-gnuradio_swig_py_io_pylib_LTLIBRARIES = \
- _gnuradio_swig_py_io.la
+_gnuradio_core_io_la_SOURCES = \
+ python/gnuradio_core_io.cc \
+ $(gnuradio_core_io_la_swig_sources)
-_gnuradio_swig_py_io_la_SOURCES = \
- gnuradio_swig_py_io.cc \
- $(gnuradio_swig_py_io_la_swig_sources)
+gnuradio_core_io_python_PYTHON = \
+ gnuradio_core_io.py \
+ $(gnuradio_core_io_python)
-_gnuradio_swig_py_io_la_LIBADD = \
+_gnuradio_core_io_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(gnuradio_swig_py_io_la_swig_libadd)
+ $(gnuradio_core_io_la_swig_libadd)
-_gnuradio_swig_py_io_la_LDFLAGS = \
+_gnuradio_core_io_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(gnuradio_swig_py_io_la_swig_ldflags)
+ $(gnuradio_core_io_la_swig_ldflags)
-_gnuradio_swig_py_io_la_CXXFLAGS = \
+_gnuradio_core_io_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(gnuradio_swig_py_io_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(gnuradio_core_io_la_swig_cxxflags)
-gnuradio_swig_py_io_python_PYTHON = \
- gnuradio_swig_py_io.py \
- $(gnuradio_swig_py_io_python)
+python/gnuradio_core_io.cc: gnuradio_core_io.py
+gnuradio_core_io.py: gnuradio_core_io.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/gnuradio_core_io.d
-gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_swig_py_io.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/gnuradio_swig_py_io-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_io-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/gnuradio_swig_py_io-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/gnuradio_swig_py_io-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/gnuradio_swig_py_io-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/gnuradio_swig_py_io-generate-stamp; \
- exit $$?; \
- fi;
-
-$(DEPDIR)/gnuradio_swig_py_io-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## Call SWIG to generate the various output files; special
-## post-processing on 'mingw32' host OS for the dependency file.
-##
- if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_io_swig_args) \
- -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \
- -module gnuradio_swig_py_io -o gnuradio_swig_py_io.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \
- > $(DEPDIR)/gnuradio_swig_py_io.Sd; \
- $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std; \
- $(MV) $(DEPDIR)/gnuradio_swig_py_io.Sd $(DEPDIR)/gnuradio_swig_py_io.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/gnuradio_swig_py_io.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_io.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/gnuradio_swig_py_io.Std $(DEPDIR)/gnuradio_swig_py_io.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/gnuradio_swig_py_io.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_io.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/gnuradio_swig_py_io-generate-stamp
+endif # end of if python
+
+if GUILE
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+gnuradio_core_io_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-gnuradio_core_io.la
+libguile_gnuradio_gnuradio_core_io_la_SOURCES = \
+ guile/gnuradio_core_io.cc \
+ $(gnuradio_core_io_la_swig_sources)
+nobase_gnuradio_core_io_scm_DATA = \
+ gnuradio/gnuradio_core_io.scm \
+ gnuradio/gnuradio_core_io-primitive.scm
+libguile_gnuradio_gnuradio_core_io_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(gnuradio_core_io_la_swig_libadd)
+libguile_gnuradio_gnuradio_core_io_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(gnuradio_core_io_la_swig_ldflags)
+libguile_gnuradio_gnuradio_core_io_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(gnuradio_core_io_la_swig_cxxflags)
+
+guile/gnuradio_core_io.cc: gnuradio/gnuradio_core_io.scm
+gnuradio/gnuradio_core_io.scm: gnuradio_core_io.i
+gnuradio/gnuradio_core_io-primitive.scm: gnuradio/gnuradio_core_io.scm
+
+# Include the guile dependencies for this file
+-include guile/gnuradio_core_io.d
+
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io.d@am__quote@
# -*- Makefile -*-
#
@@ -1315,27 +745,37 @@ $(DEPDIR)/gnuradio_swig_py_io-generate-stamp:
# Boston, MA 02110-1301, USA.
#
-# Makefile.swig.gen for gnuradio_swig_py_hier.i
+# Makefile.swig.gen for gnuradio_core_hier.i
## Default install locations for these files:
##
## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_hier
+## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_hier
## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_hier
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_core_hier
##
## The following can be overloaded to change the install location, but
## this has to be done in the including Makefile.am -before-
## Makefile.swig is included.
-gnuradio_swig_py_hier_pythondir_category ?= gnuradio/gnuradio_swig_py_hier
-gnuradio_swig_py_hier_pylibdir_category ?= $(gnuradio_swig_py_hier_pythondir_category)
-gnuradio_swig_py_hier_pythondir = $(pythondir)/$(gnuradio_swig_py_hier_pythondir_category)
-gnuradio_swig_py_hier_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_hier_pylibdir_category)
+gnuradio_core_hier_pythondir_category ?= gnuradio/gnuradio_core_hier
+gnuradio_core_hier_pylibdir_category ?= $(gnuradio_core_hier_pythondir_category)
+gnuradio_core_hier_pythondir = $(pythondir)/$(gnuradio_core_hier_pythondir_category)
+gnuradio_core_hier_pylibdir = $(pyexecdir)/$(gnuradio_core_hier_pylibdir_category)
+
+# The .so libraries for the guile modules get installed whereever guile
+# is installed, usually /usr/lib/guile/gnuradio/
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_hier_scmlibdir = $(libdir)
+
+# The scm files for the guile modules get installed where ever guile
+# is installed, usually /usr/share/guile/site/gnuradio_core_hier
+# FIXME: determince whether these should be installed with gnuradio.
+gnuradio_core_hier_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
-gnuradio_swig_py_hier_swigincludedir = $(swigincludedir)
+gnuradio_core_hier_swigincludedir = $(swigincludedir)
## This is a template file for a "generated" Makefile addition (in
## this case, "Makefile.swig.gen"). By including the top-level
@@ -1352,203 +792,79 @@ gnuradio_swig_py_hier_swigincludedir = $(swigincludedir)
## right thing. For more info, see <
## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-## Stamps used to ensure parallel make does the right thing. These
-## are removed by "make clean", but otherwise unused except during the
-## parallel built. These will not be included in a tarball, because
-## the SWIG-generated files will be removed from the distribution.
-
-STAMPS += $(DEPDIR)/gnuradio_swig_py_hier-generate-*
-
## Other cleaned files: dependency files generated by SWIG or this Makefile
MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-## Add the .py and .cc files to the list of SWIG built sources. The
-## .h file is sometimes built, but not always ... so that one has to
-## be added manually by the including Makefile.am .
-
-swig_built_sources += gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc
-
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
-gnuradio_swig_py_hier_swiginclude_HEADERS = \
- gnuradio_swig_py_hier.i \
- $(gnuradio_swig_py_hier_swiginclude_headers)
+gnuradio_core_hier_swiginclude_HEADERS = \
+ gnuradio_core_hier.i \
+ $(gnuradio_core_hier_swiginclude_headers)
+
+if PYTHON
+gnuradio_core_hier_pylib_LTLIBRARIES = \
+ _gnuradio_core_hier.la
-gnuradio_swig_py_hier_pylib_LTLIBRARIES = \
- _gnuradio_swig_py_hier.la
+_gnuradio_core_hier_la_SOURCES = \
+ python/gnuradio_core_hier.cc \
+ $(gnuradio_core_hier_la_swig_sources)
-_gnuradio_swig_py_hier_la_SOURCES = \
- gnuradio_swig_py_hier.cc \
- $(gnuradio_swig_py_hier_la_swig_sources)
+gnuradio_core_hier_python_PYTHON = \
+ gnuradio_core_hier.py \
+ $(gnuradio_core_hier_python)
-_gnuradio_swig_py_hier_la_LIBADD = \
+_gnuradio_core_hier_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
- $(gnuradio_swig_py_hier_la_swig_libadd)
+ $(gnuradio_core_hier_la_swig_libadd)
-_gnuradio_swig_py_hier_la_LDFLAGS = \
+_gnuradio_core_hier_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
- $(gnuradio_swig_py_hier_la_swig_ldflags)
+ $(gnuradio_core_hier_la_swig_ldflags)
-_gnuradio_swig_py_hier_la_CXXFLAGS = \
+_gnuradio_core_hier_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
- $(gnuradio_swig_py_hier_la_swig_cxxflags)
+ -I$(top_builddir) \
+ $(gnuradio_core_hier_la_swig_cxxflags)
-gnuradio_swig_py_hier_python_PYTHON = \
- gnuradio_swig_py_hier.py \
- $(gnuradio_swig_py_hier_python)
+python/gnuradio_core_hier.cc: gnuradio_core_hier.py
+gnuradio_core_hier.py: gnuradio_core_hier.i
-## Entry rule for running SWIG
+# Include the python dependencies for this file
+-include python/gnuradio_core_hier.d
-gnuradio_swig_py_hier.h gnuradio_swig_py_hier.py gnuradio_swig_py_hier.cc: gnuradio_swig_py_hier.i
-## This rule will get called only when MAKE decides that one of the
-## targets needs to be created or re-created, because:
-##
-## * The .i file is newer than any or all of the generated files;
-##
-## * Any or all of the .cc, .h, or .py files does not exist and is
-## needed (in the case this file is not needed, the rule for it is
-## ignored); or
-##
-## * Some SWIG-based dependecy of the .cc file isn't met and hence the
-## .cc file needs be be regenerated. Explanation: Because MAKE
-## knows how to handle dependencies for .cc files (regardless of
-## their name or extension), then the .cc file is used as a target
-## instead of the .i file -- but with the dependencies of the .i
-## file. It is this last reason why the line:
-##
-## if test -f $@; then :; else
-##
-## cannot be used in this case: If a .i file dependecy is not met,
-## then the .cc file needs to be rebuilt. But if the stamp is newer
-## than the .cc file, and the .cc file exists, then in the original
-## version (with the 'test' above) the internal MAKE call will not
-## be issued and hence the .cc file will not be rebuilt.
-##
-## Once execution gets to here, it should always proceed no matter the
-## state of a stamp (as discussed in link above). The
-## $(DEPDIR)/gnuradio_swig_py_hier-generate stuff is used to allow for parallel
-## builds to "do the right thing". The stamp has no relationship with
-## either the target files or dependency file; it is used solely for
-## the protection of multiple builds during a given call to MAKE.
-##
-## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
-## (15). At a caught signal, the quoted command will be issued before
-## exiting. In this case, remove any stamp, whether temporary of not.
-## The trap is valid until the process exits; the process includes all
-## commands appended via "\"s.
-##
- trap 'rm -rf $(DEPDIR)/gnuradio_swig_py_hier-generate-*' 1 2 13 15; \
-##
-## Create a temporary directory, which acts as a lock. The first
-## process to create the directory will succeed and issue the MAKE
-## command to do the actual work, while all subsequent processes will
-## fail -- leading them to wait for the first process to finish.
-##
- if mkdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock 2>/dev/null; then \
-##
-## This code is being executed by the first process to succeed in
-## creating the directory lock.
-##
-## Remove the stamp associated with this filename.
-##
- rm -f $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp; \
-##
-## Tell MAKE to run the rule for creating this stamp.
-##
- $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp WHAT=$<; \
-##
-## Now that the .cc, .h, and .py files have been (re)created from the
-## .i file, future checking of this rule during the same MAKE
-## execution will come back that the rule doesn't need to be executed
-## because none of the conditions mentioned at the start of this rule
-## will be positive. Remove the the directory lock, which frees up
-## any waiting process(es) to continue.
-##
- rmdir $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; \
- else \
-##
-## This code is being executed by any follower processes while the
-## directory lock is in place.
-##
-## Wait until the first process is done, testing once per second.
-##
- while test -d $(DEPDIR)/gnuradio_swig_py_hier-generate-lock; do \
- sleep 1; \
- done; \
-##
-## Succeed if and only if the first process succeeded; exit this
-## process returning the status of the generated stamp.
-##
- test -f $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp; \
- exit $$?; \
- fi;
-
-$(DEPDIR)/gnuradio_swig_py_hier-generate-stamp:
-## This rule will be called only by the first process issuing the
-## above rule to succeed in creating the lock directory, after
-## removing the actual stamp file in order to guarantee that MAKE will
-## execute this rule.
-##
-## Call SWIG to generate the various output files; special
-## post-processing on 'mingw32' host OS for the dependency file.
-##
- if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(gnuradio_swig_py_hier_swig_args) \
- -MD -MF $(DEPDIR)/gnuradio_swig_py_hier.Std \
- -module gnuradio_swig_py_hier -o gnuradio_swig_py_hier.cc $(WHAT); then \
- if test $(host_os) = mingw32; then \
- $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Sd; \
- $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std \
- > $(DEPDIR)/gnuradio_swig_py_hier.Sd; \
- $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Std; \
- $(MV) $(DEPDIR)/gnuradio_swig_py_hier.Sd $(DEPDIR)/gnuradio_swig_py_hier.Std; \
- fi; \
- else \
- $(RM) $(DEPDIR)/gnuradio_swig_py_hier.S*; exit 1; \
- fi;
-##
-## Mess with the SWIG output .Std dependency file, to create a
-## dependecy file valid for the input .i file: Basically, simulate the
-## dependency file created for libraries by GNU's libtool for C++,
-## where all of the dependencies for the target are first listed, then
-## each individual dependency is listed as a target with no further
-## dependencies.
-##
-## (1) remove the current dependency file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_hier.d
-##
-## (2) Copy the whole SWIG file:
-##
- cp $(DEPDIR)/gnuradio_swig_py_hier.Std $(DEPDIR)/gnuradio_swig_py_hier.d
-##
-## (3) all a carriage return to the end of the dependency file.
-##
- echo "" >> $(DEPDIR)/gnuradio_swig_py_hier.d
-##
-## (4) from the SWIG file, remove the first line (the target); remove
-## trailing " \" and " " from each line. Append ":" to each line,
-## followed by 2 carriage returns, then append this to the end of
-## the dependency file.
-##
- $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/gnuradio_swig_py_hier.Std | \
- awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_hier.d
-##
-## (5) remove the SWIG-generated file
-##
- $(RM) $(DEPDIR)/gnuradio_swig_py_hier.Std
-##
-## Create the stamp for this filename generation, to signal success in
-## executing this rule; allows other threads waiting on this process
-## to continue.
-##
- touch $(DEPDIR)/gnuradio_swig_py_hier-generate-stamp
+endif # end of if python
+
+if GUILE
+
+gnuradio_core_hier_scmlib_LTLIBRARIES = \
+ libguile-gnuradio-gnuradio_core_hier.la
+libguile_gnuradio_gnuradio_core_hier_la_SOURCES = \
+ guile/gnuradio_core_hier.cc \
+ $(gnuradio_core_hier_la_swig_sources)
+nobase_gnuradio_core_hier_scm_DATA = \
+ gnuradio/gnuradio_core_hier.scm \
+ gnuradio/gnuradio_core_hier-primitive.scm
+libguile_gnuradio_gnuradio_core_hier_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(gnuradio_core_hier_la_swig_libadd)
+libguile_gnuradio_gnuradio_core_hier_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(gnuradio_core_hier_la_swig_ldflags)
+libguile_gnuradio_gnuradio_core_hier_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ -I$(top_builddir) \
+ $(gnuradio_core_hier_la_swig_cxxflags)
+
+guile/gnuradio_core_hier.cc: gnuradio/gnuradio_core_hier.scm
+gnuradio/gnuradio_core_hier.scm: gnuradio_core_hier.i
+gnuradio/gnuradio_core_hier-primitive.scm: gnuradio/gnuradio_core_hier.scm
+
+# Include the guile dependencies for this file
+-include guile/gnuradio_core_hier.d
-# KLUDGE: Force runtime include of a SWIG dependency file. This is
-# not guaranteed to be portable, but will probably work. If it works,
-# we have accurate dependencies for our swig stuff, which is good.
+endif # end of GUILE
-@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_hier.d@am__quote@
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i
index e15a0059c..1856d5007 100644
--- a/gnuradio-core/src/lib/swig/gnuradio.i
+++ b/gnuradio-core/src/lib/swig/gnuradio.i
@@ -32,16 +32,35 @@
#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
#include <gr_types.h>
#include <stddef.h> // size_t
+#include <complex>
%}
%feature("autodoc","1");
+#ifdef SWIGGUILE
+// Export constants and enums as scheme variables, not functions.
+%feature("constasvar");
+#endif
+
// local file
%include <gr_shared_ptr.i>
// non-local SWIG files
-%include <stl.i>
+#ifdef SWIGGUILE // Local overrides to support complex
+// It's kind of screwy, but the target language subdir isn't
+// searched automatically except for under ./swig_lib which
+// doesn't really help us since we run swig in many directories
+%include <guile/std_complex.i>
+%include <guile/std_vector.i>
+%include <std_common.i>
+%include <std_string.i>
+%include <std_map.i>
+%include <std_pair.i>
+#else
%include <std_complex.i>
+%include <std_vector.i>
+%include <stl.i>
+#endif
%include <std_except.i>
typedef std::complex<float> gr_complex;
@@ -59,6 +78,7 @@ namespace std {
%template() vector<int>;
%template() vector<float>;
%template() vector<double>;
+ // %template() std::complex<float>;
%template() vector< std::complex<float> >;
%template() vector< std::vector< unsigned char > >;
@@ -72,15 +92,6 @@ namespace std {
////////////////////////////////////////////////////////////////////////
-%constant int sizeof_char = sizeof(char);
-%constant int sizeof_short = sizeof(short);
-%constant int sizeof_int = sizeof(int);
-%constant int sizeof_float = sizeof(float);
-%constant int sizeof_double = sizeof(double);
-%constant int sizeof_gr_complex = sizeof(gr_complex);
-
-////////////////////////////////////////////////////////////////////////
-
#ifndef SW_RUNTIME
// import runtime.i for all but sw_runtime, since it needs to %include
%import <runtime.i>
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_python.py b/gnuradio-core/src/lib/swig/gnuradio_core.py
index 5324b2309..172051013 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_python.py
+++ b/gnuradio-core/src/lib/swig/gnuradio_core.py
@@ -1,5 +1,5 @@
#
-# Copyright 2006,2009 Free Software Foundation, Inc.
+# Copyright 2006,2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,11 +18,11 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
-# This file implements the old gnuradio_swig_python namespace
+# This file implements the old gnuradio_core namespace
-from gnuradio_swig_py_runtime import *
-from gnuradio_swig_py_general import *
-from gnuradio_swig_py_gengen import *
-from gnuradio_swig_py_filter import *
-from gnuradio_swig_py_io import *
-from gnuradio_swig_py_hier import *
+from gnuradio_core_runtime import *
+from gnuradio_core_general import *
+from gnuradio_core_gengen import *
+from gnuradio_core_filter import *
+from gnuradio_core_io import *
+from gnuradio_core_hier import *
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
index 6396a97d0..e825467db 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
@@ -1,26 +1,26 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2009 Free Software Foundation, Inc.
- *
+ * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef SWIGIMPORTED
-%module(directors="1") gnuradio_swig_py_filter
+%module(directors="1") gnuradio_core_filter
#endif
//%feature("autodoc", "1"); // generate python docstrings
@@ -28,3 +28,13 @@
%include "gnuradio.i" // the common stuff
%include "filter.i"
+
+#if SWIGGUILE
+%scheme %{
+(load-extension-global "libguile-gnuradio-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
new file mode 100644
index 000000000..adf6b469a
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_general
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+%include "gnuradio.i" // the common stuff
+
+%include "general.i"
+
+ // Simple test case for complex input and output
+%inline
+%{
+ std::complex<float> complexf_add_2j(std::complex<float> x)
+ {
+ return std::complex<float>(x.real(), x.imag() + 2);
+ }
+
+ std::complex<double> complexd_add_2j(std::complex<double> x)
+ {
+ return std::complex<double>(x.real(), x.imag() + 2);
+ }
+
+ std::complex<float> complexf_add_x_2j(float x, std::complex<float> y)
+ {
+ return std::complex<float>(x + y.real(), y.imag() + 2);
+ }
+
+%}
+
+#if SWIGGUILE
+%scheme %{
+(load-extension-global "libguile-gnuradio-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module")
+%}
+
+%goops %{
+(use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
index 95e85cf6b..496ced077 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
@@ -1,26 +1,26 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2009 Free Software Foundation, Inc.
- *
+ * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef SWIGIMPORTED
-%module(directors="1") gnuradio_swig_py_gengen
+%module(directors="1") gnuradio_core_gengen
#endif
//%feature("autodoc", "1"); // generate python docstrings
@@ -28,3 +28,13 @@
%include "gnuradio.i" // the common stuff
%include "gengen.i"
+
+#if SWIGGUILE
+%scheme %{
+(load-extension-global "libguile-gnuradio-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
index a82b5ae41..0b8161c5d 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_hier.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
@@ -1,26 +1,26 @@
/* -*- c++ -*- */
/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
+ * Copyright 2009,2010 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef SWIGIMPORTED
-%module(directors="1") gnuradio_swig_py_hier
+%module(directors="1") gnuradio_hier_hier
#endif
//%feature("autodoc", "1"); // generate python docstrings
@@ -28,3 +28,13 @@
%include "gnuradio.i" // the common stuff
%include "hier.i"
+
+#if SWIGGUILE
+%scheme %{
+(load-extension-global "libguile-gnuradio-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i
index 9318f5d86..0d989ea87 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i
@@ -1,26 +1,26 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2009 Free Software Foundation, Inc.
- *
+ * Copyright 2006,2009,2010 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef SWIGIMPORTED
-%module(directors="1") gnuradio_swig_py_io
+%module(directors="1") gnuradio_core_io
#endif
//%feature("autodoc", "1"); // generate python docstrings
@@ -28,3 +28,13 @@
%include "gnuradio.i" // the common stuff
%include "io.i"
+
+#if SWIGGUILE
+%scheme %{
+(load-extension-global "libguile-gnuradio-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
new file mode 100644
index 000000000..579c51ce5
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010 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.
+ */
+
+#ifndef SWIGIMPORTED
+%module(directors="1") gnuradio_core_runtime
+#endif
+
+ //%feature("autodoc", "1"); // generate python docstrings
+
+#define SW_RUNTIME
+%include "gnuradio.i" // the common stuff
+
+%include "runtime.i"
+
+
+#if SWIGGUILE
+%scheme %{
+
+;; Load our gsubr that loads libraries using the RTLD_GLOBAL option
+(load-extension "libguile-gnuradio-dynl-global" "scm_init_gnuradio_dynl_global_module")
+
+;; Define load-extension-global in module '(guile)
+(module-define! (resolve-module '(guile))
+ 'load-extension-global
+ (lambda (lib init)
+ (dynamic-call init (dynamic-link-global lib))))
+
+;; Use load-extension-global to load our swig modules
+(load-extension-global "libguile-gnuradio-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module")
+%}
+
+%goops %{
+(use-modules (gnuradio export-safely))
+(re-export export-syms-if-not-imported-gf)
+(re-export-syntax export-safely)
+(re-export re-export-all)
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h b/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h
new file mode 100644
index 000000000..8f7eea0bf
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio_swig_bug_workaround.h
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
+#define INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H
+
+/*
+ * This include files works around a bug in SWIG 1.3.21 and 22
+ * where it fails to emit these declarations when doing
+ * %import "gnuradio.i"
+ */
+
+class gr_base_error_handler;
+class gr_basic_block;
+class gr_block;
+class gr_error_handler;
+class gr_file_error_handler;
+class gr_hier_block2;
+class gr_msg_handler;
+class gr_msg_queue;
+class gr_sync_block;
+class gr_sync_decimator;
+class gr_sync_interpolator;
+class gr_top_block;
+
+#endif /* INCLUDED_GNURADIO_SWIG_BUG_WORKAROUND_H */
diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
index 78e838012..a080c2b27 100644
--- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
+++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,19 +21,40 @@
*/
%define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME)
-_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, PKG ## _ ## BASE_NAME, BASE_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, PKG ## _ ## BASE_NAME)
%enddef
-%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME)
-class NAME;
-typedef boost::shared_ptr<NAME> NAME ## _sptr;
-%template(NAME ## _sptr) boost::shared_ptr<NAME>;
+%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+class FULL_NAME;
+typedef boost::shared_ptr<FULL_NAME> FULL_NAME ## _sptr;
+%template(FULL_NAME ## _sptr) boost::shared_ptr<FULL_NAME>;
%rename(BASE_NAME) PKG ## _make_ ## BASE_NAME;
+%ignore FULL_NAME;
+%enddef
+#ifdef SWIGPYTHON
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
%pythoncode %{
-NAME ## _sptr.block = lambda self: NAME ## _block (self)
-NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
+FULL_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
%}
+%enddef
+#endif
-%ignore NAME;
+#ifdef SWIGGUILE
+#ifdef IN_GNURADIO_CORE // normal behavior
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+/* FIXME May want to add something here to get a friendlier printed representation */
+%enddef
+#else // Don't strip PKG from name
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+class FULL_NAME;
+typedef boost::shared_ptr<FULL_NAME> FULL_NAME ## _sptr;
+%template(FULL_NAME ## _sptr) boost::shared_ptr<FULL_NAME>;
+%ignore FULL_NAME;
+%rename(FULL_NAME) PKG ## _make_ ## BASE_NAME;
+/* FIXME May want to add something here to get a friendlier printed representation */
%enddef
+#endif
+#endif
diff --git a/gnuradio-core/src/lib/swig/guile/std_complex.i b/gnuradio-core/src/lib/swig/guile/std_complex.i
new file mode 100644
index 000000000..2a5c72aa2
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/guile/std_complex.i
@@ -0,0 +1,37 @@
+%{
+#include <complex>
+%}
+
+// To the target language, complex number conversion
+%typemap(out) complex, complex<double>, std::complex<double> {
+ $result = scm_make_rectangular( gh_double2scm ($1.real ()),
+ gh_double2scm ($1.imag ()) );
+}
+
+// To the target language, complex number conversion
+%typemap(out) complex, complex<float>, std::complex<float> {
+ $result = scm_make_rectangular( gh_double2scm ($1.real ()),
+ gh_double2scm ($1.imag ()) );
+}
+
+// From the target language, complex number conversion
+%typemap(in) complex, complex<double>, std::complex<double> {
+ $1 = std::complex<double>( gh_scm2double (scm_real_part ($input)),
+ gh_scm2double (scm_imag_part ($input)) );
+}
+
+// From the target language, complex number conversion
+%typemap(in) complex, complex<float>, std::complex<float> {
+ $1 = std::complex<float>( gh_scm2double (scm_real_part ($input)),
+ gh_scm2double (scm_imag_part ($input)) );
+}
+
+%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>);
+%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
+
+%typecheck(SWIG_TYPECHECK_COMPLEX)
+ std::complex<float>, std::complex<double>,
+ const std::complex<float> &, const std::complex<double> &
+{
+ $1 = scm_is_complex($input) ? 1 : 0;
+}
diff --git a/gnuradio-core/src/lib/swig/guile/std_vector.i b/gnuradio-core/src/lib/swig/guile/std_vector.i
new file mode 100644
index 000000000..ef1f20667
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/guile/std_vector.i
@@ -0,0 +1,437 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_vector.i
+ *
+ * SWIG typemaps for std::vector
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::vector
+//
+// The aim of all that follows would be to integrate std::vector with
+// Guile as much as possible, namely, to allow the user to pass and
+// be returned Guile vectors or lists.
+// const declarations are used to guess the intent of the function being
+// exported; therefore, the following rationale is applied:
+//
+// -- f(std::vector<T>), f(const std::vector<T>&), f(const std::vector<T>*):
+// the parameter being read-only, either a Guile sequence or a
+// previously wrapped std::vector<T> can be passed.
+// -- f(std::vector<T>&), f(std::vector<T>*):
+// the parameter must be modified; therefore, only a wrapped std::vector
+// can be passed.
+// -- std::vector<T> f():
+// the vector is returned by copy; therefore, a Guile vector of T:s
+// is returned which is most easily used in other Guile functions
+// -- std::vector<T>& f(), std::vector<T>* f(), const std::vector<T>& f(),
+// const std::vector<T>* f():
+// the vector is returned by reference; therefore, a wrapped std::vector
+// is returned
+// ------------------------------------------------------------------------
+
+%{
+#include <vector>
+#include <algorithm>
+#include <stdexcept>
+#include <complex>
+%}
+
+%{
+ inline std::complex<float> SWIG_scm2cmplxfloat(SCM x){
+ return std::complex<float>(scm_c_real_part(x), scm_c_imag_part(x));
+ }
+
+ inline std::complex<double> SWIG_scm2cmplxdouble(SCM x){
+ return std::complex<double>(scm_c_real_part(x), scm_c_imag_part(x));
+ }
+
+ inline SCM SWIG_cmplxfloat2scm(std::complex<float> x){
+ return scm_c_make_rectangular(x.real(), x.imag());
+ }
+
+ inline SCM SWIG_cmplxdouble2scm(std::complex<double> x){
+ return scm_c_make_rectangular(x.real(), x.imag());
+ }
+%}
+
+// exported class
+
+namespace std {
+
+ template<class T> class vector {
+ %typemap(in) vector<T> {
+ if (gh_vector_p($input)) {
+ unsigned long size = gh_vector_length($input);
+ $1 = std::vector<T >(size);
+ for (unsigned long i=0; i<size; i++) {
+ SCM o = gh_vector_ref($input,gh_ulong2scm(i));
+ (($1_type &)$1)[i] =
+ *((T*) SWIG_MustGetPtr(o,$descriptor(T *),$argnum, 0));
+ }
+ } else if (gh_null_p($input)) {
+ $1 = std::vector<T >();
+ } else if (gh_pair_p($input)) {
+ SCM head, tail;
+ $1 = std::vector<T >();
+ tail = $input;
+ while (!gh_null_p(tail)) {
+ head = gh_car(tail);
+ tail = gh_cdr(tail);
+ $1.push_back(*((T*)SWIG_MustGetPtr(head,
+ $descriptor(T *),
+ $argnum, 0)));
+ }
+ } else {
+ $1 = *(($&1_type)
+ SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
+ }
+ }
+ %typemap(in) const vector<T>& (std::vector<T> temp),
+ const vector<T>* (std::vector<T> temp) {
+ if (gh_vector_p($input)) {
+ unsigned long size = gh_vector_length($input);
+ temp = std::vector<T >(size);
+ $1 = &temp;
+ for (unsigned long i=0; i<size; i++) {
+ SCM o = gh_vector_ref($input,gh_ulong2scm(i));
+ temp[i] = *((T*) SWIG_MustGetPtr(o,
+ $descriptor(T *),
+ $argnum, 0));
+ }
+ } else if (gh_null_p($input)) {
+ temp = std::vector<T >();
+ $1 = &temp;
+ } else if (gh_pair_p($input)) {
+ temp = std::vector<T >();
+ $1 = &temp;
+ SCM head, tail;
+ tail = $input;
+ while (!gh_null_p(tail)) {
+ head = gh_car(tail);
+ tail = gh_cdr(tail);
+ temp.push_back(*((T*) SWIG_MustGetPtr(head,
+ $descriptor(T *),
+ $argnum, 0)));
+ }
+ } else {
+ $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
+ }
+ }
+ %typemap(out) vector<T> {
+ $result = gh_make_vector(gh_long2scm($1.size()),SCM_UNSPECIFIED);
+ for (unsigned int i=0; i<$1.size(); i++) {
+ T* x = new T((($1_type &)$1)[i]);
+ gh_vector_set_x($result,gh_long2scm(i),
+ SWIG_NewPointerObj(x, $descriptor(T *), 1));
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> {
+ /* native sequence? */
+ if (gh_vector_p($input)) {
+ unsigned int size = gh_vector_length($input);
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ SCM o = gh_vector_ref($input,gh_ulong2scm(0));
+ T* x;
+ if (SWIG_ConvertPtr(o,(void**) &x,
+ $descriptor(T *), 0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else if (gh_null_p($input)) {
+ /* again, an empty sequence can be of any type */
+ $1 = 1;
+ } else if (gh_pair_p($input)) {
+ /* check the first element only */
+ T* x;
+ SCM head = gh_car($input);
+ if (SWIG_ConvertPtr(head,(void**) &x,
+ $descriptor(T *), 0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ } else {
+ /* wrapped vector? */
+ std::vector<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor, 0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T>&,
+ const vector<T>* {
+ /* native sequence? */
+ if (gh_vector_p($input)) {
+ unsigned int size = gh_vector_length($input);
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ SCM o = gh_vector_ref($input,gh_ulong2scm(0));
+ if (SWIG_ConvertPtr(o,(void**) &x,
+ $descriptor(T *), 0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ } else if (gh_null_p($input)) {
+ /* again, an empty sequence can be of any type */
+ $1 = 1;
+ } else if (gh_pair_p($input)) {
+ /* check the first element only */
+ T* x;
+ SCM head = gh_car($input);
+ if (SWIG_ConvertPtr(head,(void**) &x,
+ $descriptor(T *), 0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ } else {
+ /* wrapped vector? */
+ std::vector<T >* v;
+ if (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor, 0) != -1)
+ $1 = 1;
+ else
+ $1 = 0;
+ }
+ }
+ public:
+ vector(unsigned int size = 0);
+ vector(unsigned int size, const T& value);
+ vector(const vector<T>&);
+ %rename(length) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ %rename("clear!") clear;
+ void clear();
+ %rename("set!") set;
+ %rename("pop!") pop;
+ %rename("push!") push_back;
+ void push_back(const T& x);
+ %extend {
+ T pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty vector");
+ T x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T& ref(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ void set(int i, const T& x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+ };
+
+
+ // specializations for built-ins
+ %define specialize_stl_vector(T,CHECK,CONVERT_FROM,CONVERT_TO)
+ template<> class vector<T > {
+ %typemap(in) vector<T > {
+ if (gh_vector_p($input)) {
+ unsigned long size = gh_vector_length($input);
+ $1 = std::vector<T >(size);
+ for (unsigned long i=0; i<size; i++) {
+ SCM o = gh_vector_ref($input,gh_ulong2scm(i));
+ if (CHECK(o))
+ (($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
+ else
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ } else if (gh_null_p($input)) {
+ $1 = std::vector<T >();
+ } else if (gh_pair_p($input)) {
+ SCM v = gh_list_to_vector($input);
+ unsigned long size = gh_vector_length(v);
+ $1 = std::vector<T >(size);
+ for (unsigned long i=0; i<size; i++) {
+ SCM o = gh_vector_ref(v,gh_ulong2scm(i));
+ if (CHECK(o))
+ (($1_type &)$1)[i] = (T)(CONVERT_FROM(o));
+ else
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ } else {
+ $1 = *(($&1_type)
+ SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
+ }
+ }
+ %typemap(in) const vector<T >& (std::vector<T > temp),
+ const vector<T >* (std::vector<T > temp) {
+ if (gh_vector_p($input)) {
+ unsigned long size = gh_vector_length($input);
+ temp = std::vector<T >(size);
+ $1 = &temp;
+ for (unsigned long i=0; i<size; i++) {
+ SCM o = gh_vector_ref($input,gh_ulong2scm(i));
+ if (CHECK(o))
+ temp[i] = (T)(CONVERT_FROM(o));
+ else
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ } else if (gh_null_p($input)) {
+ temp = std::vector<T >();
+ $1 = &temp;
+ } else if (gh_pair_p($input)) {
+ SCM v = gh_list_to_vector($input);
+ unsigned long size = gh_vector_length(v);
+ temp = std::vector<T >(size);
+ $1 = &temp;
+ for (unsigned long i=0; i<size; i++) {
+ SCM o = gh_vector_ref(v,gh_ulong2scm(i));
+ if (CHECK(o))
+ temp[i] = (T)(CONVERT_FROM(o));
+ else
+ scm_wrong_type_arg(FUNC_NAME, $argnum, $input);
+ }
+ } else {
+ $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
+ }
+ }
+ %typemap(out) vector<T > {
+ $result = gh_make_vector(gh_long2scm($1.size()),SCM_UNSPECIFIED);
+ for (unsigned int i=0; i<$1.size(); i++) {
+ SCM x = CONVERT_TO((($1_type &)$1)[i]);
+ gh_vector_set_x($result,gh_long2scm(i),x);
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) vector<T > {
+ /* native sequence? */
+ if (gh_vector_p($input)) {
+ unsigned int size = gh_vector_length($input);
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ SCM o = gh_vector_ref($input,gh_ulong2scm(0));
+ $1 = CHECK(o) ? 1 : 0;
+ }
+ } else if (gh_null_p($input)) {
+ /* again, an empty sequence can be of any type */
+ $1 = 1;
+ } else if (gh_pair_p($input)) {
+ /* check the first element only */
+ T* x;
+ SCM head = gh_car($input);
+ $1 = CHECK(head) ? 1 : 0;
+ } else {
+ /* wrapped vector? */
+ std::vector<T >* v;
+ $1 = (SWIG_ConvertPtr($input,(void **) &v,
+ $&1_descriptor, 0) != -1) ? 1 : 0;
+ }
+ }
+ %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T >&,
+ const vector<T >* {
+ /* native sequence? */
+ if (gh_vector_p($input)) {
+ unsigned int size = gh_vector_length($input);
+ if (size == 0) {
+ /* an empty sequence can be of any type */
+ $1 = 1;
+ } else {
+ /* check the first element only */
+ T* x;
+ SCM o = gh_vector_ref($input,gh_ulong2scm(0));
+ $1 = CHECK(o) ? 1 : 0;
+ }
+ } else if (gh_null_p($input)) {
+ /* again, an empty sequence can be of any type */
+ $1 = 1;
+ } else if (gh_pair_p($input)) {
+ /* check the first element only */
+ T* x;
+ SCM head = gh_car($input);
+ $1 = CHECK(head) ? 1 : 0;
+ } else {
+ /* wrapped vector? */
+ std::vector<T >* v;
+ $1 = (SWIG_ConvertPtr($input,(void **) &v,
+ $1_descriptor, 0) != -1) ? 1 : 0;
+ }
+ }
+ public:
+ vector(unsigned int size = 0);
+ vector(unsigned int size, const T& value);
+ vector(const vector<T >&);
+ %rename(length) size;
+ unsigned int size() const;
+ %rename("empty?") empty;
+ bool empty() const;
+ %rename("clear!") clear;
+ void clear();
+ %rename("set!") set;
+ %rename("pop!") pop;
+ %rename("push!") push_back;
+ void push_back(T x);
+ %extend {
+ T pop() throw (std::out_of_range) {
+ if (self->size() == 0)
+ throw std::out_of_range("pop from empty vector");
+ T x = self->back();
+ self->pop_back();
+ return x;
+ }
+ T ref(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ void set(int i, T x) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ (*self)[i] = x;
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+ };
+ %enddef
+
+ specialize_stl_vector(bool,gh_boolean_p,gh_scm2bool,SWIG_bool2scm);
+ specialize_stl_vector(char,gh_number_p,gh_scm2long,gh_long2scm);
+ specialize_stl_vector(int,gh_number_p,gh_scm2long,gh_long2scm);
+ specialize_stl_vector(long,gh_number_p,gh_scm2long,gh_long2scm);
+ specialize_stl_vector(short,gh_number_p,gh_scm2long,gh_long2scm);
+ specialize_stl_vector(unsigned char,gh_number_p,gh_scm2ulong,gh_ulong2scm);
+ specialize_stl_vector(unsigned int,gh_number_p,gh_scm2ulong,gh_ulong2scm);
+ specialize_stl_vector(unsigned long,gh_number_p,gh_scm2ulong,gh_ulong2scm);
+ specialize_stl_vector(unsigned short,gh_number_p,gh_scm2ulong,gh_ulong2scm);
+ specialize_stl_vector(float,gh_number_p,gh_scm2double,gh_double2scm);
+ specialize_stl_vector(double,gh_number_p,gh_scm2double,gh_double2scm);
+ specialize_stl_vector(std::string,gh_string_p,SWIG_scm2string,SWIG_string2scm);
+ specialize_stl_vector(std::complex<float>, scm_is_complex,
+ SWIG_scm2cmplxfloat, SWIG_cmplxfloat2scm);
+ specialize_stl_vector(std::complex<double>, scm_is_complex,
+ SWIG_scm2cmplxdouble,SWIG_cmplxdouble2scm);
+
+}
+