diff options
author | Andrej Rode <mail@andrejro.de> | 2018-12-29 12:23:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-29 12:23:49 +0100 |
commit | a834730cab8087877801adcdef716e443c21ee54 (patch) | |
tree | 5c2745ca0aaa743038cb3d7b446735dec55128d0 | |
parent | c35fdf1b64bd2556ff827d25312c4daeeb31aa95 (diff) | |
parent | c938d168478efbe59a1f54cbf3e10afe54a307b3 (diff) |
Merge the polished results from the 2017 GSoC "C++ Code Generation with GRC"
Flowgraphs with basic blocks can be created in the GNU Radio Companion and exported to a single C++ binary.
The use of the C++ generation is still experimental and needs testing and extension to more parts of the GNU Radio codebase.
216 files changed, 2701 insertions, 28 deletions
diff --git a/gr-analog/grc/analog_agc2_xx.block.yml b/gr-analog/grc/analog_agc2_xx.block.yml index 93990b5c3b..5594d448de 100644 --- a/gr-analog/grc/analog_agc2_xx.block.yml +++ b/gr-analog/grc/analog_agc2_xx.block.yml @@ -1,5 +1,6 @@ id: analog_agc2_xx label: AGC2 +flags: [ python, cpp ] parameters: - id: type @@ -50,4 +51,18 @@ templates: - set_gain(${gain}) - set_max_gain(${max_gain}) +cpp_templates: + includes: ['#include <gnuradio/analog/agc2_${type.fcn}.h>'] + declarations: 'analog::agc2_${type.fcn}::sptr ${id};' + make: |- + this->${id} = analog::agc2_${type.fcn}::make(${attack_rate}, ${decay_rate}, ${reference}, ${gain}); + this->${id}.set_max_gain(${max_gain}); + callbacks: + - set_attack_rate(${attack_rate}) + - set_decay_rate(${decay_rate}) + - set_reference(${reference}) + - set_gain(${gain}) + - set_max_gain(${max_gain}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_agc3_xx.block.yml b/gr-analog/grc/analog_agc3_xx.block.yml index 17a03f6771..272515f45d 100644 --- a/gr-analog/grc/analog_agc3_xx.block.yml +++ b/gr-analog/grc/analog_agc3_xx.block.yml @@ -1,5 +1,6 @@ id: analog_agc3_xx label: AGC3 +flags: [ python, cpp ] parameters: - id: type @@ -54,4 +55,18 @@ templates: - set_gain(${gain}) - set_max_gain(${max_gain}) +cpp_templates: + includes: ['#include <gnuradio/analog/agc3_${type.fcn}.h>'] + declarations: 'analog::agc3_${type.fcn}::sptr ${id};' + make: |- + this->${id} = analog::agc3_${type.fcn}::make(${attack_rate}, ${decay_rate}, ${reference}, ${gain}, ${iir_update_decim}); + this->${id}.set_max_gain(${max_gain}); + callbacks: + - set_attack_rate(${attack_rate}) + - set_decay_rate(${decay_rate}) + - set_reference(${reference}) + - set_gain(${gain}) + - set_max_gain(${max_gain}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_agc_xx.block.yml b/gr-analog/grc/analog_agc_xx.block.yml index 52ef26f79f..d1e21faa98 100644 --- a/gr-analog/grc/analog_agc_xx.block.yml +++ b/gr-analog/grc/analog_agc_xx.block.yml @@ -1,5 +1,6 @@ id: analog_agc_xx label: AGC +flags: [ python, cpp ] parameters: - id: type @@ -45,4 +46,17 @@ templates: - set_gain(${gain}) - set_max_gain(${max_gain}) +cpp_templates: + includes: ['#include <gnuradio/analog/agc_${type.fcn}.h>'] + declarations: 'analog::agc_${type.fcn}::sptr ${id};' + make: |- + this->${id} = analog::agc_${type.fcn}::make(${rate}, ${reference}, ${gain}); + this->${id}.set_max_gain(${max_gain}); + callbacks: + - set_rate(${rate}) + - set_reference(${reference}) + - set_gain(${gain}) + - set_max_gain(${max_gain}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_am_demod_cf.block.yml b/gr-analog/grc/analog_am_demod_cf.block.yml index 8bc6cc1c31..d45252ab50 100644 --- a/gr-analog/grc/analog_am_demod_cf.block.yml +++ b/gr-analog/grc/analog_am_demod_cf.block.yml @@ -1,5 +1,6 @@ id: analog_am_demod_cf label: AM Demod +flags: [ python ] parameters: - id: chan_rate diff --git a/gr-analog/grc/analog_const_source_x.block.yml b/gr-analog/grc/analog_const_source_x.block.yml index ac676b7ac4..ccabfdabc8 100644 --- a/gr-analog/grc/analog_const_source_x.block.yml +++ b/gr-analog/grc/analog_const_source_x.block.yml @@ -1,5 +1,6 @@ id: analog_const_source_x label: Constant Source +flags: [ python, cpp ] parameters: - id: type @@ -25,4 +26,11 @@ templates: callbacks: - set_offset(${const}) +cpp_templates: + includes: ['#include <gnuradio/analog/sig_source_${type.fcn}.h>'] + make: 'this->${id} = analog::sig_source_${type.fcn}::make(0, analog::GR_CONST_WAVE, 0, 0, ${const});' + callbacks: + - set_offset(${const}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_cpfsk_bc.block.yml b/gr-analog/grc/analog_cpfsk_bc.block.yml index c9ccbaac27..d661caa62a 100644 --- a/gr-analog/grc/analog_cpfsk_bc.block.yml +++ b/gr-analog/grc/analog_cpfsk_bc.block.yml @@ -1,6 +1,7 @@ id: analog_cpfsk_bc label: CPFSK category: '[Core]/Deprecated' +flags: [ python, cpp ] parameters: - id: k @@ -28,4 +29,12 @@ templates: callbacks: - set_amplitude(${amplitude}) +cpp_templates: + includes: ['#include <gnuradio/analog/cpfsk_bc.h>'] + make: 'this->${id} = analog::cpfsk_bc::make(${k}, ${amplitude}, ${samples_per_symbol});' + callbacks: + - set_amplitude(${amplitude}) + link: ['gnuradio-analog'] + + file_format: 1 diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.block.yml b/gr-analog/grc/analog_ctcss_squelch_ff.block.yml index a3dd89f1f6..9a85d18907 100644 --- a/gr-analog/grc/analog_ctcss_squelch_ff.block.yml +++ b/gr-analog/grc/analog_ctcss_squelch_ff.block.yml @@ -1,5 +1,6 @@ id: analog_ctcss_squelch_ff label: CTCSS Squelch +flags: [ python, cpp ] parameters: - id: rate @@ -42,4 +43,15 @@ templates: - set_level(${level}) - set_frequency(${freq}) +cpp_templates: + includes: ['#include <gnuradio/analog/ctcss_squelch_ff.h>'] + make: 'this->${id} = analog::ctcss_squelch_ff::make(${rate}, ${freq}, ${level}, ${len}, ${ramp}, ${gate});' + callbacks: + - set_level(${level}) + - set_frequency(${freq}) + link: ['gnuradio-analog'] + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-analog/grc/analog_dpll_bb.block.yml b/gr-analog/grc/analog_dpll_bb.block.yml index 289f3a283d..aaafc3444b 100644 --- a/gr-analog/grc/analog_dpll_bb.block.yml +++ b/gr-analog/grc/analog_dpll_bb.block.yml @@ -1,5 +1,6 @@ id: analog_dpll_bb label: Detect Peak +flags: [ python, cpp ] parameters: - id: period @@ -23,4 +24,11 @@ templates: callbacks: - set_gain(${gain}) +cpp_templates: + includes: ['#include <gnuradio/analog/dpll_bb.h>'] + make: 'this->${id} = analog::dpll_bb::make(${period}, ${gain});' + callbacks: + - set_gain(${gain}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_fastnoise_source_x.block.yml b/gr-analog/grc/analog_fastnoise_source_x.block.yml index 21c4366074..7b51463339 100644 --- a/gr-analog/grc/analog_fastnoise_source_x.block.yml +++ b/gr-analog/grc/analog_fastnoise_source_x.block.yml @@ -1,5 +1,6 @@ id: analog_fastnoise_source_x label: Fast Noise Source +flags: [ python, cpp ] parameters: - id: type @@ -39,6 +40,16 @@ templates: - set_type(${noise_type}) - set_amplitude(${amp}) +cpp_templates: + includes: ['#include <gnuradio/analog/fastnoise_source.h>'] + make: 'this->${id} = analog::fastnoise_source_${type.fcn}::make(${noise_type}, ${amp}, ${seed}, ${samples});' + callbacks: + - set_type(${noise_type}) + - set_amplitude(${amp}) + link: ['gnuradio-analog'] + translations: + analog.: 'analog::' + documentation: |- The fast noise source works by pre-generating a pool of random variates taken from the specified distribution. At runtime, samples are then uniform randomly chosen from this pool which is a very fast operation. diff --git a/gr-analog/grc/analog_feedforward_agc_cc.block.yml b/gr-analog/grc/analog_feedforward_agc_cc.block.yml index fd49a654a8..fa0afbdc03 100644 --- a/gr-analog/grc/analog_feedforward_agc_cc.block.yml +++ b/gr-analog/grc/analog_feedforward_agc_cc.block.yml @@ -1,5 +1,6 @@ id: analog_feedforward_agc_cc label: Feed Forward AGC +flags: [ python, cpp ] parameters: - id: num_samples @@ -23,4 +24,9 @@ templates: imports: from gnuradio import analog make: analog.feedforward_agc_cc(${num_samples}, ${reference}) +cpp_templates: + includes: ['#include <gnuradio/analog/feedforward_agc_cc.h>'] + make: 'this->${id} = analog::feedforward_agc_cc::make(${num_samples}, ${reference});' + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_fm_deemph.block.yml b/gr-analog/grc/analog_fm_deemph.block.yml index b9c11a6842..3abc038b1f 100644 --- a/gr-analog/grc/analog_fm_deemph.block.yml +++ b/gr-analog/grc/analog_fm_deemph.block.yml @@ -1,5 +1,6 @@ id: analog_fm_deemph label: FM Deemphasis +flags: [ python ] parameters: - id: samp_rate diff --git a/gr-analog/grc/analog_fm_demod_cf.block.yml b/gr-analog/grc/analog_fm_demod_cf.block.yml index a558253a2c..9e4df5b831 100644 --- a/gr-analog/grc/analog_fm_demod_cf.block.yml +++ b/gr-analog/grc/analog_fm_demod_cf.block.yml @@ -1,5 +1,6 @@ id: analog_fm_demod_cf label: FM Demod +flags: [ python ] parameters: - id: chan_rate diff --git a/gr-analog/grc/analog_fm_preemph.block.yml b/gr-analog/grc/analog_fm_preemph.block.yml index d3f05d3164..5244625f7a 100644 --- a/gr-analog/grc/analog_fm_preemph.block.yml +++ b/gr-analog/grc/analog_fm_preemph.block.yml @@ -1,5 +1,6 @@ id: analog_fm_preemph label: FM Preemphasis +flags: [ python ] parameters: - id: samp_rate diff --git a/gr-analog/grc/analog_fmdet_cf.block.yml b/gr-analog/grc/analog_fmdet_cf.block.yml index ee8661b80f..c5208de58d 100644 --- a/gr-analog/grc/analog_fmdet_cf.block.yml +++ b/gr-analog/grc/analog_fmdet_cf.block.yml @@ -1,5 +1,6 @@ id: analog_fmdet_cf label: FM Detector +flags: [ python ] parameters: - id: samplerate diff --git a/gr-analog/grc/analog_frequency_modulator_fc.block.yml b/gr-analog/grc/analog_frequency_modulator_fc.block.yml index 09f3e807f3..40c8172c21 100644 --- a/gr-analog/grc/analog_frequency_modulator_fc.block.yml +++ b/gr-analog/grc/analog_frequency_modulator_fc.block.yml @@ -1,5 +1,6 @@ id: analog_frequency_modulator_fc label: Frequency Mod +flags: [ python, cpp ] parameters: - id: sensitivity @@ -20,4 +21,11 @@ templates: callbacks: - set_sensitivity(${sensitivity}) +cpp_templates: + includes: ['#include <gnuradio/analog/frequency_modulator_fc.h>'] + make: 'this->${id} = analog::frequency_modulator_fc::make(${sensitivity});' + callbacks: + - set_sensitivity(${sensitivity}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_nbfm_rx.block.yml b/gr-analog/grc/analog_nbfm_rx.block.yml index 8bb3da7684..1f89c6f72f 100644 --- a/gr-analog/grc/analog_nbfm_rx.block.yml +++ b/gr-analog/grc/analog_nbfm_rx.block.yml @@ -1,5 +1,6 @@ id: analog_nbfm_rx label: NBFM Receive +flags: [ python ] parameters: - id: audio_rate diff --git a/gr-analog/grc/analog_nbfm_tx.block.yml b/gr-analog/grc/analog_nbfm_tx.block.yml index 00f63f8d64..121ae29d00 100644 --- a/gr-analog/grc/analog_nbfm_tx.block.yml +++ b/gr-analog/grc/analog_nbfm_tx.block.yml @@ -1,5 +1,6 @@ id: analog_nbfm_tx label: NBFM Transmit +flags: [ python ] parameters: - id: audio_rate diff --git a/gr-analog/grc/analog_noise_source_x.block.yml b/gr-analog/grc/analog_noise_source_x.block.yml index bb3f67209e..ba66b71426 100644 --- a/gr-analog/grc/analog_noise_source_x.block.yml +++ b/gr-analog/grc/analog_noise_source_x.block.yml @@ -1,5 +1,6 @@ id: analog_noise_source_x label: Noise Source +flags: [ python, cpp ] parameters: - id: type @@ -35,4 +36,14 @@ templates: - set_type(${noise_type}) - set_amplitude(${amp}) +cpp_templates: + includes: ['#include <gnuradio/analog/noise_source.h>'] + make: 'this->${id} = analog::noise_source_${type.fcn}::make(${noise_type}, ${amp}, ${seed});' + callbacks: + - set_type(${noise_type}) + - set_amplitude(${amp}) + link: ['gnuradio-analog'] + translations: + analog.: 'analog::' + file_format: 1 diff --git a/gr-analog/grc/analog_phase_modulator_fc.block.yml b/gr-analog/grc/analog_phase_modulator_fc.block.yml index 6d38ddd010..06342c88d9 100644 --- a/gr-analog/grc/analog_phase_modulator_fc.block.yml +++ b/gr-analog/grc/analog_phase_modulator_fc.block.yml @@ -1,5 +1,6 @@ id: analog_phase_modulator_fc label: Phase Mod +flags: [ python, cpp ] parameters: - id: sensitivity @@ -20,4 +21,11 @@ templates: callbacks: - set_sensitivity(${sensitivity}) +cpp_templates: + includes: ['#include <gnuradio/analog/phase_modulator_fc.h>'] + make: 'this->${id} = analog::phase_modulator_fc::make(${sensitivity});' + link: ['gnuradio-analog'] + callbacks: + - set_sensitivity(${sensitivity}) + file_format: 1 diff --git a/gr-analog/grc/analog_pll_carriertracking_cc.block.yml b/gr-analog/grc/analog_pll_carriertracking_cc.block.yml index 1a66aca0a7..1810d54c0b 100644 --- a/gr-analog/grc/analog_pll_carriertracking_cc.block.yml +++ b/gr-analog/grc/analog_pll_carriertracking_cc.block.yml @@ -1,5 +1,6 @@ id: analog_pll_carriertracking_cc label: PLL Carrier Tracking +flags: [ python, cpp ] parameters: - id: w @@ -28,4 +29,13 @@ templates: - set_max_freq(${max_freq}) - set_min_freq(${min_freq}) +cpp_templates: + includes: ['#include <gnuradio/analog/pll_carriertracking_${type.fcn}.h>'] + make: 'this->${id} = analog::pll_carriertracking_cc::make(${w}, ${max_freq}, ${min_freq});' + callbacks: + - set_loop_bandwidth(${w}) + - set_max_freq(${max_freq}) + - set_min_freq(${min_freq}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_pll_freqdet_cf.block.yml b/gr-analog/grc/analog_pll_freqdet_cf.block.yml index b9fe199dd2..95a9c60296 100644 --- a/gr-analog/grc/analog_pll_freqdet_cf.block.yml +++ b/gr-analog/grc/analog_pll_freqdet_cf.block.yml @@ -1,5 +1,6 @@ id: analog_pll_freqdet_cf label: PLL Freq Det +flags: [ python, cpp ] parameters: - id: w @@ -28,4 +29,14 @@ templates: - set_max_freq(${max_freq}) - set_min_freq(${min_freq}) +cpp_templates: + includes: ['#include <gnuradio/analog/pll_freqdet_cf.h>'] + make: 'this->${id} = analog::pll_freqdet_cf::make(${w}, ${max_freq}, ${min_freq});' + callbacks: + - set_loop_bandwidth(${w}) + - set_max_freq(${max_freq}) + - set_min_freq(${min_freq}) + link: ['gnuradio-analog'] + + file_format: 1 diff --git a/gr-analog/grc/analog_pll_refout_cc.block.yml b/gr-analog/grc/analog_pll_refout_cc.block.yml index 5acd85c3b6..984650c671 100644 --- a/gr-analog/grc/analog_pll_refout_cc.block.yml +++ b/gr-analog/grc/analog_pll_refout_cc.block.yml @@ -1,5 +1,6 @@ id: analog_pll_refout_cc label: PLL Ref Out +flags: [ python, cpp ] parameters: - id: w @@ -28,4 +29,13 @@ templates: - set_max_freq(${max_freq}) - set_min_freq(${min_freq}) +cpp_templates: + includes: ['#include <gnuradio/analog/pll_refout_cc.h>'] + make: 'this->${id} = analog::pll_refout_cc::make(${w}, ${max_freq}, ${min_freq});' + callbacks: + - set_loop_bandwidth(${w}) + - set_max_freq(${max_freq}) + - set_min_freq(${min_freq}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml index ad128c1521..c8c51f8412 100644 --- a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml +++ b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml @@ -1,5 +1,6 @@ id: analog_probe_avg_mag_sqrd_x label: Probe Avg Mag^2 +flags: [ python ] parameters: - id: type diff --git a/gr-analog/grc/analog_pwr_squelch_xx.block.yml b/gr-analog/grc/analog_pwr_squelch_xx.block.yml index 20bcfa923e..310b61d509 100644 --- a/gr-analog/grc/analog_pwr_squelch_xx.block.yml +++ b/gr-analog/grc/analog_pwr_squelch_xx.block.yml @@ -1,5 +1,6 @@ id: analog_pwr_squelch_xx label: Power Squelch +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,15 @@ templates: - set_threshold(${threshold}) - set_alpha(${alpha}) +cpp_templates: + includes: ['#include <gnuradio/analog/pwr_squelch_${type.fcn}.h>'] + make: 'this->${id} = analog::pwr_squelch_${type.fcn}::make(${threshold}, ${alpha}, ${ramp}, ${gate});' + callbacks: + - set_threshold(${threshold}) + - set_alpha(${alpha}) + link: ['gnuradio-analog'] + translations: + True: true + False: false + file_format: 1 diff --git a/gr-analog/grc/analog_quadrature_demod_cf.block.yml b/gr-analog/grc/analog_quadrature_demod_cf.block.yml index 874b286c87..121a2a4bad 100644 --- a/gr-analog/grc/analog_quadrature_demod_cf.block.yml +++ b/gr-analog/grc/analog_quadrature_demod_cf.block.yml @@ -1,5 +1,6 @@ id: analog_quadrature_demod_cf label: Quadrature Demod +flags: [ python ] parameters: - id: gain diff --git a/gr-analog/grc/analog_rail_ff.block.yml b/gr-analog/grc/analog_rail_ff.block.yml index 8a2d2e8a54..45ad3634e5 100644 --- a/gr-analog/grc/analog_rail_ff.block.yml +++ b/gr-analog/grc/analog_rail_ff.block.yml @@ -1,5 +1,6 @@ id: analog_rail_ff label: Rail +flags: [ python, cpp ] parameters: - id: lo @@ -24,4 +25,12 @@ templates: - set_lo(${lo}) - set_hi(${hi}) +cpp_templates: + includes: ['#include <gnuradio/analog/rail_ff.h>'] + make: 'this->${id} = analog::rail_ff::make(${lo}, ${hi});' + callbacks: + - set_lo(${lo}) + - set_hi(${hi}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_random_source_x.block.yml b/gr-analog/grc/analog_random_source_x.block.yml index 20fb31932f..afe7d262ad 100644 --- a/gr-analog/grc/analog_random_source_x.block.yml +++ b/gr-analog/grc/analog_random_source_x.block.yml @@ -1,5 +1,6 @@ id: analog_random_source_x label: Random Source +flags: [ python ] parameters: - id: type @@ -43,9 +44,9 @@ documentation: |- Generate num samples of random numbers of [min, max). Repeat samples if specified. Ex: With min=0 and max=2, the sequence 01110101... will be generated. - + This block wraps Vector Source, i.e. it creates a vector source using a vector filled with values returned from calling np.random.randint(min, max, num_samps) once If you would like a traditional random number generator, use Random Uniform Source instead - + file_format: 1 diff --git a/gr-analog/grc/analog_random_uniform_source_x.block.yml b/gr-analog/grc/analog_random_uniform_source_x.block.yml index d76bc903a5..a601b3d882 100644 --- a/gr-analog/grc/analog_random_uniform_source_x.block.yml +++ b/gr-analog/grc/analog_random_uniform_source_x.block.yml @@ -1,5 +1,6 @@ id: analog_random_uniform_source_x label: Random Uniform Source +flags: [ python, cpp ] parameters: - id: type @@ -29,4 +30,9 @@ templates: imports: from gnuradio import analog make: analog.random_uniform_source_${type.fcn}(${minimum}, ${maximum}, ${seed}) +cpp_templates: + includes: ['#include <gnuradio/analog/random_uniform_source.h>'] + make: 'this->${id} = analog.random_uniform_source_${type.fcn}(${minimum}, ${maximum}, ${seed});' + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_sig_source_x.block.yml b/gr-analog/grc/analog_sig_source_x.block.yml index 2fbc853a9b..47160f722a 100644 --- a/gr-analog/grc/analog_sig_source_x.block.yml +++ b/gr-analog/grc/analog_sig_source_x.block.yml @@ -1,5 +1,6 @@ id: analog_sig_source_x label: Signal Source +flags: [ python, cpp ] parameters: - id: type @@ -54,4 +55,18 @@ templates: - set_amplitude(${amp}) - set_offset(${offset}) +cpp_templates: + includes: ['#include <gnuradio/analog/sig_source.h>'] + declarations: 'analog::sig_source_${type.fcn}::sptr ${id};' + make: 'this->${id} = analog::sig_source_${type.fcn}::make(${samp_rate}, ${waveform}, ${freq}, ${amp}, ${offset});' + callbacks: + - set_sampling_freq(${samp_rate}) + - set_waveform(${waveform}) + - set_frequency(${freq}) + - set_amplitude(${amp}) + - set_offset(${offset}) + link: ['gnuradio-analog'] + translations: + analog\.: 'analog::' + file_format: 1 diff --git a/gr-analog/grc/analog_simple_squelch_cc.block.yml b/gr-analog/grc/analog_simple_squelch_cc.block.yml index 17a98eb4ba..5cc4def99c 100644 --- a/gr-analog/grc/analog_simple_squelch_cc.block.yml +++ b/gr-analog/grc/analog_simple_squelch_cc.block.yml @@ -1,5 +1,6 @@ id: analog_simple_squelch_cc label: Simple Squelch +flags: [ python, cpp ] parameters: - id: threshold @@ -24,4 +25,12 @@ templates: - set_threshold(${threshold}) - set_alpha(${alpha}) +cpp_templates: + includes: ['#include <gnuradio/analog/simple_squelch_cc.h>'] + make: 'this->${id} = analog::simple_squelch_cc::make(${threshold}, ${alpha});' + callbacks: + - set_threshold(${threshold}) + - set_alpha(${alpha}) + link: ['gnuradio-analog'] + file_format: 1 diff --git a/gr-analog/grc/analog_standard_squelch.block.yml b/gr-analog/grc/analog_standard_squelch.block.yml index d753dfaf01..f51e245152 100644 --- a/gr-analog/grc/analog_standard_squelch.block.yml +++ b/gr-analog/grc/analog_standard_squelch.block.yml @@ -1,5 +1,6 @@ id: analog_standard_squelch label: Standard Squelch +flags: [ python ] parameters: - id: audio_rate diff --git a/gr-analog/grc/analog_wfm_rcv.block.yml b/gr-analog/grc/analog_wfm_rcv.block.yml index eb3a84893e..372dd54481 100644 --- a/gr-analog/grc/analog_wfm_rcv.block.yml +++ b/gr-analog/grc/analog_wfm_rcv.block.yml @@ -1,5 +1,6 @@ id: analog_wfm_rcv label: WBFM Receive +flags: [ python ] parameters: - id: quad_rate diff --git a/gr-analog/grc/analog_wfm_rcv_pll.block.yml b/gr-analog/grc/analog_wfm_rcv_pll.block.yml index e5e3d76ccc..4364ce8c70 100644 --- a/gr-analog/grc/analog_wfm_rcv_pll.block.yml +++ b/gr-analog/grc/analog_wfm_rcv_pll.block.yml @@ -1,5 +1,6 @@ id: analog_wfm_rcv_pll label: WBFM Receive PLL +flags: [ python ] parameters: - id: quad_rate diff --git a/gr-analog/grc/analog_wfm_tx.block.yml b/gr-analog/grc/analog_wfm_tx.block.yml index 1e4346c41d..d2c9f42363 100644 --- a/gr-analog/grc/analog_wfm_tx.block.yml +++ b/gr-analog/grc/analog_wfm_tx.block.yml @@ -1,5 +1,6 @@ id: analog_wfm_tx label: WBFM Transmit +flags: [ python ] parameters: - id: audio_rate diff --git a/gr-audio/grc/audio_sink.block.yml b/gr-audio/grc/audio_sink.block.yml index 98e2d6b249..83804c050c 100644 --- a/gr-audio/grc/audio_sink.block.yml +++ b/gr-audio/grc/audio_sink.block.yml @@ -1,7 +1,7 @@ id: audio_sink label: Audio Sink category: '[Core]/Audio' -flags: throttle +flags: [ throttle ] parameters: - id: samp_rate diff --git a/gr-audio/grc/audio_source.block.yml b/gr-audio/grc/audio_source.block.yml index 2daae9c8de..247e6d9bd7 100644 --- a/gr-audio/grc/audio_source.block.yml +++ b/gr-audio/grc/audio_source.block.yml @@ -1,7 +1,7 @@ id: audio_source label: Audio Source category: '[Core]/Audio' -flags: throttle +flags: [ throttle ] parameters: - id: samp_rate diff --git a/gr-blocks/grc/blocks_abs_xx.block.yml b/gr-blocks/grc/blocks_abs_xx.block.yml index 12d9a8fc3a..f78086352c 100644 --- a/gr-blocks/grc/blocks_abs_xx.block.yml +++ b/gr-blocks/grc/blocks_abs_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_abs_xx label: Abs +flags: [ python, cpp ] parameters: - id: vlen @@ -29,4 +30,9 @@ templates: imports: from gnuradio import blocks make: blocks.abs_${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/abs_blk.h>'] + declarations: 'blocks::abs_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::abs_${type.fcn}::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_add_const_vxx.block.yml b/gr-blocks/grc/blocks_add_const_vxx.block.yml index a3ce37b9b5..b42ea616d0 100644 --- a/gr-blocks/grc/blocks_add_const_vxx.block.yml +++ b/gr-blocks/grc/blocks_add_const_vxx.block.yml @@ -1,5 +1,6 @@ id: blocks_add_const_vxx label: Add Const +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,11 @@ templates: callbacks: - set_k(${const}) +cpp_templates: + includes: ['#include <gnuradio/blocks/add_const_${"v" if context.get("vlen")() > 1 else ""}.h>'] + declarations: 'blocks::add_const_${"v" if context.get("vlen")() > 1 else ""}${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::add_const_${"v" if context.get("vlen")() > 1 else ""}${type.fcn}::make(${const});' + callbacks: + - set_k(${const}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_add_xx.block.yml b/gr-blocks/grc/blocks_add_xx.block.yml index 38df37a65b..b9f5f76dc4 100644 --- a/gr-blocks/grc/blocks_add_xx.block.yml +++ b/gr-blocks/grc/blocks_add_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_add_xx label: Add +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,9 @@ templates: imports: from gnuradio import blocks make: blocks.add_v${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/add_blk.h>'] + declarations: 'blocks::add_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::add_${type.fcn}::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_and_const_xx.block.yml b/gr-blocks/grc/blocks_and_const_xx.block.yml index 459527260c..c6faf7c283 100644 --- a/gr-blocks/grc/blocks_and_const_xx.block.yml +++ b/gr-blocks/grc/blocks_and_const_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_and_const_xx label: And Const +flags: [ python, cpp ] parameters: - id: type @@ -28,4 +29,11 @@ templates: callbacks: - set_k(${const}) +cpp_templates: + includes: ['#include <gnuradio/blocks/and_const.h>'] + declarations: 'blocks::and_const_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::and_const_${type.fcn}::make(${const});' + callbacks: + - set_k(${const}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_and_xx.block.yml b/gr-blocks/grc/blocks_and_xx.block.yml index a8bba020a5..b8771648c8 100644 --- a/gr-blocks/grc/blocks_and_xx.block.yml +++ b/gr-blocks/grc/blocks_and_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_and_xx label: And +flags: [ python, cpp ] parameters: - id: type @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.and_${type.fcn}() +cpp_templates: + includes: ['#include <gnuradio/blocks/and_blk.h>'] + declarations: 'blocks::and_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::and_${type.fcn}::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_argmax_xx.block.yml b/gr-blocks/grc/blocks_argmax_xx.block.yml index 723f3fed6a..86acef1df3 100644 --- a/gr-blocks/grc/blocks_argmax_xx.block.yml +++ b/gr-blocks/grc/blocks_argmax_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_argmax_xx label: Argmax +flags: [ python, cpp ] parameters: - id: type @@ -42,4 +43,9 @@ templates: imports: from gnuradio import blocks make: blocks.argmax_${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/argmax.h>'] + declarations: 'blocks::argmax_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::argmax_${type.fcn}::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_burst_tagger.block.yml b/gr-blocks/grc/blocks_burst_tagger.block.yml index 02d4f74835..f20e1ea6ed 100644 --- a/gr-blocks/grc/blocks_burst_tagger.block.yml +++ b/gr-blocks/grc/blocks_burst_tagger.block.yml @@ -1,5 +1,6 @@ id: blocks_burst_tagger label: Burst Tagger +flags: [ python, cpp ] parameters: - id: type @@ -51,4 +52,17 @@ templates: - set_true_tag(${true_key},${true_value}) - set_false_tag(${false_key},${false_value}) +cpp_templates: + includes: ['#include <gnuradio/blocks/burst_tagger.h>'] + declarations: 'blocks::burst_tagger::sptr ${id};' + make: "this->${id} = blocks::burst_tagger::make(${type.size});\nthis->${id}.set_true_tag(${true_key},${true_value});\n\ + this->${id}.set_false_tag(${false_key},${false_value});\n\t" + callbacks: + - set_true_tag(${true_key},${true_value}) + - set_false_tag(${false_key},${false_value}) + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_char_to_float.block.yml b/gr-blocks/grc/blocks_char_to_float.block.yml index c0858b5c1d..e464b1e0b2 100644 --- a/gr-blocks/grc/blocks_char_to_float.block.yml +++ b/gr-blocks/grc/blocks_char_to_float.block.yml @@ -1,5 +1,6 @@ id: blocks_char_to_float label: Char To Float +flags: [ python, cpp ] parameters: - id: vlen @@ -28,4 +29,11 @@ templates: callbacks: - set_scale(${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/char_to_float.h>'] + declarations: 'blocks::char_to_float::sptr ${id};' + make: 'this->${id} = blocks::char_to_float::make(${vlen}, ${scale});' + callbacks: + - set_scale(${scale}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_char_to_short.block.yml b/gr-blocks/grc/blocks_char_to_short.block.yml index f378e87e72..b4d399f564 100644 --- a/gr-blocks/grc/blocks_char_to_short.block.yml +++ b/gr-blocks/grc/blocks_char_to_short.block.yml @@ -1,5 +1,6 @@ id: blocks_char_to_short label: Char To Short +flags: [ python, cpp ] parameters: - id: vlen @@ -22,4 +23,9 @@ templates: imports: from gnuradio import blocks make: blocks.char_to_short(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/char_to_short.h>'] + declarations: 'blocks::char_to_short::sptr ${id};' + make: 'this->${id} = blocks::char_to_short::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_arg.block.yml b/gr-blocks/grc/blocks_complex_to_arg.block.yml index 4f44e4ae2c..332ee474c4 100644 --- a/gr-blocks/grc/blocks_complex_to_arg.block.yml +++ b/gr-blocks/grc/blocks_complex_to_arg.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_arg label: Complex to Arg +flags: [ python, cpp ] parameters: - id: vlen @@ -25,4 +26,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_arg(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_arg.h>'] + declarations: 'blocks::complex_to_arg::sptr ${id};' + make: 'this->${id} = blocks::complex_to_arg::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_float.block.yml b/gr-blocks/grc/blocks_complex_to_float.block.yml index f7b35936c3..1af17a1568 100644 --- a/gr-blocks/grc/blocks_complex_to_float.block.yml +++ b/gr-blocks/grc/blocks_complex_to_float.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_float label: Complex To Float +flags: [ python, cpp ] parameters: - id: vlen @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_float(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_float.h>'] + declarations: 'blocks::complex_to_float::sptr ${id};' + make: 'this->${id} = blocks::complex_to_float::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_imag.block.yml b/gr-blocks/grc/blocks_complex_to_imag.block.yml index 29e14046aa..9314fb74ed 100644 --- a/gr-blocks/grc/blocks_complex_to_imag.block.yml +++ b/gr-blocks/grc/blocks_complex_to_imag.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_imag label: Complex to Imag +flags: [ python, cpp ] parameters: - id: vlen @@ -25,4 +26,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_imag(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_imag.h>'] + declarations: 'blocks::complex_to_imag::sptr ${id};' + make: 'this->${id} = blocks::complex_to_imag::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml b/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml index 06a75fc8d9..e11e0801cd 100644 --- a/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml +++ b/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_interleaved_char label: Complex To IChar +flags: [ python, cpp ] parameters: - id: vector_output @@ -25,4 +26,12 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_interleaved_char(${vector_output}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_interleaved_char.h>'] + declarations: 'blocks::complex_to_interleaved_char::sptr ${id};' + make: 'this->${id} = blocks::complex_to_interleaved_char::make(${vector_output});' + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml b/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml index 0b8aa53621..9853f5b117 100644 --- a/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml +++ b/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_interleaved_short label: Complex To IShort +flags: [ python, cpp ] parameters: - id: vector_output @@ -25,4 +26,12 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_interleaved_short(${vector_output}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_interleaved_short.h>'] + declarations: 'blocks::complex_to_interleaved_short::sptr ${id};' + make: 'this->${id} = blocks::complex_to_interleaved_short::make(${vector_output});' + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_mag.block.yml b/gr-blocks/grc/blocks_complex_to_mag.block.yml index d9582d1722..b8eff44ba6 100644 --- a/gr-blocks/grc/blocks_complex_to_mag.block.yml +++ b/gr-blocks/grc/blocks_complex_to_mag.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_mag label: Complex to Mag +flags: [ python, cpp ] parameters: - id: vlen @@ -25,4 +26,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_mag(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_mag.h>'] + declarations: 'blocks::complex_to_mag::sptr ${id};' + make: 'this->${id} = blocks::complex_to_mag::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml b/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml index 815636d654..dde23ffedc 100644 --- a/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml +++ b/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_mag_squared label: Complex to Mag^2 +flags: [ python, cpp ] parameters: - id: vlen @@ -25,4 +26,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_mag_squared(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_mag_squared.h>'] + declarations: 'blocks::complex_to_mag_squared::sptr ${id};' + make: 'this->${id} = blocks::complex_to_mag_squared::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_magphase.block.yml b/gr-blocks/grc/blocks_complex_to_magphase.block.yml index 80420ac2a0..0db7083992 100644 --- a/gr-blocks/grc/blocks_complex_to_magphase.block.yml +++ b/gr-blocks/grc/blocks_complex_to_magphase.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_magphase label: Complex To Mag Phase +flags: [ python, cpp ] parameters: - id: vlen @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_magphase(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_magphase.h>'] + declarations: 'blocks::complex_to_magphase::sptr ${id};' + make: 'this->${id} = blocks::complex_to_magphase::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_complex_to_real.block.yml b/gr-blocks/grc/blocks_complex_to_real.block.yml index 41fbbb33cc..0b44c1b19e 100644 --- a/gr-blocks/grc/blocks_complex_to_real.block.yml +++ b/gr-blocks/grc/blocks_complex_to_real.block.yml @@ -1,5 +1,6 @@ id: blocks_complex_to_real label: Complex To Real +flags: [ python, cpp ] parameters: - id: vlen @@ -26,4 +27,9 @@ templates: imports: from gnuradio import blocks make: blocks.complex_to_real(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/complex_to_real.h>'] + declarations: 'blocks::complex_to_real::sptr ${id};' + make: 'this->${id} = blocks::complex_to_real::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_conjugate_cc.block.yml b/gr-blocks/grc/blocks_conjugate_cc.block.yml index a0d8b1a64c..7d31be804b 100644 --- a/gr-blocks/grc/blocks_conjugate_cc.block.yml +++ b/gr-blocks/grc/blocks_conjugate_cc.block.yml @@ -1,5 +1,6 @@ id: blocks_conjugate_cc label: Complex Conjugate +flags: [ python, cpp ] inputs: - domain: stream @@ -13,4 +14,8 @@ templates: imports: from gnuradio import blocks make: blocks.conjugate_cc() +cpp_templates: + includes: ['#include <gnuradio/blocks/conjugate_cc.h>'] + declarations: 'blocks::conjugate_cc::sptr ${id};' + make: 'this->${id} = blocks::conjugate_cc::make();' file_format: 1 diff --git a/gr-blocks/grc/blocks_copy.block.yml b/gr-blocks/grc/blocks_copy.block.yml index 9e2d6713a9..2efee8cbca 100644 --- a/gr-blocks/grc/blocks_copy.block.yml +++ b/gr-blocks/grc/blocks_copy.block.yml @@ -1,5 +1,6 @@ id: blocks_copy label: Copy +flags: [ python, cpp ] parameters: - id: type @@ -54,4 +55,17 @@ templates: callbacks: - set_enabled(${enabled}) +cpp_templates: + includes: ['#include <gnuradio/blocks/copy.h>'] + declarations: 'blocks::copy::sptr ${id};' + make: |- + this->${id} = blocks::copy::make(${type.size}*${vlen}); + self->${id}.set_enabled(${enabled}); + callbacks: + - set_enabled(${enabled}) + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_ctrlport_performance.block.yml b/gr-blocks/grc/blocks_ctrlport_performance.block.yml index 80f541a41b..63b6e98932 100644 --- a/gr-blocks/grc/blocks_ctrlport_performance.block.yml +++ b/gr-blocks/grc/blocks_ctrlport_performance.block.yml @@ -1,5 +1,6 @@ id: blocks_ctrlport_monitor_performance label: CtrlPort Performance Monitor +flags: [ python ] parameters: - id: en diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml b/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml index 2b757718a6..cfd23f565f 100644 --- a/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml +++ b/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml @@ -1,5 +1,6 @@ id: blocks_ctrlport_probe2_c label: Ctrlport Probe +flags: [ python, cpp ] parameters: - id: name @@ -32,6 +33,16 @@ templates: callbacks: - set_length(${len}) +cpp_templates: + includes: ['#include <gnuradio/blocks/ctrlport_probe2_c.h>'] + declarations: 'blocks::ctrlport_probe2_c::sptr ${id};' + make: 'this->${id} = blocks::ctrlport_probe2_c::make(${name}, ${desc}, ${len}, ${disp_mask});' + callbacks: + - set_length(${len}) + translations: + gr.: '' + + documentation: |- Place this in a graph to export vectors of samples to a GRCP port probe. diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml b/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml index f2b8e0a781..2b4429204f 100644 --- a/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml +++ b/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml @@ -1,5 +1,6 @@ id: blocks_ctrlport_probe2_x label: Ctrlport Probe +flags: [ python, cpp ] parameters: - id: type @@ -39,6 +40,16 @@ templates: callbacks: - set_length(${len}) +cpp_templates: + includes: ['#include <gnuradio/blocks/ctrlport_probe2_${type.fcn}.h>'] + declarations: 'blocks::ctrlport_probe2_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::ctrlport_probe2_${type.fcn}::make(${name}, ${desc}, ${len}, ${disp_mask});' + callbacks: + - set_length(${len}) + translations: + gr.: '' + + documentation: |- Place this in a graph to export vectors of samples to a GRCP port probe. diff --git a/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml b/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml index 6f59f3e695..ea4ea4ea18 100644 --- a/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml +++ b/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml @@ -1,5 +1,6 @@ id: blocks_ctrlport_probe_c label: Ctrlport Complex Probe +flags: [ python, cpp ] parameters: - id: name @@ -19,6 +20,12 @@ templates: imports: from gnuradio import blocks make: blocks.ctrlport_probe_c(${name}, ${desc}) +cpp_templates: + includes: ['#include <gnuradio/blocks/ctrlport_probe_c.h>'] + declarations: 'blocks::ctrlport_probe_c::sptr ${id};' + make: 'this->${id} = blocks::ctrlport_probe_c::make(${name}, ${desc});' + + documentation: |- Place this in a graph to export complex values to a GRCP port probe. diff --git a/gr-blocks/grc/blocks_ctrlport_viewer.block.yml b/gr-blocks/grc/blocks_ctrlport_viewer.block.yml index dc718aa975..0ea3ee0687 100644 --- a/gr-blocks/grc/blocks_ctrlport_viewer.block.yml +++ b/gr-blocks/grc/blocks_ctrlport_viewer.block.yml @@ -1,5 +1,6 @@ id: blocks_ctrlport_monitor label: CtrlPort Monitor +flags: [ python ] parameters: - id: en diff --git a/gr-blocks/grc/blocks_deinterleave.block.yml b/gr-blocks/grc/blocks_deinterleave.block.yml index 98761c4cc0..cacaa4149d 100644 --- a/gr-blocks/grc/blocks_deinterleave.block.yml +++ b/gr-blocks/grc/blocks_deinterleave.block.yml @@ -1,5 +1,6 @@ id: blocks_deinterleave label: Deinterleave +flags: [ python, cpp ] parameters: - id: type @@ -45,4 +46,11 @@ templates: imports: from gnuradio import blocks make: blocks.deinterleave(${type.size}*${vlen}, ${blocksize}) +cpp_templates: + includes: ['#include <gnuradio/blocks/deinterleave.h>'] + declarations: 'blocks::deinterleave::sptr ${id};' + make: 'this->${id} = blocks::deinterleave::make(${type.size}*${vlen}, ${blocksize});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_delay.block.yml b/gr-blocks/grc/blocks_delay.block.yml index b9d63df586..6d5485976f 100644 --- a/gr-blocks/grc/blocks_delay.block.yml +++ b/gr-blocks/grc/blocks_delay.block.yml @@ -1,5 +1,6 @@ id: blocks_delay label: Delay +flags: [ python, cpp ] parameters: - id: type @@ -47,4 +48,13 @@ templates: callbacks: - set_dly(${delay}) +cpp_templates: + includes: ['#include <gnuradio/blocks/delay.h>'] + declarations: 'blocks::delay::sptr ${id};' + make: 'this->${id} = blocks::delay::make(${type.size}*${vlen}, ${delay});' + callbacks: + - set_dly(${delay}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_divide_XX.block.yml b/gr-blocks/grc/blocks_divide_XX.block.yml index a98dfde5c7..aff3c838f1 100644 --- a/gr-blocks/grc/blocks_divide_XX.block.yml +++ b/gr-blocks/grc/blocks_divide_XX.block.yml @@ -1,5 +1,6 @@ id: blocks_divide_xx label: Divide +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,9 @@ templates: imports: from gnuradio import blocks make: blocks.divide_${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/divide.h>'] + declarations: 'blocks::divide_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::divide_${type.fcn}::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_endian_swap.block.yml b/gr-blocks/grc/blocks_endian_swap.block.yml index da2ef0c379..6d3e62b3b9 100644 --- a/gr-blocks/grc/blocks_endian_swap.block.yml +++ b/gr-blocks/grc/blocks_endian_swap.block.yml @@ -1,5 +1,6 @@ id: blocks_endian_swap label: Endian Swap +flags: [ python, cpp ] parameters: - id: type @@ -23,4 +24,9 @@ templates: imports: from gnuradio import blocks make: blocks.endian_swap(${type.size}) +cpp_templates: + includes: ['#include <gnuradio/blocks/endian_swap.h>'] + declarations: 'blocks::endian_swap::sptr ${id};' + make: 'this->${id} = blocks::endian_swap::make(${type.size});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml b/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml index 10bef0d3cd..832a9e2792 100644 --- a/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml +++ b/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml @@ -1,5 +1,6 @@ id: blocks_exponentiate_const_cci label: Exponentiate Const Int +flags: [ python, cpp ] parameters: - id: num_ports @@ -40,4 +41,12 @@ templates: callbacks: - set_exponent(${exponent}) +cpp_templates: + includes: ['#include <gnuradio/blocks/exponentiate_const_cci.h>'] + declarations: 'blocks::exponentiate_const_cci::sptr ${id};' + make: 'this->${id} = blocks::exponentiate_const_cci::make(${exponent}, ${vlen});' + callbacks: + - set_exponent(${exponent}) + + file_format: 1 diff --git a/gr-blocks/grc/blocks_file_descriptor_sink.block.yml b/gr-blocks/grc/blocks_file_descriptor_sink.block.yml index 24d88f67f9..f0b72cb3a6 100644 --- a/gr-blocks/grc/blocks_file_descriptor_sink.block.yml +++ b/gr-blocks/grc/blocks_file_descriptor_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_file_descriptor_sink label: File Descriptor Sink +flags: [ python, cpp ] parameters: - id: fd @@ -31,4 +32,11 @@ templates: imports: from gnuradio import blocks make: blocks.file_descriptor_sink(${type.size}*${vlen}, ${fd}) +cpp_templates: + includes: ['#include <gnuradio/blocks/file_descriptor_sink.h>'] + declarations: 'blocks::file_descriptor_sink::sptr ${id};' + make: 'this->${id} = blocks::file_descriptor_sink::make(${type.size}*${vlen}, ${fd});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_file_descriptor_source.block.yml b/gr-blocks/grc/blocks_file_descriptor_source.block.yml index 84926661e4..94eecdae77 100644 --- a/gr-blocks/grc/blocks_file_descriptor_source.block.yml +++ b/gr-blocks/grc/blocks_file_descriptor_source.block.yml @@ -1,5 +1,6 @@ id: blocks_file_descriptor_source label: File Descriptor Source +flags: [ python, cpp ] parameters: - id: fd @@ -34,4 +35,13 @@ templates: imports: from gnuradio import blocks make: blocks.file_descriptor_source(${type.size}*${vlen}, ${fd}, ${repeat}) +cpp_templates: + includes: ['#include <gnuradio/blocks/file_descriptor_source.h>'] + declarations: 'blocks::file_descriptor_source::sptr ${id};' + make: 'this->${id} = blocks::file_descriptor_source::make(${type.size}*${vlen}, ${fd}, ${repeat});' + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_file_meta_sink.block.yml b/gr-blocks/grc/blocks_file_meta_sink.block.yml index 7512f23aae..f60f8b4435 100644 --- a/gr-blocks/grc/blocks_file_meta_sink.block.yml +++ b/gr-blocks/grc/blocks_file_meta_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_file_meta_sink label: File Meta Sink +flags: [ python ] parameters: - id: file diff --git a/gr-blocks/grc/blocks_file_meta_source.block.yml b/gr-blocks/grc/blocks_file_meta_source.block.yml index 016c2f62a5..add2e0d8c4 100644 --- a/gr-blocks/grc/blocks_file_meta_source.block.yml +++ b/gr-blocks/grc/blocks_file_meta_source.block.yml @@ -1,5 +1,6 @@ id: blocks_file_meta_source label: File Meta Source +flags: [ python ] parameters: - id: type diff --git a/gr-blocks/grc/blocks_file_sink.block.yml b/gr-blocks/grc/blocks_file_sink.block.yml index cf9782340f..69c9cf4452 100644 --- a/gr-blocks/grc/blocks_file_sink.block.yml +++ b/gr-blocks/grc/blocks_file_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_file_sink label: File Sink +flags: [ python, cpp ] parameters: - id: file @@ -48,4 +49,15 @@ templates: - set_unbuffered(${unbuffered}) - open(${file}) +cpp_templates: + includes: ['#include <gnuradio/blocks/file_sink.h>'] + declarations: 'blocks::file_sink::sptr ${id};' + make: 'this->${id} = blocks::file_sink::make(${type.size})*${vlen}, ${file}, ${append});' + callbacks: + - open(${file}) + translations: + 'True': 'true' + 'False': 'false' + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_file_source.block.yml b/gr-blocks/grc/blocks_file_source.block.yml index 4aed206fbd..3a82e40d40 100644 --- a/gr-blocks/grc/blocks_file_source.block.yml +++ b/gr-blocks/grc/blocks_file_source.block.yml @@ -1,5 +1,6 @@ id: blocks_file_source label: File Source +flags: [ python, cpp ] parameters: - id: file @@ -56,4 +57,15 @@ templates: - open(${file}, ${repeat}) - self.${id}.set_begin_tag(${begin_tag}) +cpp_templates: + includes: ['#include <gnuradio/blocks/file_source.h>'] + declarations: 'blocks::file_source::sptr ${id};' + make: 'this->${id} =blocks::file_source::make(${type.size})*${vlen}, "${file[1:-1]}", ${repeat}, ${offset}, ${length});' + callbacks: + - open(${file}, ${repeat}) + translations: + 'True': 'true' + 'False': 'false' + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_float_to_char.block.yml b/gr-blocks/grc/blocks_float_to_char.block.yml index 4f6eeb7286..7adcf47ecb 100644 --- a/gr-blocks/grc/blocks_float_to_char.block.yml +++ b/gr-blocks/grc/blocks_float_to_char.block.yml @@ -1,5 +1,6 @@ id: blocks_float_to_char label: Float To Char +flags: [ python, cpp ] parameters: - id: vlen @@ -28,4 +29,11 @@ templates: callbacks: - set_scale(${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/float_to_char.h>'] + declarations: 'blocks::float_to_char::sptr ${id};' + make: 'this->${id} = blocks::float_to_char::make(${vlen}, ${scale});' + callbacks: + - set_scale(${scale}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_float_to_complex.block.yml b/gr-blocks/grc/blocks_float_to_complex.block.yml index d592c4e461..4c36476755 100644 --- a/gr-blocks/grc/blocks_float_to_complex.block.yml +++ b/gr-blocks/grc/blocks_float_to_complex.block.yml @@ -1,5 +1,6 @@ id: blocks_float_to_complex label: Float To Complex +flags: [ python, cpp ] parameters: - id: vlen @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.float_to_complex(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/float_to_complex.h>'] + declarations: 'blocks::float_to_complex::sptr ${id};' + make: 'this->${id} = blocks::float_to_complex::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_float_to_int.block.yml b/gr-blocks/grc/blocks_float_to_int.block.yml index 4ed0e08718..9c3d83fcc0 100644 --- a/gr-blocks/grc/blocks_float_to_int.block.yml +++ b/gr-blocks/grc/blocks_float_to_int.block.yml @@ -1,5 +1,6 @@ id: blocks_float_to_int label: Float To Int +flags: [ python, cpp ] parameters: - id: vlen @@ -28,4 +29,11 @@ templates: callbacks: - set_scale(${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/float_to_int.h>'] + declarations: 'blocks::float_to_int::sptr ${id};' + make: 'this->${id} = blocks::float_to_int::make(${vlen}, ${scale});' + callbacks: + - set_scale(${scale}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_float_to_short.block.yml b/gr-blocks/grc/blocks_float_to_short.block.yml index 8b1c4e58b5..8cc3de5e2e 100644 --- a/gr-blocks/grc/blocks_float_to_short.block.yml +++ b/gr-blocks/grc/blocks_float_to_short.block.yml @@ -1,5 +1,6 @@ id: blocks_float_to_short label: Float To Short +flags: [ python, cpp ] parameters: - id: vlen @@ -28,4 +29,11 @@ templates: callbacks: - set_scale(${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/float_to_short.h>'] + declarations: 'blocks::float_to_short::sptr ${id};' + make: 'this->${id} = blocks::float_to_short::make(${vlen}, ${scale});' + callbacks: + - set_scale(${scale}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_float_uchar.block.yml b/gr-blocks/grc/blocks_float_uchar.block.yml index 33687978c2..c820a6e7f1 100644 --- a/gr-blocks/grc/blocks_float_uchar.block.yml +++ b/gr-blocks/grc/blocks_float_uchar.block.yml @@ -1,5 +1,6 @@ id: blocks_float_to_uchar label: Float To UChar +flags: [ python, cpp ] inputs: - domain: stream @@ -13,4 +14,9 @@ templates: imports: from gnuradio import blocks make: blocks.float_to_uchar() +cpp_templates: + includes: ['#include <gnuradio/blocks/float_to_uchar.h>'] + declarations: 'blocks::float_to_uchar::sptr ${id};' + make: 'this->${id} = blocks::float_to_uchar::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_head.block.yml b/gr-blocks/grc/blocks_head.block.yml index c342e40067..59d2a7b9dd 100644 --- a/gr-blocks/grc/blocks_head.block.yml +++ b/gr-blocks/grc/blocks_head.block.yml @@ -1,5 +1,6 @@ id: blocks_head label: Head +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,13 @@ templates: callbacks: - set_length(${num_items}) +cpp_templates: + includes: ['#include <gnuradio/blocks/head.h>'] + declarations: 'blocks::head::sptr ${id};' + make: 'this->${id} = blocks::head::make(${type.size}*${vlen}, ${num_items});' + callbacks: + - set_length(${num_items}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_int_to_float.block.yml b/gr-blocks/grc/blocks_int_to_float.block.yml index a6f3b3b92c..a966036370 100644 --- a/gr-blocks/grc/blocks_int_to_float.block.yml +++ b/gr-blocks/grc/blocks_int_to_float.block.yml @@ -1,5 +1,6 @@ id: blocks_int_to_float label: Int To Float +flags: [ python, cpp ] parameters: - id: vlen @@ -28,4 +29,12 @@ templates: callbacks: - set_scale(${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/int_to_float.h>'] + declarations: 'blocks::int_to_float::sptr ${id};' + make: 'this->${id} = blocks::int_to_float::make(${vlen}, ${scale});' + callbacks: + - set_scale(${scale}) + + file_format: 1 diff --git a/gr-blocks/grc/blocks_integrate_xx.block.yml b/gr-blocks/grc/blocks_integrate_xx.block.yml index e8d3dd08cd..c342f53b88 100644 --- a/gr-blocks/grc/blocks_integrate_xx.block.yml +++ b/gr-blocks/grc/blocks_integrate_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_integrate_xx label: Integrate +flags: [ python, cpp ] parameters: - id: type @@ -32,4 +33,9 @@ templates: imports: from gnuradio import blocks make: blocks.integrate_${type.fcn}(${decim}, ${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/integrate.h>'] + declarations: 'blocks::integrate_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::integrate_${type.fcn}::make(${decim}, ${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_interleave.block.yml b/gr-blocks/grc/blocks_interleave.block.yml index e814e675b9..e2ab6c612f 100644 --- a/gr-blocks/grc/blocks_interleave.block.yml +++ b/gr-blocks/grc/blocks_interleave.block.yml @@ -1,5 +1,6 @@ id: blocks_interleave label: Interleave +flags: [ python, cpp ] parameters: - id: type @@ -45,4 +46,11 @@ templates: imports: from gnuradio import blocks make: blocks.interleave(${type.size}*${vlen}, ${blocksize}) +cpp_templates: + includes: ['#include <gnuradio/blocks/interleave.h>'] + declarations: 'blocks::interleave::sptr ${id};' + make: 'this->${id} = blocks::interleave::make(${type.size}*${vlen}, ${blocksize});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml b/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml index 049f67b246..bf09350843 100644 --- a/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml +++ b/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml @@ -1,5 +1,6 @@ id: blocks_interleaved_char_to_complex label: IChar To Complex +flags: [ python, cpp ] parameters: - id: vector_input @@ -25,4 +26,12 @@ templates: imports: from gnuradio import blocks make: blocks.interleaved_char_to_complex(${vector_input}) +cpp_templates: + includes: ['#include <gnuradio/blocks/interleaved_char_to_complex.h>'] + declarations: 'blocks::interleaved_char_to_complex::sptr ${id};' + make: 'this->${id} = blocks::interleaved_char_to_complex::make(${vector_input});' + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml b/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml index 5c3ab76d4d..16c8b4b281 100644 --- a/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml +++ b/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml @@ -1,5 +1,6 @@ id: blocks_interleaved_short_to_complex label: IShort To Complex +flags: [ python, cpp ] parameters: - id: vector_input @@ -34,4 +35,14 @@ templates: callbacks: - set_swap(${swap}) +cpp_templates: + includes: ['#include <gnuradio/blocks/interleaved_short_to_complex.h>'] + declarations: 'blocks::interleaved_short_to_complex::sptr ${id};' + make: 'this->${id} = blocks::interleaved_short_to_complex::make(${vector_input}, ${swap});' + callbacks: + - set_swap(${swap}) + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_keep_m_in_n.block.yml b/gr-blocks/grc/blocks_keep_m_in_n.block.yml index 96cf25dde9..b54873fd0a 100644 --- a/gr-blocks/grc/blocks_keep_m_in_n.block.yml +++ b/gr-blocks/grc/blocks_keep_m_in_n.block.yml @@ -1,5 +1,6 @@ id: blocks_keep_m_in_n label: Keep M in N +flags: [ python, cpp ] parameters: - id: type @@ -48,4 +49,15 @@ templates: - set_m(${m}) - set_n(${n}) +cpp_templates: + includes: ['#include <gnuradio/blocks/keep_m_in_n.h>'] + declarations: 'blocks::keep_m_in_n::sptr ${id};' + make: 'this->${id} = blocks::keep_m_in_n::make(${type.size}, ${m}, ${n}, ${offset});' + callbacks: + - set_offset(${offset}) + - set_m(${m}) + - set_n(${n}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_keep_one_in_n.block.yml b/gr-blocks/grc/blocks_keep_one_in_n.block.yml index d790557834..4c98afa738 100644 --- a/gr-blocks/grc/blocks_keep_one_in_n.block.yml +++ b/gr-blocks/grc/blocks_keep_one_in_n.block.yml @@ -1,5 +1,6 @@ id: blocks_keep_one_in_n label: Keep 1 in N +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,13 @@ templates: callbacks: - set_n(${n}) +cpp_templates: + includes: ['#include <gnuradio/blocks/keep_one_in_n.h>'] + declarations: 'blocks::keep_one_in_n::sptr ${id};' + make: 'this->${id} = blocks::keep_one_in_n::make(${type.size}*${vlen}, ${n});' + callbacks: + - set_n(${n}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_magphase_to_complex.block.yml b/gr-blocks/grc/blocks_magphase_to_complex.block.yml index 56f939d816..4d51f002bd 100644 --- a/gr-blocks/grc/blocks_magphase_to_complex.block.yml +++ b/gr-blocks/grc/blocks_magphase_to_complex.block.yml @@ -1,5 +1,6 @@ id: blocks_magphase_to_complex label: Magnitude and Phase To Complex +flags: [ python, cpp ] parameters: - id: vlen @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.magphase_to_complex(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/magphase_to_complex.h>'] + declarations: 'blocks::magphase_to_complex::sptr ${id};' + make: 'this->${id} = blocks::magphase_to_complex::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_max_xx.block.yml b/gr-blocks/grc/blocks_max_xx.block.yml index 8b7516de8e..f1b88eb9d1 100644 --- a/gr-blocks/grc/blocks_max_xx.block.yml +++ b/gr-blocks/grc/blocks_max_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_max_xx label: Max +flags: [ python, cpp ] parameters: - id: type @@ -42,6 +43,11 @@ asserts: templates: imports: from gnuradio import blocks - make: blocks.max_${type.fcn}(${vlen},${vlen_out}) + make: blocks.max_${type.fcn}(${vlen}, ${vlen_out}) + +cpp_templates: + includes: ['#include <gnuradio/blocks/max_blk.h>'] + declarations: 'blocks::max_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::make_${type.fcn}::make(${vlen}, ${vlen_out});' file_format: 1 diff --git a/gr-blocks/grc/blocks_message_debug.block.yml b/gr-blocks/grc/blocks_message_debug.block.yml index 301320e884..1ebf5b378a 100644 --- a/gr-blocks/grc/blocks_message_debug.block.yml +++ b/gr-blocks/grc/blocks_message_debug.block.yml @@ -1,5 +1,6 @@ id: blocks_message_debug label: Message Debug +flags: [ python, cpp ] inputs: - domain: message @@ -16,4 +17,9 @@ templates: imports: from gnuradio import blocks make: blocks.message_debug() +cpp_templates: + includes: ['#include <gnuradio/blocks/message_debug.h>'] + declarations: 'blocks::message_debug::sptr ${id};' + make: 'this->${id} = blocks::message_debug::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_message_strobe.block.yml b/gr-blocks/grc/blocks_message_strobe.block.yml index 89264996b2..1bf6ac4f10 100644 --- a/gr-blocks/grc/blocks_message_strobe.block.yml +++ b/gr-blocks/grc/blocks_message_strobe.block.yml @@ -1,5 +1,6 @@ id: blocks_message_strobe label: Message Strobe +flags: [ python ] parameters: - id: msg diff --git a/gr-blocks/grc/blocks_message_strobe_random.block.yml b/gr-blocks/grc/blocks_message_strobe_random.block.yml index c0d6075892..e23c4e3ae9 100644 --- a/gr-blocks/grc/blocks_message_strobe_random.block.yml +++ b/gr-blocks/grc/blocks_message_strobe_random.block.yml @@ -1,5 +1,6 @@ id: blocks_message_strobe_random label: Message Strobe Random-Delay +flags: [ python ] parameters: - id: msg diff --git a/gr-blocks/grc/blocks_min_xx.block.yml b/gr-blocks/grc/blocks_min_xx.block.yml index 511d67c145..9152a8500e 100644 --- a/gr-blocks/grc/blocks_min_xx.block.yml +++ b/gr-blocks/grc/blocks_min_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_min_xx label: Min +flags: [ python, cpp ] parameters: - id: type @@ -44,4 +45,9 @@ templates: imports: from gnuradio import blocks make: blocks.min_${type.fcn}(${vlen},${vlen_out}) +cpp_templates: + includes: ['#include <gnuradio/blocks/min_blk.h>'] + declarations: 'blocks::min_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::min_${type.fcn}::make(${vlen},${vlen_out});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_moving_average_xx.block.yml b/gr-blocks/grc/blocks_moving_average_xx.block.yml index 6b12355894..6618a8f790 100644 --- a/gr-blocks/grc/blocks_moving_average_xx.block.yml +++ b/gr-blocks/grc/blocks_moving_average_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_moving_average_xx label: Moving Average +flags: [ python, cpp ] parameters: - id: type @@ -46,4 +47,11 @@ templates: callbacks: - set_length_and_scale(${length}, ${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/moving_average.h>'] + declarations: 'blocks::moving_average_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::moving_average_${type.fcn}::make(${length}, ${scale}, ${max_iter}, ${vlen});' + callbacks: + - set_length_and_scale(${length}, ${scale}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml b/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml index f6b72edf36..6203815005 100644 --- a/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml +++ b/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml @@ -1,5 +1,6 @@ id: blocks_multiply_by_tag_value_cc label: Multiply by Tag Value +flags: [ python, cpp ] parameters: - id: tagname @@ -22,4 +23,9 @@ templates: imports: from gnuradio import blocks make: blocks.multiply_by_tag_value_cc(${tagname}, ${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/multiply_by_tag_value_cc.h>'] + declarations: 'blocks::multiply_by_tag_value_cc::sptr ${id};' + make: 'this->${id} = blocks::multiply_by_tag_value_cc::make(${tagname}, ${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml b/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml index aceabc643e..3ede64dac7 100644 --- a/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml +++ b/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml @@ -1,5 +1,6 @@ id: blocks_multiply_conjugate_cc label: Multiply Conjugate +flags: [ python, cpp ] parameters: - id: vlen @@ -30,4 +31,9 @@ templates: imports: from gnuradio import blocks make: blocks.multiply_conjugate_cc(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/multiply_conjugate_cc.h>'] + declarations: 'blocks::multiply_conjugate_cc::sptr ${id};' + make: 'this->${id} = blocks::multiply_conjugate_cc::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_multiply_const_vxx.block.yml b/gr-blocks/grc/blocks_multiply_const_vxx.block.yml index 41dd9c9c68..219ad6f1f0 100644 --- a/gr-blocks/grc/blocks_multiply_const_vxx.block.yml +++ b/gr-blocks/grc/blocks_multiply_const_vxx.block.yml @@ -1,5 +1,6 @@ id: blocks_multiply_const_vxx label: Multiply Const +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,11 @@ templates: callbacks: - set_k(${const}) +cpp_templates: + includes: ['#include <gnuradio/blocks/multiply_const${"_v" if context.get("vlen")() > 1 else "" }.h>'] + declarations: 'blocks::multiply_const_${"v" if context.get("vlen")() > 1 else "" }${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::multiply_const_${"v" if context.get("vlen")() > 1 else "" }${type.fcn}::make(${const});' + callbacks: + - set_k(${const}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_multiply_const_xx.block.yml b/gr-blocks/grc/blocks_multiply_const_xx.block.yml index a239913802..07d3aed32b 100644 --- a/gr-blocks/grc/blocks_multiply_const_xx.block.yml +++ b/gr-blocks/grc/blocks_multiply_const_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_multiply_const_xx label: Fast Multiply Const +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,11 @@ templates: callbacks: - set_k(${const}) +cpp_templates: + includes: ['#include <gnuradio/multiply_const.h>'] + declarations: 'blocks::multiply_const_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::multiply_const_${type.fcn}::make(${const}, ${vlen});' + callbacks: + - set_k(${const}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml b/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml index 21a66b4f8e..df67194777 100644 --- a/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml +++ b/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_multiply_matrix_xx label: Multiply by Matrix +flags: [ python ] parameters: - id: type @@ -44,4 +45,11 @@ templates: callbacks: - set_A(${A}) +cpp_templates: + includes: ['#include <gnuradio/blocks/multiply_matrix.h>'] + declarations: 'blocks::multiply_matrix_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::multiply_matrix_${type.fcn}::make(${A}, ${tag_propagation_policy});' + callbacks: + - set_A(${A}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_multiply_xx.block.yml b/gr-blocks/grc/blocks_multiply_xx.block.yml index 41c28458a8..00cebbb895 100644 --- a/gr-blocks/grc/blocks_multiply_xx.block.yml +++ b/gr-blocks/grc/blocks_multiply_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_multiply_xx label: Multiply +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,9 @@ templates: imports: from gnuradio import blocks make: blocks.multiply_v${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/multiply.h>'] + declarations: 'blocks::multiply_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::multiply_${type.fcn}::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_mute_xx.block.yml b/gr-blocks/grc/blocks_mute_xx.block.yml index 8e36c568d1..9ce550c192 100644 --- a/gr-blocks/grc/blocks_mute_xx.block.yml +++ b/gr-blocks/grc/blocks_mute_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_mute_xx label: Mute +flags: [ python, cpp ] parameters: - id: type @@ -32,4 +33,14 @@ templates: callbacks: - set_mute(bool(${mute})) +cpp_templates: + includes: ['#include <gnuradio/blocks/mute.h>'] + declarations: 'blocks::mute_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::mute_${type.fcn}::(bool(${mute}));' + callbacks: + - set_mute(bool(${mute})) + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_nlog10_ff.block.yml b/gr-blocks/grc/blocks_nlog10_ff.block.yml index 004e72b4ec..deb60ba0d7 100644 --- a/gr-blocks/grc/blocks_nlog10_ff.block.yml +++ b/gr-blocks/grc/blocks_nlog10_ff.block.yml @@ -1,5 +1,6 @@ id: blocks_nlog10_ff label: Log10 +flags: [ python, cpp ] parameters: - id: n @@ -34,4 +35,10 @@ templates: imports: from gnuradio import blocks make: blocks.nlog10_ff(${n}, ${vlen}, ${k}) +cpp_templates: + includes: ['#include <gnuradio/blocks/nlog10_ff.h>'] + declarations: 'blocks::nlog10_ff::sptr ${id};' + make: 'this->${id} = blocks::nlog10_ff::make(${n}, ${vlen}, ${k});' + + file_format: 1 diff --git a/gr-blocks/grc/blocks_nop.block.yml b/gr-blocks/grc/blocks_nop.block.yml index 5e47e813ad..e7703b4a46 100644 --- a/gr-blocks/grc/blocks_nop.block.yml +++ b/gr-blocks/grc/blocks_nop.block.yml @@ -1,5 +1,6 @@ id: blocks_nop label: Nop +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,11 @@ templates: imports: from gnuradio import blocks make: blocks.nop(${type.size}*${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/nop.h>'] + declarations: 'blocks::nop::sptr ${id};' + make: 'this->${id} = blocks::nop::make(${type.size}*${vlen});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_not_xx.block.yml b/gr-blocks/grc/blocks_not_xx.block.yml index 63ec98a42a..c6e21d9a0a 100644 --- a/gr-blocks/grc/blocks_not_xx.block.yml +++ b/gr-blocks/grc/blocks_not_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_not_xx label: Not +flags: [ python, cpp ] parameters: - id: type @@ -22,4 +23,9 @@ templates: imports: from gnuradio import blocks make: blocks.not_${type.fcn}() +cpp_templates: + includes: ['#include <gnuradio/blocks/not_blk.h>'] + declarations: 'blocks::not_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::not_${type.fcn}::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_null_sink.block.yml b/gr-blocks/grc/blocks_null_sink.block.yml index c9530f99de..4e3fbc754e 100644 --- a/gr-blocks/grc/blocks_null_sink.block.yml +++ b/gr-blocks/grc/blocks_null_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_null_sink label: Null Sink +flags: [ python, cpp ] parameters: - id: type @@ -40,4 +41,11 @@ templates: imports: from gnuradio import blocks make: blocks.null_sink(${type.size}*${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/null_sink.h>'] + declarations: 'blocks::null_sink::sptr ${id};' + make: 'this->${id} = blocks::null_sink::make(${type.size})*${vlen});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_null_source.block.yml b/gr-blocks/grc/blocks_null_source.block.yml index 0678687a8d..81e8c25d9f 100644 --- a/gr-blocks/grc/blocks_null_source.block.yml +++ b/gr-blocks/grc/blocks_null_source.block.yml @@ -1,5 +1,6 @@ id: blocks_null_source label: Null Source +flags: [ python, cpp ] parameters: - id: type @@ -36,4 +37,11 @@ templates: imports: from gnuradio import blocks make: blocks.null_source(${type.size}*${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/null_source.h>'] + declarations: 'blocks::null_source::sptr ${id};' + make: 'blocks::null_source::make(${type.size})*${vlen});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_or_xx.block.yml b/gr-blocks/grc/blocks_or_xx.block.yml index a28a951712..b1348703f1 100644 --- a/gr-blocks/grc/blocks_or_xx.block.yml +++ b/gr-blocks/grc/blocks_or_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_or_xx label: Or +flags: [ python, cpp ] parameters: - id: type @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.or_${type.fcn}() +cpp_templates: + includes: ['#include <gnuradio/blocks/or_blk.h>'] + declarations: 'blocks::or_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::or_${type.fcn}::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml b/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml index 904f382f0f..a114495b1c 100644 --- a/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml +++ b/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml @@ -1,5 +1,6 @@ id: blocks_pack_k_bits_bb label: Pack K Bits +flags: [ python, cpp ] parameters: - id: k @@ -18,6 +19,11 @@ templates: imports: from gnuradio import blocks make: blocks.pack_k_bits_bb(${k}) +cpp_templates: + includes: ['#include <gnuradio/blocks/pack_k_bits_bb.h>'] + declarations: 'blocks::pack_k_bits_bb::sptr ${id};' + make: 'this->${id} = blocks::pack_k_bits_bb::make(${k});' + documentation: |- Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros. diff --git a/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml b/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml index 5d49d1851c..296cfd6b63 100644 --- a/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml +++ b/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_packed_to_unpacked_xx label: Packed to Unpacked +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,12 @@ templates: imports: from gnuradio import blocks make: blocks.packed_to_unpacked_${type.fcn}(${bits_per_chunk}, ${endianness}) + +cpp_templates: + includes: ['#include <gnuradio/blocks/packed_to_unpacked.h>'] + declarations: 'blocks::packed_to_unpacked_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::packed_to_unpacked_${type.fcn}::make(${bits_per_chunk}, ${endianness});' + translations: + gr.: '' + file_format: 1 diff --git a/gr-blocks/grc/blocks_patterned_interleaver.block.yml b/gr-blocks/grc/blocks_patterned_interleaver.block.yml index 97f170f97e..af13c01f65 100644 --- a/gr-blocks/grc/blocks_patterned_interleaver.block.yml +++ b/gr-blocks/grc/blocks_patterned_interleaver.block.yml @@ -1,5 +1,6 @@ id: blocks_patterned_interleaver label: Patterned Interleaver +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,11 @@ templates: imports: from gnuradio import blocks make: blocks.patterned_interleaver(${type.size}*${vlen}, ${pattern}) +cpp_templates: + includes: ['#include <gnuradio/blocks/patterned_interleaver.h>'] + declarations: 'blocks::patterned_interleaver::sptr ${id};' + make: 'this->${id} = blocks::patterned_interleaver::make(${type.size}*${vlen}, ${pattern});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_pdu_filter.block.yml b/gr-blocks/grc/blocks_pdu_filter.block.yml index 43d72b7480..e2138c5118 100644 --- a/gr-blocks/grc/blocks_pdu_filter.block.yml +++ b/gr-blocks/grc/blocks_pdu_filter.block.yml @@ -1,5 +1,6 @@ id: blocks_pdu_filter label: PDU Filter +flags: [ python ] parameters: - id: k diff --git a/gr-blocks/grc/blocks_pdu_remove.block.yml b/gr-blocks/grc/blocks_pdu_remove.block.yml index 4750ff22c4..225d57005e 100644 --- a/gr-blocks/grc/blocks_pdu_remove.block.yml +++ b/gr-blocks/grc/blocks_pdu_remove.block.yml @@ -1,5 +1,6 @@ id: blocks_pdu_remove label: PDU Remove +flags: [ python ] parameters: - id: k diff --git a/gr-blocks/grc/blocks_pdu_set.block.yml b/gr-blocks/grc/blocks_pdu_set.block.yml index 44a06a2e09..7d90be3dad 100644 --- a/gr-blocks/grc/blocks_pdu_set.block.yml +++ b/gr-blocks/grc/blocks_pdu_set.block.yml @@ -1,5 +1,6 @@ id: blocks_pdu_set label: PDU Set +flags: [ python ] parameters: - id: k diff --git a/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml b/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml index 3b44badd4b..ae7271f767 100644 --- a/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml +++ b/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml @@ -1,5 +1,6 @@ id: blocks_pdu_to_tagged_stream label: PDU to Tagged Stream +flags: [ python, cpp ] parameters: - id: type @@ -26,4 +27,11 @@ templates: imports: from gnuradio import blocks make: blocks.pdu_to_tagged_stream(${type.tv}, ${tag}) +cpp_templates: + includes: ['#include <gnuradio/blocks/pdu_to_tagged_stream.h>'] + declarations: 'blocks::pdu_to_tagged_stream::sptr ${id};' + make: 'this->${id} = blocks::pdu_to_tagged_stream::make(${type.tv}, ${tag});' + translations: + blocks.: 'blocks::' + file_format: 1 diff --git a/gr-blocks/grc/blocks_peak_detector2_fb.block.yml b/gr-blocks/grc/blocks_peak_detector2_fb.block.yml index 0950640ae2..4eb522844b 100644 --- a/gr-blocks/grc/blocks_peak_detector2_fb.block.yml +++ b/gr-blocks/grc/blocks_peak_detector2_fb.block.yml @@ -1,5 +1,6 @@ id: blocks_peak_detector2_fb label: Peak Detector2 +flags: [ python, cpp ] parameters: - id: threshold_factor_rise @@ -35,4 +36,13 @@ templates: - set_look_ahead(${look_ahead}) - set_alpha(${alpha}) +cpp_templates: + includes: ['#include <gnuradio/blocks/peak_detector2_fb.h>'] + declarations: 'blocks::peak_detector2_fb::sptr ${id};' + make: 'this->${id} = blocks::peak_detector2_fb::make(${threshold_factor_rise}, ${look_ahead}, ${alpha});' + callbacks: + - set_threshold_factor_rise(${threshold_factor_rise}) + - set_look_ahead(${look_ahead}) + - set_alpha(${alpha}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_peak_detector_xb.block.yml b/gr-blocks/grc/blocks_peak_detector_xb.block.yml index be0f238391..a921c626f4 100644 --- a/gr-blocks/grc/blocks_peak_detector_xb.block.yml +++ b/gr-blocks/grc/blocks_peak_detector_xb.block.yml @@ -1,5 +1,6 @@ id: blocks_peak_detector_xb label: Peak Detector +flags: [ python, cpp ] parameters: - id: type @@ -44,4 +45,15 @@ templates: - set_look_ahead(${look_ahead}) - set_alpha(${alpha}) +cpp_templates: + includes: ['#include <gnuradio/blocks/peak_detector.h>'] + declarations: 'blocks::peak_detector_${type.fcn}b::sptr ${id};' + make: 'this->${id} = blocks::peak_detector_${type.fcn}b::make(${threshold_factor_rise}, ${threshold_factor_fall}, + ${look_ahead}, ${alpha});' + callbacks: + - set_threshold_factor_rise(${threshold_factor_rise}) + - set_threshold_factor_fall(${threshold_factor_fall}) + - set_look_ahead(${look_ahead}) + - set_alpha(${alpha}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_plateau_detector_fb.block.yml b/gr-blocks/grc/blocks_plateau_detector_fb.block.yml index 09ae10b340..d8397719bb 100644 --- a/gr-blocks/grc/blocks_plateau_detector_fb.block.yml +++ b/gr-blocks/grc/blocks_plateau_detector_fb.block.yml @@ -1,5 +1,6 @@ id: blocks_plateau_detector_fb label: Plateau Detector +flags: [ python, cpp ] parameters: - id: max_len @@ -24,4 +25,9 @@ templates: callbacks: - set_threshold(${threshold}) +cpp_templates: + includes: ['#include <gnuradio/blocks/plateau_detector_fb.h>'] + declarations: 'blocks::plateau_detector_fb::sptr ${id};' + make: 'this->${id} = blocks::plateau_detector_fb::make(${max_len}, ${threshold});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_probe_rate.block.yml b/gr-blocks/grc/blocks_probe_rate.block.yml index 1f9ed65b2b..6cfa4ab616 100644 --- a/gr-blocks/grc/blocks_probe_rate.block.yml +++ b/gr-blocks/grc/blocks_probe_rate.block.yml @@ -1,5 +1,6 @@ id: blocks_probe_rate label: Probe Rate +flags: [ python, cpp ] parameters: - id: type @@ -41,4 +42,11 @@ templates: imports: from gnuradio import blocks make: blocks.probe_rate(${type.size}*${vlen}, ${mintime}, ${alpha}) +cpp_templates: + includes: ['#include <gnuradio/blocks/probe_rate.h>'] + declarations: 'blocks::probe_rate::sptr ${id};' + make: 'this->${id} = blocks::probe_rate::make(${type.size}*${vlen}, ${mintime}, ${alpha});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_probe_signal_vx.block.yml b/gr-blocks/grc/blocks_probe_signal_vx.block.yml index 2b486a55b2..98ca992f96 100644 --- a/gr-blocks/grc/blocks_probe_signal_vx.block.yml +++ b/gr-blocks/grc/blocks_probe_signal_vx.block.yml @@ -1,5 +1,6 @@ id: blocks_probe_signal_vx label: Probe Signal Vector +flags: [ python, cpp ] parameters: - id: type @@ -27,6 +28,11 @@ templates: imports: from gnuradio import blocks make: blocks.probe_signal_v${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/probe_signal_v.h>'] + declarations: 'blocks::probe_signal_v${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::probe_signal_v${type.fcn}::make(${vlen});' + documentation: |- Available functions to probe: level() diff --git a/gr-blocks/grc/blocks_probe_signal_x.block.yml b/gr-blocks/grc/blocks_probe_signal_x.block.yml index 0991bde99f..082d2e1e01 100644 --- a/gr-blocks/grc/blocks_probe_signal_x.block.yml +++ b/gr-blocks/grc/blocks_probe_signal_x.block.yml @@ -1,5 +1,6 @@ id: blocks_probe_signal_x label: Probe Signal +flags: [ python, cpp ] parameters: - id: type @@ -18,6 +19,11 @@ templates: imports: from gnuradio import blocks make: blocks.probe_signal_${type.fcn}() +cpp_templates: + includes: ['#include <gnuradio/blocks/probe_signal.h>'] + declarations: 'blocks::probe_signal_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::probe_signal_${type.fcn}::make();' + documentation: |- Available functions to probe: level() diff --git a/gr-blocks/grc/blocks_random_pdu.block.yml b/gr-blocks/grc/blocks_random_pdu.block.yml index 831b7eb4c2..5017e0f00f 100644 --- a/gr-blocks/grc/blocks_random_pdu.block.yml +++ b/gr-blocks/grc/blocks_random_pdu.block.yml @@ -1,5 +1,6 @@ id: blocks_random_pdu label: Random PDU Generator +flags: [ python ] parameters: - id: minsize diff --git a/gr-blocks/grc/blocks_regenerate_bb.block.yml b/gr-blocks/grc/blocks_regenerate_bb.block.yml index 843e680a41..ce8ad79592 100644 --- a/gr-blocks/grc/blocks_regenerate_bb.block.yml +++ b/gr-blocks/grc/blocks_regenerate_bb.block.yml @@ -1,5 +1,6 @@ id: blocks_regenerate_bb label: Regenerate +flags: [ python, cpp ] parameters: - id: period @@ -22,4 +23,9 @@ templates: imports: from gnuradio import blocks make: blocks.regenerate_bb(${period}, ${max_regen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/regenerate_bb.h>'] + declarations: 'blocks::regenerate_bb::sptr ${id};' + make: 'this->${id} = blocks::regenerate_bb::make(${period}, ${max_regen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_repack_bits_bb.block.yml b/gr-blocks/grc/blocks_repack_bits_bb.block.yml index 9d5a3ba9ca..36bc996df4 100644 --- a/gr-blocks/grc/blocks_repack_bits_bb.block.yml +++ b/gr-blocks/grc/blocks_repack_bits_bb.block.yml @@ -1,5 +1,6 @@ id: blocks_repack_bits_bb label: Repack Bits +flags: [ python, cpp ] parameters: - id: k @@ -44,4 +45,14 @@ templates: callbacks: - set_k_and_l(${k},${l}) +cpp_templates: + includes: ['#include <gnuradio/blocks/repack_bits_bb.h>'] + declarations: 'blocks::repack_bits_bb::sptr ${id};' + make: 'this->${id} = blocks::repack_bits_bb::make(${k}, ${l}, ${len_tag_key}, ${align_output}, ${endianness});' + callbacks: + - set_k_and_l(${k},${l}) + translations: + gr.: '' + 'True': 'true' + 'False': 'false' file_format: 1 diff --git a/gr-blocks/grc/blocks_repeat.block.yml b/gr-blocks/grc/blocks_repeat.block.yml index 809231d293..8a961d2672 100644 --- a/gr-blocks/grc/blocks_repeat.block.yml +++ b/gr-blocks/grc/blocks_repeat.block.yml @@ -1,5 +1,6 @@ id: blocks_repeat label: Repeat +flags: [ python, cpp ] parameters: - id: type @@ -38,4 +39,13 @@ templates: callbacks: - set_interpolation(${interp}) +cpp_templates: + includes: ['#include <gnuradio/blocks/repeat.h>'] + declarations: 'blocks::repeat::sptr ${id};' + make: 'this->${id} = blocks::repeat::make(${type.size}*${vlen}, ${interp});' + callbacks: + - set_interpolation(${interp}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_rms_xx.block.yml b/gr-blocks/grc/blocks_rms_xx.block.yml index ca5e8df124..85647b520e 100644 --- a/gr-blocks/grc/blocks_rms_xx.block.yml +++ b/gr-blocks/grc/blocks_rms_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_rms_xx label: RMS +flags: [ python, cpp ] parameters: - id: type @@ -28,4 +29,11 @@ templates: callbacks: - set_alpha(${alpha}) +cpp_templates: + includes: ['#include <gnuradio/blocks/rms_${type.fcn}f.h>'] + declarations: 'blocks::rms_${type.fcn}f::sptr ${id};' + make: 'this->${id} = blocks::rms_${type.fcn}f::make(${alpha});' + callbacks: + - set_alpha(${alpha}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_rotator_cc.block.yml b/gr-blocks/grc/blocks_rotator_cc.block.yml index d65fbd5997..19143f98bb 100644 --- a/gr-blocks/grc/blocks_rotator_cc.block.yml +++ b/gr-blocks/grc/blocks_rotator_cc.block.yml @@ -1,5 +1,6 @@ id: blocks_rotator_cc label: Rotator +flags: [ python, cpp ] parameters: - id: phase_inc @@ -21,4 +22,11 @@ templates: callbacks: - set_phase_inc(${phase_inc}) +cpp_templates: + includes: ['#include <gnuradio/blocks/rotator_cc.h>'] + declarations: 'blocks::rotator_cc::sptr ${id};' + make: 'this->${id} = blocks::rotator_cc::make(${phase_inc});' + callbacks: + - set_phase_inc(${phase_inc}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml b/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml index 893e7862b2..39765f5b8d 100644 --- a/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml +++ b/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_sample_and_hold_xx label: Sample and Hold +flags: [ python, cpp ] parameters: - id: type @@ -25,4 +26,9 @@ templates: imports: from gnuradio import blocks make: blocks.sample_and_hold_${type.fcn}() +cpp_templates: + includes: ['#include <gnuradio/blocks/sample_and_hold.h>'] + declarations: 'blocks::sample_and_hold_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::sample_and_hold_${type.fcn}::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_short_to_char.block.yml b/gr-blocks/grc/blocks_short_to_char.block.yml index d24df725da..c5257ebf55 100644 --- a/gr-blocks/grc/blocks_short_to_char.block.yml +++ b/gr-blocks/grc/blocks_short_to_char.block.yml @@ -1,5 +1,6 @@ id: blocks_short_to_char label: Short To Char +flags: [ python, cpp ] parameters: - id: vlen @@ -22,4 +23,9 @@ templates: imports: from gnuradio import blocks make: blocks.short_to_char(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/short_to_char.h>'] + declarations: 'blocks::short_to_char::sptr ${id};' + make: 'this->${id} = blocks::short_to_char::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_short_to_float.block.yml b/gr-blocks/grc/blocks_short_to_float.block.yml index 8ad5f7ed13..49f73825d1 100644 --- a/gr-blocks/grc/blocks_short_to_float.block.yml +++ b/gr-blocks/grc/blocks_short_to_float.block.yml @@ -1,5 +1,6 @@ id: blocks_short_to_float label: Short To Float +flags: [ python, cpp ] parameters: - id: vlen @@ -28,4 +29,11 @@ templates: callbacks: - set_scale(${scale}) +cpp_templates: + includes: ['#include <gnuradio/blocks/short_to_float.h>'] + declarations: 'blocks::short_to_float::sptr ${id};' + make: 'this->${id} = blocks::short_to_float::make(${vlen}, ${scale});' + callbacks: + - set_scale(${scale}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_skiphead.block.yml b/gr-blocks/grc/blocks_skiphead.block.yml index c0f10eb2d1..2fa3928d00 100644 --- a/gr-blocks/grc/blocks_skiphead.block.yml +++ b/gr-blocks/grc/blocks_skiphead.block.yml @@ -1,5 +1,6 @@ id: blocks_skiphead label: Skip Head +flags: [ python, cpp ] parameters: - id: type @@ -37,4 +38,11 @@ templates: imports: from gnuradio import blocks make: blocks.skiphead(${type.size}*${vlen}, ${num_items}) +cpp_templates: + includes: ['#include <gnuradio/blocks/skiphead.h>'] + declarations: 'blocks::skiphead::sptr ${id};' + make: 'this->${id} = blocks::skiphead::make(${type.size}*${vlen}, ${num_items});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_socket_pdu.block.yml b/gr-blocks/grc/blocks_socket_pdu.block.yml index 537abac52e..13d4d3b7a4 100644 --- a/gr-blocks/grc/blocks_socket_pdu.block.yml +++ b/gr-blocks/grc/blocks_socket_pdu.block.yml @@ -1,5 +1,6 @@ id: blocks_socket_pdu label: Socket PDU +flags: [ python, cpp ] parameters: - id: type @@ -41,6 +42,14 @@ templates: imports: from gnuradio import blocks make: blocks.socket_pdu(${repr(type)}, ${host}, ${port}, ${mtu}, ${tcp_no_delay}) +cpp_templates: + includes: ['#include <gnuradio/blocks/socket_pdu.h>'] + declarations: 'blocks::socket_pdu::sptr ${id};' + make: 'this->${id} = blocks::socket_pdu::make(${type}, ${host}, ${port}, ${mtu}, ${tcp_no_delay});' + translations: + 'True': 'true' + 'False': 'false' + documentation: |- For server modes, leave Host blank to bind to all interfaces (equivalent to 0.0.0.0). diff --git a/gr-blocks/grc/blocks_stream_mux.block.yml b/gr-blocks/grc/blocks_stream_mux.block.yml index 27d3baf89f..80eb59eb0e 100644 --- a/gr-blocks/grc/blocks_stream_mux.block.yml +++ b/gr-blocks/grc/blocks_stream_mux.block.yml @@ -1,5 +1,6 @@ id: blocks_stream_mux label: Stream Mux +flags: [ python, cpp ] parameters: - id: type @@ -45,4 +46,11 @@ templates: imports: from gnuradio import blocks make: blocks.stream_mux(${type.size}*${vlen}, ${lengths}) +cpp_templates: + includes: ['#include <gnuradio/blocks/stream_mux.h>'] + declarations: 'blocks::stream_mux::sptr ${id};' + make: 'this->${id} = blocks::stream_mux::make(${type.size}*${vlen}, ${lengths});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_stream_to_streams.block.yml b/gr-blocks/grc/blocks_stream_to_streams.block.yml index 16adb159a3..ebfbafb12d 100644 --- a/gr-blocks/grc/blocks_stream_to_streams.block.yml +++ b/gr-blocks/grc/blocks_stream_to_streams.block.yml @@ -1,5 +1,6 @@ id: blocks_stream_to_streams label: Stream to Streams +flags: [ python, cpp ] parameters: - id: type @@ -40,4 +41,11 @@ templates: imports: from gnuradio import blocks make: blocks.stream_to_streams(${type.size}*${vlen}, ${num_streams}) +cpp_templates: + includes: ['#include <gnuradio/blocks/stream_to_streams.h>'] + declarations: 'blocks::stream_to_streams::sptr ${id};' + make: 'this->${id} = blocks::stream_to_streams::make(${type.size}*${vlen}, ${num_streams});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml b/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml index db75c20dd7..950efd6eb3 100644 --- a/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml +++ b/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml @@ -1,5 +1,6 @@ id: blocks_stream_to_tagged_stream label: Stream to Tagged Stream +flags: [ python, cpp ] parameters: - id: type @@ -40,4 +41,14 @@ templates: - set_packet_len(${packet_len}) - set_packet_len_pmt(${packet_len}) +cpp_templates: + includes: ['#include <gnuradio/blocks/stream_to_tagged_stream.h>'] + declarations: 'blocks::stream_to_tagged_stream::sptr ${id};' + make: 'this->${id} = blocks::stream_to_tagged_stream::make(${type.size}, ${vlen}, ${packet_len}, ${len_tag_key});' + callbacks: + - set_packet_len(${packet_len}) + - set_packet_len_pmt(${packet_len}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_stream_to_vector.block.yml b/gr-blocks/grc/blocks_stream_to_vector.block.yml index 73e177d0c7..1ab4dfb6a5 100644 --- a/gr-blocks/grc/blocks_stream_to_vector.block.yml +++ b/gr-blocks/grc/blocks_stream_to_vector.block.yml @@ -1,5 +1,6 @@ id: blocks_stream_to_vector label: Stream to Vector +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,9 @@ templates: imports: from gnuradio import blocks make: blocks.stream_to_vector(${type.size}*${vlen}, ${num_items}) +cpp_templates: + includes: ['#include <gnuradio/blocks/stream_to_vector.h>'] + declarations: 'blocks::stream_to_vector::sptr ${id};' + make: 'this->${id} = blocks::stream_to_vector::make(${type.size}*${vlen}, ${num_items});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml b/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml index c5b4e2059d..ee0c5dc8b5 100644 --- a/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml +++ b/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml @@ -1,5 +1,6 @@ id: blocks_stream_to_vector_decimator label: Stream to Vec Decim +flags: [ python ] parameters: - id: type diff --git a/gr-blocks/grc/blocks_streams_to_stream.block.yml b/gr-blocks/grc/blocks_streams_to_stream.block.yml index 404fcb0125..3fa6cfda03 100644 --- a/gr-blocks/grc/blocks_streams_to_stream.block.yml +++ b/gr-blocks/grc/blocks_streams_to_stream.block.yml @@ -1,5 +1,6 @@ id: blocks_streams_to_stream label: Streams to Stream +flags: [ python, cpp ] parameters: - id: type @@ -40,4 +41,11 @@ templates: imports: from gnuradio import blocks make: blocks.streams_to_stream(${type.size}*${vlen}, ${num_streams}) +cpp_templates: + includes: ['#include <gnuradio/blocks/streams_to_stream.h>'] + declarations: 'blocks::streams_to_stream::sptr ${id};' + make: 'this->${id} = blocks::streams_to_stream::make(${type.size}*${vlen}, ${num_streams});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_streams_to_vector.block.yml b/gr-blocks/grc/blocks_streams_to_vector.block.yml index d16d1e9384..baf0c1b5eb 100644 --- a/gr-blocks/grc/blocks_streams_to_vector.block.yml +++ b/gr-blocks/grc/blocks_streams_to_vector.block.yml @@ -1,5 +1,6 @@ id: blocks_streams_to_vector label: Streams to Vector +flags: [ python, cpp ] parameters: - id: type @@ -40,4 +41,11 @@ templates: imports: from gnuradio import blocks make: blocks.streams_to_vector(${type.size}*${vlen}, ${num_streams}) +cpp_templates: + includes: ['#include <gnuradio/blocks/streams_to_vector.h>'] + declarations: 'blocks::streams_to_vector::sptr ${id};' + make: 'this->${id} = blocks::streams_to_vector::make(${type.size}*${vlen}, ${num_streams});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_stretch_ff.block.yml b/gr-blocks/grc/blocks_stretch_ff.block.yml index 95921538c0..df4f48fb98 100644 --- a/gr-blocks/grc/blocks_stretch_ff.block.yml +++ b/gr-blocks/grc/blocks_stretch_ff.block.yml @@ -1,5 +1,6 @@ id: blocks_stretch_ff label: Stretch +flags: [ python, cpp ] parameters: - id: lo @@ -25,4 +26,9 @@ templates: imports: from gnuradio import blocks make: blocks.stretch_ff(${lo}, ${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/stretch_ff.h>'] + declarations: 'blocks::stretch_ff::sptr ${id};' + make: 'this->${id} = blocks::stretch_ff::make(${lo}, ${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_sub_xx.block.yml b/gr-blocks/grc/blocks_sub_xx.block.yml index 0cfab09407..191f8f9746 100644 --- a/gr-blocks/grc/blocks_sub_xx.block.yml +++ b/gr-blocks/grc/blocks_sub_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_sub_xx label: Subtract +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,9 @@ templates: imports: from gnuradio import blocks make: blocks.sub_${type.fcn}(${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/sub.h>'] + declarations: 'blocks::sub_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::sub_${type.fcn}::make(${vlen});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tag_debug.block.yml b/gr-blocks/grc/blocks_tag_debug.block.yml index 4bab9b94dd..17ec9275e7 100644 --- a/gr-blocks/grc/blocks_tag_debug.block.yml +++ b/gr-blocks/grc/blocks_tag_debug.block.yml @@ -1,5 +1,6 @@ id: blocks_tag_debug label: Tag Debug +flags: [ python, cpp ] parameters: - id: type @@ -52,4 +53,17 @@ templates: callbacks: - set_display(${display}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tag_debug.h>'] + declarations: 'blocks::tag_debug::sptr ${id};' + make: |- + this->${id} = blocks::tag_debug::make(${type.size}*${vlen}, ${name}, ${filter}); + this->${id}.set_display(${display}); + callbacks: + - set_display(${display}) + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tag_gate.block.yml b/gr-blocks/grc/blocks_tag_gate.block.yml index a05ee3c276..9b8198282e 100644 --- a/gr-blocks/grc/blocks_tag_gate.block.yml +++ b/gr-blocks/grc/blocks_tag_gate.block.yml @@ -1,5 +1,6 @@ id: blocks_tag_gate label: Tag Gate +flags: [ python, cpp ] parameters: - id: type @@ -47,4 +48,16 @@ templates: callbacks: - self.${id}.set_single_key(${single_key}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tag_gate.h>'] + make: |- + this->${id} = blocks::tag_gate::make(${type.size} * ${vlen}, ${propagate_tags}); + this->${id}.set_single_key(${single_key}); + callbacks: + - self.${id}.set_single_key(${single_key}) + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tag_object.block.yml b/gr-blocks/grc/blocks_tag_object.block.yml index cf0f996470..a845f69b45 100644 --- a/gr-blocks/grc/blocks_tag_object.block.yml +++ b/gr-blocks/grc/blocks_tag_object.block.yml @@ -1,5 +1,6 @@ id: variable_tag_object label: Tag Object +flags: [ python ] parameters: - id: offset diff --git a/gr-blocks/grc/blocks_tag_share.block.yml b/gr-blocks/grc/blocks_tag_share.block.yml index 96096ef58c..03bd3f981e 100644 --- a/gr-blocks/grc/blocks_tag_share.block.yml +++ b/gr-blocks/grc/blocks_tag_share.block.yml @@ -1,5 +1,6 @@ id: blocks_tag_share label: Tag Share +flags: [ python, cpp ] parameters: - id: io_type @@ -45,4 +46,11 @@ templates: imports: from gnuradio import blocks make: blocks.tag_share(${io_type.size}, ${share_type.size}, ${vlen}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tag_share.h>'] + declarations: 'blocks::tag_share::sptr ${id};' + make: 'this->${id} = blocks::tag_share::make(${io_type.size}, ${share_type.size}, ${vlen});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tagged_file_sink.block.yml b/gr-blocks/grc/blocks_tagged_file_sink.block.yml index f70c78154b..fd1b884b69 100644 --- a/gr-blocks/grc/blocks_tagged_file_sink.block.yml +++ b/gr-blocks/grc/blocks_tagged_file_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_tagged_file_sink label: Tagged File Sink +flags: [ python, cpp ] parameters: - id: type @@ -32,4 +33,11 @@ templates: imports: from gnuradio import blocks make: blocks.tagged_file_sink(${type.size}*${vlen}, ${samp_rate}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tagged_file_sink.h>'] + declarations: 'blocks::tagged_file_sink::sptr ${id};' + make: 'this->${id} = blocks::tagged_file_sink::make(${type.size}*${vlen}, ${samp_rate});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tagged_stream_align.block.yml b/gr-blocks/grc/blocks_tagged_stream_align.block.yml index cfc5a7717a..cfe7680603 100644 --- a/gr-blocks/grc/blocks_tagged_stream_align.block.yml +++ b/gr-blocks/grc/blocks_tagged_stream_align.block.yml @@ -1,5 +1,6 @@ id: blocks_tagged_stream_align label: Tagged Stream Align +flags: [ python, cpp ] parameters: - id: type @@ -34,4 +35,11 @@ templates: imports: from gnuradio import blocks make: blocks.tagged_stream_align(${type.size}*${vlen}, ${lengthtagname}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tagged_stream_align.h>'] + declarations: 'blocks::tagged_stream_align::sptr ${id};' + make: 'this->${id} = blocks::tagged_stream_align::make(${type.size}*${vlen}, ${lengthtagname});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml b/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml index 90fbcf0c21..58543117df 100644 --- a/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml +++ b/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml @@ -1,5 +1,6 @@ id: blocks_tagged_stream_multiply_length label: Tagged Stream Multiply Length Tag +flags: [ python, cpp ] parameters: - id: type @@ -43,4 +44,14 @@ templates: callbacks: - set_scalar(${c}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tagged_stream_multiply_length.h>'] + declarations: 'blocks::tagged_stream_multiply_length::sptr ${id};' + make: 'this->${id} = blocks.tagged_stream_multiply_length(${type.size}*${vlen}, ${lengthtagname}, + ${c});' + callbacks: + - set_scalar(${c}) + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tagged_stream_mux.block.yml b/gr-blocks/grc/blocks_tagged_stream_mux.block.yml index 4807e95d2b..5e79892957 100644 --- a/gr-blocks/grc/blocks_tagged_stream_mux.block.yml +++ b/gr-blocks/grc/blocks_tagged_stream_mux.block.yml @@ -1,5 +1,6 @@ id: blocks_tagged_stream_mux label: Tagged Stream Mux +flags: [ python, cpp ] parameters: - id: type @@ -43,4 +44,11 @@ templates: imports: from gnuradio import blocks make: blocks.tagged_stream_mux(${type.size}*${vlen}, ${lengthtagname}, ${tag_preserve_head_pos}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tagged_stream_mux.h>'] + declarations: 'blocks::tagged_stream_mux::sptr ${id};' + make: 'this->${id} = blocks::tagged_stream_mux::make(${type.size}*${vlen}, ${lengthtagname}, ${tag_preserve_head_pos});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml b/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml index e2292adb25..54fafdeec1 100644 --- a/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml +++ b/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml @@ -1,5 +1,6 @@ id: blocks_tagged_stream_to_pdu label: Tagged Stream to PDU +flags: [ python ] parameters: - id: type @@ -27,4 +28,9 @@ templates: imports: from gnuradio import blocks make: blocks.tagged_stream_to_pdu(${type.tv}, ${tag}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tagged_stream_to_pdu.h>'] + declarations: 'blocks::tagged_stream_to_pdu::sptr ${id};' + make: 'this->${id} = blocks::tagged_stream_to_pdu::make(${type.tv}, ${tag});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tags_strobe.block.yml b/gr-blocks/grc/blocks_tags_strobe.block.yml index 344fb9bde8..de9764d846 100644 --- a/gr-blocks/grc/blocks_tags_strobe.block.yml +++ b/gr-blocks/grc/blocks_tags_strobe.block.yml @@ -1,5 +1,6 @@ id: blocks_tags_strobe label: Tags Strobe +flags: [ python ] parameters: - id: type diff --git a/gr-blocks/grc/blocks_tcp_server_sink.block.yml b/gr-blocks/grc/blocks_tcp_server_sink.block.yml index fc8eae056b..110b49fb9c 100644 --- a/gr-blocks/grc/blocks_tcp_server_sink.block.yml +++ b/gr-blocks/grc/blocks_tcp_server_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_tcp_server_sink label: TCP Server Sink +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,13 @@ templates: imports: from gnuradio import blocks make: blocks.tcp_server_sink(${type.size}*${vlen}, ${ipaddr}, ${port}, ${noblock}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tcp_server_sink.h>'] + declarations: 'blocks::tcp_server_sink::sptr ${id};' + make: 'this->${id} = blocks::tcp_server_sink::make(${type.size}*${vlen}, ${ipaddr}, ${port}, ${noblock});' + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml b/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml index 1a873cc19c..6ff625792a 100644 --- a/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml +++ b/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml @@ -1,5 +1,6 @@ id: blocks_test_tag_variable_rate_ff label: Test Tag Variable Rate +flags: [ python, cpp ] parameters: - id: once @@ -26,4 +27,12 @@ templates: imports: from gnuradio import blocks make: blocks.test_tag_variable_rate_ff(${once}, ${step}) +cpp_templates: + includes: ['#include <gnuradio/blocks/test_tag_variable_rate_ff.h>'] + declarations: 'blocks::test_tag_variable_rate_ff::sptr ${id};' + make: 'this->${id} = blocks::test_tag_variable_rate_ff::make(${once}, ${step});' + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_threshold_ff.block.yml b/gr-blocks/grc/blocks_threshold_ff.block.yml index 52a6f10059..c3f70565d9 100644 --- a/gr-blocks/grc/blocks_threshold_ff.block.yml +++ b/gr-blocks/grc/blocks_threshold_ff.block.yml @@ -1,5 +1,6 @@ id: blocks_threshold_ff label: Threshold +flags: [ python, cpp ] parameters: - id: low @@ -30,4 +31,12 @@ templates: - set_hi(${high}) - set_lo(${low}) +cpp_templates: + includes: ['#include <gnuradio/blocks/threshold_ff.h>'] + declarations: 'blocks::threshold_ff::sptr ${id};' + make: 'this->${id} = blocks::threshold_ff::make(${low}, ${high}, ${init});' + callbacks: + - set_hi(${high}) + - set_lo(${low}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_throttle.block.yml b/gr-blocks/grc/blocks_throttle.block.yml index 8b497b60c4..3ea220ea6d 100644 --- a/gr-blocks/grc/blocks_throttle.block.yml +++ b/gr-blocks/grc/blocks_throttle.block.yml @@ -1,6 +1,6 @@ id: blocks_throttle label: Throttle -flags: throttle +flags: [ throttle, python, cpp ] parameters: - id: type @@ -45,4 +45,16 @@ templates: callbacks: - set_sample_rate(${samples_per_second}) +cpp_templates: + includes: ['#include <gnuradio/blocks/throttle.h>'] + declarations: 'blocks::throttle::sptr ${id};' + make: 'this->${id} = blocks::throttle::make(${type.size})*${vlen}, ${samples_per_second}, ${ignoretag});' + callbacks: + - set_sample_rate(${samples_per_second}) + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + + file_format: 1 diff --git a/gr-blocks/grc/blocks_transcendental.block.yml b/gr-blocks/grc/blocks_transcendental.block.yml index ca9e5cd0d3..d21f052613 100644 --- a/gr-blocks/grc/blocks_transcendental.block.yml +++ b/gr-blocks/grc/blocks_transcendental.block.yml @@ -1,5 +1,6 @@ id: blocks_transcendental label: Transcendental +flags: [ python, cpp ] parameters: - id: type @@ -27,4 +28,9 @@ templates: imports: from gnuradio import blocks make: blocks.transcendental(${name}, "${type}") +cpp_templates: + includes: ['#include <gnuradio/blocks/transcendental.h>'] + declarations: 'blocks::transcendental::sptr ${id};' + make: 'this->${id} = blocks::transcendental::make(${name}, "$type");' + file_format: 1 diff --git a/gr-blocks/grc/blocks_tuntap_pdu.block.yml b/gr-blocks/grc/blocks_tuntap_pdu.block.yml index 0fd183cbfe..2ab124eb02 100644 --- a/gr-blocks/grc/blocks_tuntap_pdu.block.yml +++ b/gr-blocks/grc/blocks_tuntap_pdu.block.yml @@ -1,5 +1,6 @@ id: blocks_tuntap_pdu label: TUNTAP PDU +flags: [ python, cpp ] parameters: - id: ifn @@ -31,4 +32,12 @@ templates: imports: from gnuradio import blocks make: blocks.tuntap_pdu(${ifn}, ${mtu}, ${istunflag}) +cpp_templates: + includes: ['#include <gnuradio/blocks/tuntap_pdu.h>'] + declarations: 'blocks::tuntap_pdu::sptr ${id};' + make: 'this->${id} = blocks::tuntap_pdu::make(${ifn}, ${mtu}, ${istunflag});' + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_uchar_to_float.block.yml b/gr-blocks/grc/blocks_uchar_to_float.block.yml index 984cbd3928..cf109446c3 100644 --- a/gr-blocks/grc/blocks_uchar_to_float.block.yml +++ b/gr-blocks/grc/blocks_uchar_to_float.block.yml @@ -1,5 +1,6 @@ id: blocks_uchar_to_float label: UChar To Float +flags: [ python, cpp ] inputs: - domain: stream @@ -13,4 +14,9 @@ templates: imports: from gnuradio import blocks make: blocks.uchar_to_float() +cpp_templates: + includes: ['#include <gnuradio/blocks/uchar_to_float.h>'] + declarations: 'blocks::uchar_to_float::sptr ${id};' + make: 'this->${id} = blocks::uchar_to_float::make();' + file_format: 1 diff --git a/gr-blocks/grc/blocks_udp_sink.block.yml b/gr-blocks/grc/blocks_udp_sink.block.yml index 1ffa83c033..b93478b90b 100644 --- a/gr-blocks/grc/blocks_udp_sink.block.yml +++ b/gr-blocks/grc/blocks_udp_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_udp_sink label: UDP Sink +flags: [ python, cpp ] parameters: - id: type @@ -42,4 +43,13 @@ templates: imports: from gnuradio import blocks make: blocks.udp_sink(${type.size}*${vlen}, ${ipaddr}, ${port}, ${psize}, ${eof}) +cpp_templates: + includes: ['#include <gnuradio/blocks/udp_sink.h>'] + declarations: 'blocks::udp_sink::sptr ${id};' + make: 'this->${id} = blocks::udp_sink::make(${type.size}*${vlen}, ${ipaddr}, ${port}, ${psize}, ${eof});' + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_udp_source.block.yml b/gr-blocks/grc/blocks_udp_source.block.yml index 1e15678158..84babb3c07 100644 --- a/gr-blocks/grc/blocks_udp_source.block.yml +++ b/gr-blocks/grc/blocks_udp_source.block.yml @@ -1,6 +1,6 @@ id: blocks_udp_source label: UDP Source -flags: throttle +flags: [ throttle, python, cpp ] parameters: - id: type @@ -45,4 +45,13 @@ templates: imports: from gnuradio import blocks make: blocks.udp_source(${type.size}*${vlen}, ${ipaddr}, ${port}, ${psize}, ${eof}) +cpp_templates: + includes: ['#include <gnuradio/blocks/udp_source.h>'] + declarations: 'blocks::udp_source::sptr ${id};' + make: 'this->${id} = blocks::udp_source::make(${type.size}*${vlen}, ${ipaddr}, ${port}, ${psize}, ${eof});' + translations: + gr.sizeof_: 'sizeof(' + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml b/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml index 065fc45ebf..dc1b7e837d 100644 --- a/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml +++ b/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml @@ -1,5 +1,6 @@ id: blocks_unpack_k_bits_bb label: Unpack K Bits +flags: [ python, cpp ] parameters: - id: k @@ -18,4 +19,9 @@ templates: imports: from gnuradio import blocks make: blocks.unpack_k_bits_bb(${k}) +cpp_templates: + includes: ['#include <gnuradio/blocks/unpack_k_bits_bb.h>'] + declarations: 'blocks::unpack_k_bits_bb::sptr ${id};' + make: 'this->${id} = blocks::unpack_k_bits_bb::make(${k});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml b/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml index 97c7af9e28..41c1860a76 100644 --- a/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml +++ b/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_unpacked_to_packed_xx label: Unpacked to Packed +flags: [ python ] parameters: - id: type @@ -41,4 +42,9 @@ templates: imports: from gnuradio import blocks make: blocks.unpacked_to_packed_${type.fcn}(${bits_per_chunk}, ${endianness}) +cpp_templates: + includes: ['#include <gnuradio/blocks/unpacked_to_packed.h>'] + declarations: 'blocks::unpacked_to_packed_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::unpacked_to_packed_${type.fcn}::make(${bits_per_chunk}, ${endianness});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_vco_c.block.yml b/gr-blocks/grc/blocks_vco_c.block.yml index b14b96bc54..d024f40e74 100644 --- a/gr-blocks/grc/blocks_vco_c.block.yml +++ b/gr-blocks/grc/blocks_vco_c.block.yml @@ -1,5 +1,6 @@ id: blocks_vco_c label: VCO (complex) +flags: [ python, cpp ] parameters: - id: samp_rate @@ -24,4 +25,9 @@ templates: imports: from gnuradio import blocks make: blocks.vco_c(${samp_rate}, ${sensitivity}, ${amplitude}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vco_c.h>'] + declarations: 'blocks::vco_c::sptr ${id};' + make: 'this->${id} = blocks::vco_c::make(${samp_rate}, ${sensitivity}, ${amplitude});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_vco_f.block.yml b/gr-blocks/grc/blocks_vco_f.block.yml index 79ade4d0af..44732222a3 100644 --- a/gr-blocks/grc/blocks_vco_f.block.yml +++ b/gr-blocks/grc/blocks_vco_f.block.yml @@ -1,5 +1,6 @@ id: blocks_vco_f label: VCO +flags: [ python, cpp ] parameters: - id: samp_rate @@ -24,4 +25,9 @@ templates: imports: from gnuradio import blocks make: blocks.vco_f(${samp_rate}, ${sensitivity}, ${amplitude}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vco_f.h>'] + declarations: 'blocks::vco_f::sptr ${id};' + make: 'this->${id} = blocks::vco_f::make(${samp_rate}, ${sensitivity}, ${amplitude});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_vector_insert_x.block.yml b/gr-blocks/grc/blocks_vector_insert_x.block.yml index d3b833865d..d849d04cf1 100644 --- a/gr-blocks/grc/blocks_vector_insert_x.block.yml +++ b/gr-blocks/grc/blocks_vector_insert_x.block.yml @@ -1,5 +1,6 @@ id: blocks_vector_insert_x label: Vector Insert +flags: [ python, cpp ] parameters: - id: type @@ -35,6 +36,11 @@ templates: imports: from gnuradio import blocks make: blocks.vector_insert_${type.fcn}(${vector}, ${period}, ${offset}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vector_insert.h>'] + declarations: 'blocks::vector_insert_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::vector_insert_${type.fcn}::make(${vector}, ${period}, ${offset});' + documentation: |- Periodicity, the length of the periodicity at which the vector should be inserted at the output. (i.e. one vector for every N output items) diff --git a/gr-blocks/grc/blocks_vector_sink_x.block.yml b/gr-blocks/grc/blocks_vector_sink_x.block.yml index 4ffa4ddfde..e5b65cb22e 100644 --- a/gr-blocks/grc/blocks_vector_sink_x.block.yml +++ b/gr-blocks/grc/blocks_vector_sink_x.block.yml @@ -1,5 +1,6 @@ id: blocks_vector_sink_x label: Vector Sink +flags: [ python, cpp ] parameters: - id: type @@ -32,4 +33,9 @@ templates: imports: from gnuradio import blocks make: blocks.vector_sink_${type.fcn}(${vlen}, ${reserve_items}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vector_sink.h>'] + declarations: 'blocks::vector_sink_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::vector_sink_${type.fcn}::make(${vlen}, ${reserve_items});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_vector_source_x.block.yml b/gr-blocks/grc/blocks_vector_source_x.block.yml index 5cdb6d6d51..7f452d5d1a 100644 --- a/gr-blocks/grc/blocks_vector_source_x.block.yml +++ b/gr-blocks/grc/blocks_vector_source_x.block.yml @@ -1,5 +1,6 @@ id: blocks_vector_source_x label: Vector Source +flags: [ python, cpp ] parameters: - id: type @@ -44,4 +45,14 @@ templates: callbacks: - set_data(${vector}, ${tags}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vector_source.h>'] + declarations: 'blocks::vector_source_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::vector_source_${type.fcn}::make(${vector}, ${repeat}, ${vlen}, ${tags});' + callbacks: + - set_data(${vector}, ${tags}) + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_vector_to_stream.block.yml b/gr-blocks/grc/blocks_vector_to_stream.block.yml index 77b42ab68d..af25469aad 100644 --- a/gr-blocks/grc/blocks_vector_to_stream.block.yml +++ b/gr-blocks/grc/blocks_vector_to_stream.block.yml @@ -1,5 +1,6 @@ id: blocks_vector_to_stream label: Vector to Stream +flags: [ python, cpp ] parameters: - id: type @@ -39,4 +40,9 @@ templates: imports: from gnuradio import blocks make: blocks.vector_to_stream(${type.size}*${vlen}, ${num_items}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vector_to_stream.h>'] + declarations: 'blocks::vector_to_stream::sptr ${id};' + make: 'this->${id} = blocks::vector_to_stream::make(${type.size}*${vlen}, ${num_items});' + file_format: 1 diff --git a/gr-blocks/grc/blocks_vector_to_streams.block.yml b/gr-blocks/grc/blocks_vector_to_streams.block.yml index e64df38534..5ffafd6abf 100644 --- a/gr-blocks/grc/blocks_vector_to_streams.block.yml +++ b/gr-blocks/grc/blocks_vector_to_streams.block.yml @@ -1,5 +1,6 @@ id: blocks_vector_to_streams label: Vector to Streams +flags: [ python, cpp ] parameters: - id: type @@ -40,4 +41,11 @@ templates: imports: from gnuradio import blocks make: blocks.vector_to_streams(${type.size}*${vlen}, ${num_streams}) +cpp_templates: + includes: ['#include <gnuradio/blocks/vector_to_streams.h>'] + declarations: 'blocks::vector_to_streams::sptr ${id};' + make: 'this->${id} = blocks::vector_to_streams::make(${type.size}*${vlen}, ${num_streams});' + translations: + gr.sizeof_: 'sizeof(' + file_format: 1 diff --git a/gr-blocks/grc/blocks_wavfile_sink.block.yml b/gr-blocks/grc/blocks_wavfile_sink.block.yml index 6bce90d0ec..20d956faaf 100644 --- a/gr-blocks/grc/blocks_wavfile_sink.block.yml +++ b/gr-blocks/grc/blocks_wavfile_sink.block.yml @@ -1,5 +1,6 @@ id: blocks_wavfile_sink label: Wav File Sink +flags: [ python, cpp ] parameters: - id: file @@ -33,4 +34,11 @@ templates: callbacks: - open(${file}) +cpp_templates: + includes: ['#include <gnuradio/blocks/wavfile_sink.h>'] + declarations: 'blocks::wavfile_sink::sptr ${id};' + make: 'this->${id} = blocks::wavfile_sink::make(${file}, ${nchan}, ${samp_rate}, ${bits_per_sample});' + callbacks: + - open(${file}) + file_format: 1 diff --git a/gr-blocks/grc/blocks_wavfile_source.block.yml b/gr-blocks/grc/blocks_wavfile_source.block.yml index 6a84ebbb83..387bef3afb 100644 --- a/gr-blocks/grc/blocks_wavfile_source.block.yml +++ b/gr-blocks/grc/blocks_wavfile_source.block.yml @@ -1,5 +1,6 @@ id: blocks_wavfile_source label: Wav File Source +flags: [ python, cpp ] parameters: - id: file @@ -29,4 +30,12 @@ templates: imports: from gnuradio import blocks make: blocks.wavfile_source(${file}, ${repeat}) +cpp_templates: + includes: ['#include <gnuradio/blocks/wavfile_source.h>'] + declarations: 'blocks::wavfile_source::sptr ${id};' + make: 'this->${id} = blocks::wavfile_source::make(${file}, ${repeat});' + translations: + 'True': 'true' + 'False': 'false' + file_format: 1 diff --git a/gr-blocks/grc/blocks_xor_xx.block.yml b/gr-blocks/grc/blocks_xor_xx.block.yml index 493afef0c2..d2ff0164f0 100644 --- a/gr-blocks/grc/blocks_xor_xx.block.yml +++ b/gr-blocks/grc/blocks_xor_xx.block.yml @@ -1,5 +1,6 @@ id: blocks_xor_xx label: Xor +flags: [ python, cpp ] parameters: - id: type @@ -31,4 +32,9 @@ templates: imports: from gnuradio import blocks make: blocks.xor_${type.fcn}() +cpp_templates: + includes: ['#include <gnuradio/blocks/xor_blk.h>'] + declarations: 'blocks::xor_${type.fcn}::sptr ${id};' + make: 'this->${id} = blocks::xor_${type.fcn}::make();' + file_format: 1 diff --git a/gr-blocks/grc/xmlrpc_client.block.yml b/gr-blocks/grc/xmlrpc_client.block.yml index 3e395ecca4..308629a680 100644 --- a/gr-blocks/grc/xmlrpc_client.block.yml +++ b/gr-blocks/grc/xmlrpc_client.block.yml @@ -1,5 +1,6 @@ id: xmlrpc_client label: XMLRPC Client +flags: [ python ] parameters: - id: addr diff --git a/gr-blocks/grc/xmlrpc_server.block.yml b/gr-blocks/grc/xmlrpc_server.block.yml index fb33fa79a8..4328f16f29 100644 --- a/gr-blocks/grc/xmlrpc_server.block.yml +++ b/gr-blocks/grc/xmlrpc_server.block.yml @@ -1,5 +1,6 @@ id: xmlrpc_server label: XMLRPC Server +flags: [ python ] parameters: - id: addr diff --git a/gr-qtgui/grc/qtgui_ber_sink_b.block.yml b/gr-qtgui/grc/qtgui_ber_sink_b.block.yml index d19a041e64..9f9c906858 100644 --- a/gr-qtgui/grc/qtgui_ber_sink_b.block.yml +++ b/gr-qtgui/grc/qtgui_ber_sink_b.block.yml @@ -1,5 +1,6 @@ id: qtgui_bercurve_sink label: QT GUI Bercurve Sink +flags: [ python ] parameters: - id: esno diff --git a/gr-qtgui/grc/qtgui_check_box.block.yml b/gr-qtgui/grc/qtgui_check_box.block.yml index e78c98379e..55b2bf9835 100644 --- a/gr-qtgui/grc/qtgui_check_box.block.yml +++ b/gr-qtgui/grc/qtgui_check_box.block.yml @@ -1,5 +1,6 @@ id: variable_qtgui_check_box label: QT GUI Check Box +flags: [ python ] parameters: - id: label diff --git a/gr-qtgui/grc/qtgui_chooser.block.yml b/gr-qtgui/grc/qtgui_chooser.block.yml index a38147f45c..5c93b52da2 100644 --- a/gr-qtgui/grc/qtgui_chooser.block.yml +++ b/gr-qtgui/grc/qtgui_chooser.block.yml @@ -1,5 +1,6 @@ id: variable_qtgui_chooser label: QT GUI Chooser +flags: [ python ] parameters: - id: label diff --git a/gr-qtgui/grc/qtgui_const_sink_x.block.yml b/gr-qtgui/grc/qtgui_const_sink_x.block.yml index 1231a9f32e..db1c8c9432 100644 --- a/gr-qtgui/grc/qtgui_const_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_const_sink_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_const_sink_x label: QT GUI Constellation Sink +flags: [ python ] parameters: - id: type diff --git a/gr-qtgui/grc/qtgui_edit_box_msg.block.yml b/gr-qtgui/grc/qtgui_edit_box_msg.block.yml index fa325c3e5b..45f17a3b03 100644 --- a/gr-qtgui/grc/qtgui_edit_box_msg.block.yml +++ b/gr-qtgui/grc/qtgui_edit_box_msg.block.yml @@ -1,5 +1,6 @@ id: qtgui_edit_box_msg label: QT GUI Message Edit Box +flags: [ python ] parameters: - id: type diff --git a/gr-qtgui/grc/qtgui_entry.block.yml b/gr-qtgui/grc/qtgui_entry.block.yml index 970099bbab..9979530d2d 100644 --- a/gr-qtgui/grc/qtgui_entry.block.yml +++ b/gr-qtgui/grc/qtgui_entry.block.yml @@ -1,5 +1,6 @@ id: variable_qtgui_entry label: QT GUI Entry +flags: [ python, cpp ] parameters: - id: label @@ -47,6 +48,28 @@ templates: lambda: self.set_${id}(${type.conv}(str(self._${id}_line_edit.text().toAscii())))) ${gui_hint() % win} +cpp_templates: + includes: ['#include <QToolBar>', '#include <QLineEdit>', '#include <QLabel>', '#include <QMetaObject>', '#include <QString>'] + declarations: |- + QToolBar *_${id}_tool_bar; + QLineEdit *_${id}_line_edit; + QLabel *_${id}_label; + var_make: ${id} = ${value}; + callbacks: + - set_${id}(${value}) + - QMetaObject::invokeMethod(this->_${id}_line_edit, "setText", Q_ARG(QString, + QString::number(${id}))) + link: ['gnuradio-qtgui', 'Qt5::Widgets'] + make: |- + this->_${id}_tool_bar = new QToolBar(); + this->_${id}_label = new QLabel(QString::fromStdString(std::string("${label.strip("'")}")+ std::string(":"))); + this->_${id}_tool_bar->addWidget(_${id}_label); + this->_${id}_line_edit = new QLineEdit(QString::number(this->${id})); + this->_${id}_tool_bar->addWidget(this->_${id}_line_edit); + QObject::connect(this->_${id}_line_edit, &QLineEdit::returnPressed, this, [this] () {this->set_${id}(this->_${id}_line_edit->text().toInt());}); + + this->top_layout->addWidget(this->_${id}_tool_bar); + documentation: |- This block creates a variable with a text entry box. Leave the label blank to use the variable id as the label. diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.block.yml b/gr-qtgui/grc/qtgui_freq_sink_x.block.yml index c8ed9991aa..d0b7f45eba 100644 --- a/gr-qtgui/grc/qtgui_freq_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_freq_sink_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_freq_sink_x label: QT GUI Frequency Sink +flags: [ python, cpp ] parameters: - id: type @@ -424,7 +425,7 @@ templates: % if type == "float" or type == "msg_float": self.${id}.set_plot_pos_half(not ${freqhalf}) - % endif + % endif labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5}, ${label6}, ${label7}, ${label8}, ${label9}, ${label10}] @@ -445,7 +446,75 @@ templates: self.${id}.set_line_alpha(i, alphas[i]) ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget) - ${gui_hint() % win} + ${ gui_hint() % win} + +cpp_templates: + includes: ['#include <gnuradio/qtgui/${type.fcn}.h>', '#include <gnuradio/filter/firdes.h>'] + declarations: 'qtgui::${type.fcn}::sptr ${id};' + callbacks: + - set_frequency_range(${fc}, ${bw}) + - set_update_time(${update_time}) + - set_y_axis(${ymin}, ${ymax}) + - this->${id}.set_trigger_mode(${tr_mode}, ${tr_level}, ${tr_chan}, ${tr_tag}) + link: ['gnuradio-qtgui', 'Qt5::Widgets'] + make: |- + this->${id} = qtgui::${type.fcn}::make( + ${fftsize}, // size + ${wintype}, // wintype + ${fc}, // fc + ${bw}, // bw + ${name}, // name + ${ 0 if (type == 'msg_complex' or type == 'msg_float') else nconnections } // nconnections + ); + + std::string labels[10] = {"${label1.strip("'")}", "${label2.strip("'")}", "${label3.strip("'")}", "${label4.strip("'")}", "${label5.strip("'")}", + "${label6.strip("'")}", "${label7.strip("'")}", "${label8.strip("'")}", "${label9.strip("'")}", "${label10.strip("'")}"}; + int widths[10] = {${width1}, ${width2}, ${width3}, ${width4}, ${width5}, + ${width6}, ${width7}, ${width8}, ${width9}, ${width10}}; + std::string colors[10] = {${color1}, ${color2}, ${color3}, ${color4}, ${color5}, + ${color6}, ${color7}, ${color8}, ${color9}, ${color10}}; + double alphas[10] = {${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5}, + ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}}; + + QWidget* _${id}_win; + + this->${id}->set_update_time(${update_time}); + this->${id}->set_y_axis(${ymin}, ${ymax}); + this->${id}->set_y_label("${label.strip("'")}", "${units.strip("'")}"); + this->${id}->set_trigger_mode(${tr_mode}, ${tr_level}, ${tr_chan}, ${tr_tag}); + this->${id}->enable_autoscale(${autoscale}); + this->${id}->enable_grid(${grid}); + this->${id}->set_fft_average(${average}); + this->${id}->enable_axis_labels(${axislabels}); + this->${id}->enable_control_panel(${ctrlpanel}); + + if (!${legend}) { + this->${id}->disable_legend(); // if (!legend) + } + + /* C++ doesn't have this + if ("${type}" == "float" or "${type}" == "msg_float") { + this->${id}->set_plot_pos_half(not ${freqhalf}); + }*/ + + for (int i = 0; i < ${ 1 if (type == 'msg_complex' or type == 'msg_float') else nconnections }; i++) { + if (sizeof(labels[i]) == 0) { + this->${id}->set_line_label(i, "Data " + std::to_string(i)); + } else { + this->${id}->set_line_label(i, labels[i]); + } + this->${id}->set_line_width(i, widths[i]); + this->${id}->set_line_color(i, colors[i]); + this->${id}->set_line_alpha(i, alphas[i]); + } + + _${id}_win = this->${id}->qwidget(); + this->top_layout->addWidget(_${id}_win); + translations: + firdes.: 'filter::firdes::' + 'True': 'true' + 'False': 'false' + qtgui.: 'qtgui::' documentation: |- The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional. diff --git a/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml b/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml index ec02c7466e..1159c2733a 100644 --- a/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_histogram_sink_x label: QT GUI Histogram Sink +flags: [ python ] parameters: - id: type diff --git a/gr-qtgui/grc/qtgui_label.block.yml b/gr-qtgui/grc/qtgui_label.block.yml index 468a6c6f83..c52753d398 100644 --- a/gr-qtgui/grc/qtgui_label.block.yml +++ b/gr-qtgui/grc/qtgui_label.block.yml @@ -1,5 +1,6 @@ id: variable_qtgui_label label: QT GUI Label +flags: [ python ] parameters: - id: label diff --git a/gr-qtgui/grc/qtgui_number_sink.block.yml b/gr-qtgui/grc/qtgui_number_sink.block.yml index efd192683b..b672592102 100644 --- a/gr-qtgui/grc/qtgui_number_sink.block.yml +++ b/gr-qtgui/grc/qtgui_number_sink.block.yml @@ -1,5 +1,6 @@ id: qtgui_number_sink label: QT GUI Number Sink +flags: [ python ] parameters: - id: name diff --git a/gr-qtgui/grc/qtgui_push_button.block.yml b/gr-qtgui/grc/qtgui_push_button.block.yml index 98ce4c9583..95abd69350 100644 --- a/gr-qtgui/grc/qtgui_push_button.block.yml +++ b/gr-qtgui/grc/qtgui_push_button.block.yml @@ -1,5 +1,6 @@ id: variable_qtgui_push_button label: QT GUI Push Button +flags: [ python ] parameters: - id: label diff --git a/gr-qtgui/grc/qtgui_range.block.yml b/gr-qtgui/grc/qtgui_range.block.yml index 70144e740a..a8b49ee46c 100644 --- a/gr-qtgui/grc/qtgui_range.block.yml +++ b/gr-qtgui/grc/qtgui_range.block.yml @@ -1,5 +1,6 @@ id: variable_qtgui_range label: QT GUI Range +flags: [ python ] parameters: - id: label diff --git a/gr-qtgui/grc/qtgui_sink_x.block.yml b/gr-qtgui/grc/qtgui_sink_x.block.yml index 6570ba5fec..79cc16f1ee 100644 --- a/gr-qtgui/grc/qtgui_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_sink_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_sink_x label: QT GUI Sink +flags: [ python ] parameters: - id: type diff --git a/gr-qtgui/grc/qtgui_tab_widget.block.yml b/gr-qtgui/grc/qtgui_tab_widget.block.yml index 6a7128aaf2..5f2e4271a7 100644 --- a/gr-qtgui/grc/qtgui_tab_widget.block.yml +++ b/gr-qtgui/grc/qtgui_tab_widget.block.yml @@ -1,5 +1,6 @@ id: qtgui_tab_widget label: QT GUI Tab Widget +flags: [ python ] parameters: - id: num_tabs diff --git a/gr-qtgui/grc/qtgui_time_raster_x.block.yml b/gr-qtgui/grc/qtgui_time_raster_x.block.yml index ea4ede5fb6..350c125afc 100644 --- a/gr-qtgui/grc/qtgui_time_raster_x.block.yml +++ b/gr-qtgui/grc/qtgui_time_raster_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_time_raster_sink_x label: QT GUI Time Raster Sink +flags: [ python ] parameters: - id: type diff --git a/gr-qtgui/grc/qtgui_time_sink_x.block.yml b/gr-qtgui/grc/qtgui_time_sink_x.block.yml index cf255d030f..b179020e49 100644 --- a/gr-qtgui/grc/qtgui_time_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_time_sink_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_time_sink_x label: QT GUI Time Sink +flags: [ python ] parameters: - id: type diff --git a/gr-qtgui/grc/qtgui_vector_sink_f.block.yml b/gr-qtgui/grc/qtgui_vector_sink_f.block.yml index b73897480d..f331524597 100644 --- a/gr-qtgui/grc/qtgui_vector_sink_f.block.yml +++ b/gr-qtgui/grc/qtgui_vector_sink_f.block.yml @@ -1,5 +1,6 @@ id: qtgui_vector_sink_f label: QT GUI Vector Sink +flags: [ python ] parameters: - id: name diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml b/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml index a0404a990c..add262f507 100644 --- a/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml @@ -1,5 +1,6 @@ id: qtgui_waterfall_sink_x label: QT GUI Waterfall Sink +flags: [ python, cpp ] parameters: - id: type @@ -279,7 +280,7 @@ templates: % if type == "float" or type == "msg_float": self.${id}.set_plot_pos_half(not ${freqhalf}) - % endif + % endif labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5}, ${label6}, ${label7}, ${label8}, ${label9}, ${label10}] @@ -301,6 +302,64 @@ templates: ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget) ${gui_hint() % win} +cpp_templates: + includes: ['#include <gnuradio/qtgui/${type.fcn}.h>', '#include <gnuradio/filter/firdes.h>'] + declarations: 'qtgui::${type.fcn}::sptr ${id};' + callbacks: + - set_frequency_range(${fc}, ${bw}) + - set_update_time(${update_time}) + link: ['gnuradio-qtgui', 'Qt5::Widgets'] + make: |- + this->${id} = qtgui::${type.fcn}::make( + ${fftsize}, // size + ${wintype}, // wintype + ${fc}, // fc + ${bw}, // bw + ${name}, // name + ${ (0 if type.startswith('msg') else nconnections) } // number of inputs + ); + + std::string labels[10] = {"${label1.strip("'")}", "${label2.strip("'")}", "${label3.strip("'")}", "${label4.strip("'")}", "${label5.strip("'")}", + "${label6.strip("'")}", "${label7.strip("'")}", "${label8.strip("'")}", "${label9.strip("'")}", "${label10.strip("'")}"}; + int colors[10] = {${color1 or 0}, ${color2 or 0}, ${color3 or 0}, ${color4 or 0}, ${color5 or 0}, + ${color6 or 0}, ${color7 or 0}, ${color8 or 0}, ${color9 or 0}, ${color10 or 0}}; + double alphas[10] = {${alpha1 or 1.0}, ${alpha2 or 1.0}, ${alpha3 or 1.0}, ${alpha4 or 1.0}, ${alpha5 or 1.0}, + ${alpha6 or 1.0}, ${alpha7 or 1.0}, ${alpha8 or 1.0}, ${alpha9 or 1.0}, ${alpha10 or 1.0}}; + + QWidget* _${id}_win; + + this->${id}->set_update_time(${update_time}); + this->${id}->enable_grid(${grid}); + this->${id}->enable_axis_labels(${axislabels}); + + if (!${legend}) { + this->${id}->disable_legend(); // if (!legend) + } + + /* C++ doesn't have this + if ("${type}" == "float" or "${type}" == "msg_float") { + this->${id}->set_plot_pos_half(not ${freqhalf}); + }*/ + + for (int i = 0; i < ${ 1 if (type == 'msg_complex' or type == 'msg_float') else nconnections }; i++) { + if (sizeof(labels[i]) == 0) { + this->${id}->set_line_label(i, "Data " + std::to_string(i)); + } else { + this->${id}->set_line_label(i, labels[i]); + } + this->${id}->set_color_map(i, colors[i]); + this->${id}->set_line_alpha(i, alphas[i]); + } + + this->${id}->set_intensity_range(${int_min}, ${int_max}); + + _${id}_win = this->${id}->qwidget(); + this->top_layout->addWidget(_${id}_win); + translations: + firdes.: 'filter::firdes::' + 'True': 'true' + 'False': 'false' + documentation: |- The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional. diff --git a/grc/blocks/import.block.yml b/grc/blocks/import.block.yml index 2d36b7396d..ad133af168 100644 --- a/grc/blocks/import.block.yml +++ b/grc/blocks/import.block.yml @@ -1,5 +1,6 @@ id: import_ label: Import +flags: [ python ] parameters: - id: imports diff --git a/grc/blocks/note.block.yml b/grc/blocks/note.block.yml index 3f21a75ceb..aeff390ecc 100644 --- a/grc/blocks/note.block.yml +++ b/grc/blocks/note.block.yml @@ -1,5 +1,6 @@ id: note label: Note +flags: [ python, cpp ] parameters: - id: note diff --git a/grc/blocks/options.block.yml b/grc/blocks/options.block.yml index 269351ddc0..89dc25a786 100644 --- a/grc/blocks/options.block.yml +++ b/grc/blocks/options.block.yml @@ -1,5 +1,6 @@ id: options label: Options +flags: ['python', 'cpp'] parameters: - id: title @@ -22,12 +23,36 @@ parameters: label: Canvas Size dtype: int_vector hide: part +- id: output_language + label: Output Language + dtype: enum + default: python + options: [python, cpp] + option_labels: [Python, C++] - id: generate_options label: Generate Options dtype: enum default: qt_gui options: [qt_gui, bokeh_gui, no_gui, hb, hb_qt_gui] option_labels: [QT GUI, Bokeh GUI, No GUI, Hier Block, Hier Block (QT GUI)] +- id: gen_linking + label: Linking + dtype: enum + default: dynamic + options: [dynamic, static] + option_labels: [ Dynamic, Static ] + hide: ${ ('part' if output_language == 'cpp' else 'all') } +- id: gen_cmake + label: Generate CMakeLists.txt + dtype: enum + default: 'On' + options: ['On', 'Off'] + hide: ${ ('part' if output_language == 'cpp' else 'all') } +- id: cmake_opt + label: CMake options + dtype: string + default: '' + hide: ${ ('part' if output_language == 'cpp' else 'all') } - id: category label: Category dtype: string @@ -130,6 +155,9 @@ templates: else: self.stop(); self.wait()' +cpp_templates: + includes: ['#include <gnuradio/top_block.h>'] + documentation: |- The options block sets special parameters for the flow graph. Only one option block is allowed per flow graph. diff --git a/grc/blocks/pad_sink.block.yml b/grc/blocks/pad_sink.block.yml index 5c5679a155..b0a93ee24f 100644 --- a/grc/blocks/pad_sink.block.yml +++ b/grc/blocks/pad_sink.block.yml @@ -1,5 +1,6 @@ id: pad_sink label: Pad Sink +flags: [ python, cpp ] parameters: - id: label @@ -14,6 +15,8 @@ parameters: option_attributes: size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short, gr.sizeof_char, gr.sizeof_char, '0', '0'] + cpp_size: [sizeof(gr_complex), sizeof(float), sizeof(int), sizeof(short), + sizeof(char), sizeof(char), '0', '0'] hide: part - id: vlen label: Vec Length diff --git a/grc/blocks/pad_source.block.yml b/grc/blocks/pad_source.block.yml index 6600fa7d0b..0377e6fb1f 100644 --- a/grc/blocks/pad_source.block.yml +++ b/grc/blocks/pad_source.block.yml @@ -1,5 +1,6 @@ id: pad_source label: Pad Source +flags: [ python, cpp ] parameters: - id: label @@ -14,6 +15,8 @@ parameters: option_attributes: size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short, gr.sizeof_char, gr.sizeof_char, '0', '0'] + cpp_size: [sizeof(gr_complex), sizeof(float), sizeof(int), sizeof(short), + sizeof(char), sizeof(char), '0', '0'] hide: part - id: vlen label: Vec Length diff --git a/grc/blocks/parameter.block.yml b/grc/blocks/parameter.block.yml index 387cbbf181..8add27550d 100644 --- a/grc/blocks/parameter.block.yml +++ b/grc/blocks/parameter.block.yml @@ -1,5 +1,6 @@ id: parameter label: Parameter +flags: [ python, cpp ] parameters: - id: label @@ -37,6 +38,10 @@ templates: var_make: self.${id} = ${id} make: ${value} +cpp_templates: + var_make: ${type.type} ${id} = ${id}; + make: ${value} + documentation: |- This block represents a parameter to the flow graph. A parameter can be used to pass command line arguments into a top block. Or, parameters can pass arguments into an instantiated hierarchical block. diff --git a/grc/blocks/stream.domain.yml b/grc/blocks/stream.domain.yml index a4d786f8b4..0a679cad01 100644 --- a/grc/blocks/stream.domain.yml +++ b/grc/blocks/stream.domain.yml @@ -8,3 +8,4 @@ multiple_connections_per_output: true templates: - type: [stream, stream] connect: self.connect(${ make_port_sig(source) }, ${ make_port_sig(sink) }) + cpp_connect: hier_block2::connect(${ make_port_sig(source) }, ${ make_port_sig(sink) }) diff --git a/grc/blocks/variable.block.yml b/grc/blocks/variable.block.yml index fa62dabe87..e7af34e5f6 100644 --- a/grc/blocks/variable.block.yml +++ b/grc/blocks/variable.block.yml @@ -1,5 +1,6 @@ id: variable label: Variable +flags: [ python, cpp ] parameters: - id: value @@ -13,6 +14,11 @@ templates: callbacks: - self.set_${id}(${value}) +cpp_templates: + var_make: ${id} = ${value}; + callbacks: + - this->set_${id}(${value}) + documentation: |- This block maps a value to a unique variable. This variable block has no graphical representation. diff --git a/grc/blocks/variable_config.block.yml b/grc/blocks/variable_config.block.yml index bb64ea2a8f..ecb2692301 100644 --- a/grc/blocks/variable_config.block.yml +++ b/grc/blocks/variable_config.block.yml @@ -1,5 +1,6 @@ id: variable_config label: Variable Config +flags: [ python ] parameters: - id: value diff --git a/grc/blocks/variable_function_probe.block.yml b/grc/blocks/variable_function_probe.block.yml index 702ab5d60e..c5b1b972da 100644 --- a/grc/blocks/variable_function_probe.block.yml +++ b/grc/blocks/variable_function_probe.block.yml @@ -1,5 +1,6 @@ id: variable_function_probe label: Function Probe +flags: [ python ] parameters: - id: block_id diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py index 2c3d6f26c7..bf26225e48 100644 --- a/grc/core/FlowGraph.py +++ b/grc/core/FlowGraph.py @@ -64,7 +64,7 @@ class FlowGraph(Element): def imports(self): """ - Get a set of all import statements in this flow graph namespace. + Get a set of all import statements (Python) in this flow graph namespace. Returns: a list of import statements @@ -73,7 +73,7 @@ class FlowGraph(Element): def get_variables(self): """ - Get a list of all variables in this flow graph namespace. + Get a list of all variables (Python) in this flow graph namespace. Exclude parameterized variables. Returns: diff --git a/grc/core/blocks/_build.py b/grc/core/blocks/_build.py index 0c41d1ae70..bed0f6934a 100644 --- a/grc/core/blocks/_build.py +++ b/grc/core/blocks/_build.py @@ -33,7 +33,7 @@ from ._templates import MakoTemplates def build(id, label='', category='', flags='', documentation='', value=None, asserts=None, - parameters=None, inputs=None, outputs=None, templates=None, **kwargs): + parameters=None, inputs=None, outputs=None, templates=None, cpp_templates=None, **kwargs): block_id = id cls = type(str(block_id), (Block,), {}) @@ -63,6 +63,17 @@ def build(id, label='', category='', flags='', documentation='', callbacks=templates.get('callbacks', []), var_make=templates.get('var_make', ''), ) + + cpp_templates = cpp_templates or {} + cls.cpp_templates = MakoTemplates( + includes=cpp_templates.get('includes', ''), + make=cpp_templates.get('make', ''), + callbacks=cpp_templates.get('callbacks', []), + var_make=cpp_templates.get('var_make', ''), + link=cpp_templates.get('link', []), + translations=cpp_templates.get('translations', []), + declarations=cpp_templates.get('declarations', ''), + ) # todo: MakoTemplates.compile() to check for errors cls.value = _single_mako_expr(value, block_id) @@ -149,4 +160,3 @@ def _validate_option_attributes(param_data, block_id): if key in dir(str): del param_data['option_attributes'][key] send_warning('{} - option_attribute "{}" overrides str, ignoring'.format(block_id, key)) - diff --git a/grc/core/blocks/_flags.py b/grc/core/blocks/_flags.py index bbedd6a2d7..dedbb5a485 100644 --- a/grc/core/blocks/_flags.py +++ b/grc/core/blocks/_flags.py @@ -25,6 +25,8 @@ class Flags(object): NEED_QT_GUI = 'need_qt_gui' DEPRECATED = 'deprecated' NOT_DSP = 'not_dsp' + HAS_PYTHON = 'python' + HAS_CPP = 'cpp' def __init__(self, flags): self.data = set(flags) diff --git a/grc/core/blocks/block.py b/grc/core/blocks/block.py index c3502397ec..d795d04912 100644 --- a/grc/core/blocks/block.py +++ b/grc/core/blocks/block.py @@ -21,9 +21,13 @@ from __future__ import absolute_import import collections import itertools +import copy import six from six.moves import range +import re + +import ast from ._templates import MakoTemplates from ._flags import Flags @@ -31,7 +35,6 @@ from ._flags import Flags from ..base import Element from ..utils.descriptors import lazy_property - def _get_elem(iterable, key): items = list(iterable) for item in items: @@ -49,6 +52,7 @@ class Block(Element): key = '' label = '' category = '' + vtype = '' # This is only used for variables when we want C++ output flags = Flags('') documentation = {'': ''} @@ -83,6 +87,7 @@ class Block(Element): self.active_sinks = [] # on rewrite self.states = {'state': True} + self.orig_cpp_templates = self.cpp_templates # The original template, in case we have to edit it when transpiling to C++ # region Rewrite_and_Validation def rewrite(self): @@ -136,6 +141,7 @@ class Block(Element): Element.validate(self) self._run_asserts() self._validate_generate_mode_compat() + self._validate_output_language_compat() self._validate_var_value() def _run_asserts(self): @@ -161,6 +167,18 @@ class Block(Element): check_generate_mode('QT GUI', Flags.NEED_QT_GUI, ('qt_gui', 'hb_qt_gui')) + def _validate_output_language_compat(self): + """check if this block supports the selected output language""" + current_output_language = self.parent.get_option('output_language') + + if current_output_language == 'cpp': + if 'cpp' not in self.flags: + self.add_error_message("This block does not support C++ output.") + + if self.key == 'parameter': + if not self.params['type'].value: + self.add_error_message("C++ output requires you to choose a parameter type.") + def _validate_var_value(self): """or variables check the value (only if var_value is used)""" if self.is_variable and self.value != 'value': @@ -227,6 +245,9 @@ class Block(Element): def get_var_make(self): return self.templates.render('var_make') + def get_cpp_var_make(self): + return self.cpp_templates.render('var_make') + def get_var_value(self): return self.templates.render('var_value') @@ -241,8 +262,90 @@ class Block(Element): if 'self.' in callback: return callback return 'self.{}.{}'.format(self.name, callback) + return [make_callback(c) for c in self.templates.render('callbacks')] + def get_cpp_callbacks(self): + """ + Get a list of C++ function callbacks for this block. + + Returns: + a list of strings + """ + def make_callback(callback): + if self.is_variable: + return callback + if 'this->' in callback: + return callback + return 'this->{}->{}'.format(self.name, callback) + + return [make_callback(c) for c in self.cpp_templates.render('callbacks')] + + def decide_type(self): + """ + Evaluate the value of the variable block and decide its type. + + Returns: + None + """ + value = self.params['value'].value + self.cpp_templates = copy.copy(self.orig_cpp_templates) + + def get_type(element): + try: + evaluated = ast.literal_eval(element) + + except ValueError or SyntaxError: + if re.match(r'^(numpy|np|scipy|sp)\.pi$', value): + return 'pi' + else: + return 'std::string' + + else: + _vtype = type(evaluated) + if _vtype in [int, float, bool, list]: + if _vtype == (int or long): + return 'int' + + if _vtype == float: + return 'double' + + if _vtype == bool: + return 'bool' + + if _vtype == list: + try: + first_element_type = type(evaluated[0]) + if first_element_type != str: + list_type = get_type(str(evaluated[0])) + else: + list_type = get_type(evaluated[0]) + + except IndexError: # empty list + return 'std::vector<std::string>' + + else: + return 'std::vector<' + list_type + '>' + + else: + return 'std::string' + + self.vtype = get_type(value) + if self.vtype == 'bool': + self.cpp_templates['var_make'] = self.cpp_templates['var_make'].replace('${value}', (value[0].lower() + value[1:])) + + elif self.vtype == 'pi': + self.vtype = 'double' + self.cpp_templates['var_make'] = self.cpp_templates['var_make'].replace('${value}', 'boost::math::constants::pi<double>()') + self.cpp_templates['includes'].append('#include <boost/math/constants/constants.hpp>') + + elif 'std::vector' in self.vtype: + self.cpp_templates['includes'].append('#include <vector>') + self.cpp_templates['var_make'] = self.cpp_templates['var_make'].replace('${value}', '{' + value[1:-1] + '}') + + if 'string' in self.vtype: + self.cpp_templates['includes'].append('#include <string>') + def is_virtual_sink(self): return self.key == 'virtual_sink' @@ -261,7 +364,7 @@ class Block(Element): Bypass the block Returns: - True if block chagnes state + True if block changes state """ if self.state != 'bypassed' and self.can_bypass(): self.state = 'bypassed' diff --git a/grc/core/generator/FlowGraphProxy.py b/grc/core/generator/FlowGraphProxy.py index f438fa0d39..bf73ee8ff0 100644 --- a/grc/core/generator/FlowGraphProxy.py +++ b/grc/core/generator/FlowGraphProxy.py @@ -19,6 +19,8 @@ from __future__ import absolute_import from six.moves import range +from ..utils import expr_utils +from operator import methodcaller, attrgetter class FlowGraphProxy(object): # TODO: move this in a refactored Generator @@ -72,6 +74,7 @@ class FlowGraphProxy(object): # TODO: move this in a refactored Generator 'type': str(pad.params['type'].get_evaluated()), 'vlen': str(pad.params['vlen'].get_value()), 'size': type_param.options.attributes[type_param.get_value()]['size'], + 'cpp_size': type_param.options.attributes[type_param.get_value()]['cpp_size'], 'optional': bool(pad.params['optional'].get_evaluated()), } num_ports = pad.params['num_streams'].get_evaluated() @@ -130,6 +133,34 @@ class FlowGraphProxy(object): # TODO: move this in a refactored Generator key_offset += len(pad.sinks) + len(pad.sources) return -1 + def get_cpp_variables(self): + """ + Get a list of all variables (C++) in this flow graph namespace. + Exclude parameterized variables. + + Returns: + a sorted list of variable blocks in order of dependency (indep -> dep) + """ + variables = [block for block in self.iter_enabled_blocks() if block.is_variable] + return expr_utils.sort_objects(variables, attrgetter('name'), methodcaller('get_cpp_var_make')) + + def includes(self): + """ + Get a set of all include statements (C++) in this flow graph namespace. + + Returns: + a list of #include statements + """ + return [block.cpp_templates.render('includes') for block in self.iter_enabled_blocks()] + + def links(self): + """ + Get a set of all libraries to link against (C++) in this flow graph namespace. + + Returns: + a list of GNU Radio modules + """ + return [block.cpp_templates.render('link') for block in self.iter_enabled_blocks()] def get_hier_block_io(flow_graph, direction, domain=None): """ diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index 62dc26b8a8..135f4538d5 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -24,6 +24,8 @@ from mako.template import Template from .hier_block import HierBlockGenerator, QtHierBlockGenerator from .top_block import TopBlockGenerator +from .cpp_top_block import CppTopBlockGenerator +from .cpp_hier_block import CppHierBlockGenerator DATA_DIR = os.path.dirname(__file__) FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.py.mako') @@ -43,12 +45,25 @@ class Generator(object): file_path: the path to the grc file """ self.generate_options = flow_graph.get_option('generate_options') - if self.generate_options == 'hb': - generator_cls = HierBlockGenerator - elif self.generate_options == 'hb_qt_gui': - generator_cls = QtHierBlockGenerator - else: - generator_cls = TopBlockGenerator + self.output_language = flow_graph.get_option('output_language') + + if self.output_language == 'python': + + if self.generate_options == 'hb': + generator_cls = HierBlockGenerator + elif self.generate_options == 'hb_qt_gui': + generator_cls = QtHierBlockGenerator + else: + generator_cls = TopBlockGenerator + + elif self.output_language == 'cpp': + + if self.generate_options == 'hb': + generator_cls = CppHierBlockGenerator + elif self.generate_options == 'hb_qt_gui': + pass + else: + generator_cls = CppTopBlockGenerator self._generator = generator_cls(flow_graph, file_path) diff --git a/grc/core/generator/cpp_hier_block.py b/grc/core/generator/cpp_hier_block.py new file mode 100644 index 0000000000..9cee410810 --- /dev/null +++ b/grc/core/generator/cpp_hier_block.py @@ -0,0 +1,213 @@ +import collections +import os + +import six +import codecs + +from .cpp_top_block import CppTopBlockGenerator + +from .. import Constants +from ..io import yaml + +class CppHierBlockGenerator(CppTopBlockGenerator): + """Extends the top block generator to also generate a block YML file""" + + def __init__(self, flow_graph, file_path): + """ + Initialize the hier block generator object. + + Args: + flow_graph: the flow graph object + file_path: where to write the py file (the yml goes into HIER_BLOCK_LIB_DIR) + """ + CppTopBlockGenerator.__init__(self, flow_graph, file_path) + platform = flow_graph.parent + + hier_block_lib_dir = platform.config.hier_block_lib_dir + if not os.path.exists(hier_block_lib_dir): + os.mkdir(hier_block_lib_dir) + + self._mode = Constants.HIER_BLOCK_FILE_MODE + self.file_path = os.path.join(hier_block_lib_dir, self._flow_graph.get_option('id')) + self.file_path_yml = self.file_path + '.block.yml' + + def write(self): + """generate output and write it to files""" + CppTopBlockGenerator.write(self) + + data = yaml.dump(self._build_block_n_from_flow_graph_io()) + + replace = [ + ('parameters:', '\nparameters:'), + ('inputs:', '\ninputs:'), + ('outputs:', '\noutputs:'), + ('asserts:', '\nasserts:'), + ('\ntemplates:', '\n\ntemplates:'), + ('cpp_templates:', '\ncpp_templates:'), + ('documentation:', '\ndocumentation:'), + ('file_format:', '\nfile_format:'), + ] + for r in replace: + data = data.replace(*r) + + with codecs.open(self.file_path_yml, 'w', encoding='utf-8') as fp: + fp.write(data) + + # Windows only supports S_IREAD and S_IWRITE, other flags are ignored + os.chmod(self.file_path_yml, self._mode) + + + def _build_block_n_from_flow_graph_io(self): + """ + Generate a block YML nested data from the flow graph IO + + Returns: + a yml node tree + """ + # Extract info from the flow graph + block_id = self._flow_graph.get_option('id') + parameters = self._flow_graph.get_parameters() + + def var_or_value(name): + if name in (p.name for p in parameters): + return "${" + name + " }" + return name + + # Build the nested data + data = collections.OrderedDict() + data['id'] = block_id + data['label'] = ( + self._flow_graph.get_option('title') or + self._flow_graph.get_option('id').replace('_', ' ').title() + ) + data['category'] = self._flow_graph.get_option('category') + data['flags'] = [ 'cpp' ] + + # Parameters + data['parameters'] = [] + for param_block in parameters: + p = collections.OrderedDict() + p['id'] = param_block.name + p['label'] = param_block.params['label'].get_value() or param_block.name + p['dtype'] = param_block.params['value'].dtype + p['default'] = param_block.params['value'].get_value() + p['hide'] = param_block.params['hide'].get_value() + data['param'].append(p) + + # Ports + for direction in ('inputs', 'outputs'): + data[direction] = [] + for port in get_hier_block_io(self._flow_graph, direction): + p = collections.OrderedDict() + if port.domain == Constants.GR_MESSAGE_DOMAIN: + p['id'] = port.id + p['label'] = port.parent.params['label'].value + if port.domain != Constants.DEFAULT_DOMAIN: + p['domain'] = port.domain + p['dtype'] = port.dtype + if port.domain != Constants.GR_MESSAGE_DOMAIN: + p['vlen'] = var_or_value(port.vlen) + if port.optional: + p['optional'] = True + data[direction].append(p) + + t = data['templates'] = collections.OrderedDict() + + t['import'] = "from {0} import {0} # grc-generated hier_block".format( + self._flow_graph.get_option('id')) + # Make data + if parameters: + t['make'] = '{cls}(\n {kwargs},\n)'.format( + cls=block_id, + kwargs=',\n '.join( + '{key}=${key}'.format(key=param.name) for param in parameters + ), + ) + else: + t['make'] = '{cls}()'.format(cls=block_id) + + # Callback data + t['callbacks'] = [ + 'set_{key}(${key})'.format(key=param_block.name) for param_block in parameters + ] + + t_cpp = data['cpp_templates'] = collections.OrderedDict() + + t_cpp['includes'] = [] + t_cpp['includes'].append('#include "{id}/{id}.hpp"'.format(id=self._flow_graph.get_option('id'))) + + # Make data + if parameters: + t_cpp['make'] = '{cls}(\n {kwargs},\n)'.format( + cls=block_id, + kwargs=',\n '.join( + '{key}=${key}'.format(key=param.name) for param in parameters + ), + ) + else: + t_cpp['make'] = 'this->${{id}} = {cls}_sptr(make_{cls}());'.format(cls=block_id) + t_cpp['declarations'] = '{cls}_sptr ${{id}};'.format(cls=block_id) + + # Callback data + t_cpp['callbacks'] = [ + 'set_{key}(${key})'.format(key=param_block.name) for param_block in parameters + ] + + # Documentation + data['documentation'] = "\n".join(field for field in ( + self._flow_graph.get_option('author'), + self._flow_graph.get_option('description'), + self.file_path + ) if field) + + data['grc_source'] = str(self._flow_graph.grc_file_path) + + data['file_format'] = 1 + + return data + + +class CppQtHierBlockGenerator(CppHierBlockGenerator): + + def _build_block_n_from_flow_graph_io(self): + n = CppHierBlockGenerator._build_block_n_from_flow_graph_io(self) + block_n = collections.OrderedDict() + + # insert flags after category + for key, value in six.iteritems(n['block']): + block_n[key] = value + if key == 'category': + block_n['flags'] = 'need_qt_gui' + + if not block_n['name'].upper().startswith('QT GUI'): + block_n['name'] = 'QT GUI ' + block_n['name'] + + gui_hint_param = collections.OrderedDict() + gui_hint_param['name'] = 'GUI Hint' + gui_hint_param['key'] = 'gui_hint' + gui_hint_param['value'] = '' + gui_hint_param['type'] = 'gui_hint' + gui_hint_param['hide'] = 'part' + block_n['param'].append(gui_hint_param) + + block_n['make'] += ( + "\n#set $win = 'self.%s' % $id" + "\n${gui_hint()($win)}" + ) + + return {'block': block_n} + + +def get_hier_block_io(flow_graph, direction, domain=None): + """ + Get a list of io ports for this flow graph. + + Returns a list of dicts with: type, label, vlen, size, optional + """ + pads = flow_graph.get_pad_sources() if direction == 'inputs' else flow_graph.get_pad_sinks() + + for pad in pads: + for port in (pad.sources if direction == 'inputs' else pad.sinks): + if domain and port.domain != domain: + continue + yield port diff --git a/grc/core/generator/cpp_templates/CMakeLists.txt.mako b/grc/core/generator/cpp_templates/CMakeLists.txt.mako new file mode 100644 index 0000000000..783ba71213 --- /dev/null +++ b/grc/core/generator/cpp_templates/CMakeLists.txt.mako @@ -0,0 +1,69 @@ +##################### +# GNU Radio C++ Flow Graph CMakeLists.txt +# +# Title: ${title} +% if flow_graph.get_option('author'): +# Author: ${flow_graph.get_option('author')} +% endif +% if flow_graph.get_option('description'): +# Description: ${flow_graph.get_option('description')} +% endif +# Generated: ${generated_time} +##################### + +<% +class_name = flow_graph.get_option('id') +cmake_opt_list = flow_graph.get_option('cmake_opt').split(";") +%>\ + +cmake_minimum_required(VERSION 3.8) + +% if generate_options == 'qt_gui': +find_package(Qt5Widgets REQUIRED) +% endif + +include_directories( + ${'$'}{GNURADIO_ALL_INCLUDE_DIRS} + ${'$'}{Boost_INCLUDE_DIRS} + % if generate_options == 'qt_gui': + ${'$'}{Qt5Widgets_INCLUDES} + % endif + $ENV{HOME}/.grc_gnuradio +) + +% if generate_options == 'qt_gui': +add_definitions(${'$'}{Qt5Widgets_DEFINITIONS}) + +set(CMAKE_AUTOMOC TRUE) +% endif + +% if cmake_opt_list != ['']: +% for opt in cmake_opt_list: +set(${opt.split("=")[0].strip()} ${opt.split("=")[1].strip()}) +% endfor +% endif + +% if flow_graph.get_option('gen_linking') == 'static': +set(BUILD_SHARED_LIBS false) +set(CMAKE_EXE_LINKER_FLAGS " -static") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +% endif + +set(GR_LIBRARIES + boost_system + % if parameters: + boost_program_options + % endif + gnuradio-blocks + gnuradio-runtime + gnuradio-pmt + log4cpp + % for link in links: + % if link: + ${link} + % endif + % endfor +) + +add_executable(${class_name} ${class_name}.cpp) +target_link_libraries(${class_name} ${'$'}{GR_LIBRARIES}) diff --git a/grc/core/generator/cpp_templates/flow_graph.cpp.mako b/grc/core/generator/cpp_templates/flow_graph.cpp.mako new file mode 100644 index 0000000000..c03e0c1cc2 --- /dev/null +++ b/grc/core/generator/cpp_templates/flow_graph.cpp.mako @@ -0,0 +1,175 @@ +<%def name="doubleindent(code)">${ '\n '.join(str(code).splitlines()) }</%def>\ +/******************** +GNU Radio C++ Flow Graph Source File + +Title: ${title} +% if flow_graph.get_option('author'): +Author: ${flow_graph.get_option('author')} +% endif +% if flow_graph.get_option('description'): +Description: ${flow_graph.get_option('description')} +% endif +Generated: ${generated_time} +********************/ + +#include "${flow_graph.get_option('id')}.hpp" +% if parameters: + +namespace po = boost::program_options; + +% endif +using namespace gr; + +<% +class_name = flow_graph.get_option('id') + ('_' if flow_graph.get_option('id') == 'top_block' else '') + +param_str = ", ".join((param.vtype + " " + param.name) for param in parameters) +param_str_without_types = ", ".join(param.name for param in parameters) +%>\ + +% if generate_options == 'no_gui': +${class_name}::${class_name} (${param_str}) { +% elif generate_options == 'qt_gui': +${class_name}::${class_name} (${param_str}) : QWidget() { + this->setWindowTitle("${title}"); + // check_set_qss + // set icon + this->top_scroll_layout = new QVBoxLayout(); + this->setLayout(this->top_scroll_layout); + this->top_scroll = new QScrollArea(); + this->top_scroll->setFrameStyle(QFrame::NoFrame); + this->top_scroll_layout->addWidget(this->top_scroll); + this->top_scroll->setWidgetResizable(true); + this->top_widget = new QWidget(); + this->top_scroll->setWidget(this->top_widget); + this->top_layout = new QVBoxLayout(this->top_widget); + this->top_grid_layout = new QGridLayout(); + this->top_layout->addLayout(this->top_grid_layout); + + this->settings = new QSettings("GNU Radio", "${class_name}"); + +% endif + +% if flow_graph.get_option('thread_safe_setters'): +## self._lock = threading.RLock() +% endif + + + this->tb = gr::make_top_block("${title}"); + + +% if blocks: +// Blocks: +% for blk, blk_make, declarations in blocks: + { + ${doubleindent(blk_make)} +## % if 'alias' in blk.params and blk.params['alias'].get_evaluated(): +## ${blk.name}.set_block_alias("${blk.params['alias'].get_evaluated()}") +## % endif +## % if 'affinity' in blk.params and blk.params['affinity'].get_evaluated(): +## ${blk.name}.set_processor_affinity("${blk.params['affinity'].get_evaluated()}") +## % endif +## % if len(blk.sources) > 0 and 'minoutbuf' in blk.params and int(blk.params['minoutbuf'].get_evaluated()) > 0: +## ${blk.name}.set_min_output_buffer(${blk.params['minoutbuf'].get_evaluated()}) +## % endif +## % if len(blk.sources) > 0 and 'maxoutbuf' in blk.params and int(blk.params['maxoutbuf'].get_evaluated()) > 0: +## ${blk.name}.set_max_output_buffer(${blk.params['maxoutbuf'].get_evaluated()}) +## % endif + } +% endfor +% endif + +% if connections: +// Connections: +% for connection in connections: + ${connection.rstrip()}; +% endfor +% endif +} + +${class_name}::~${class_name} () { +} + +// Callbacks: +% for var in parameters + variables: +${var.vtype} ${class_name}::get_${var.name} () const { + return this->${var.name}; +} + +void ${class_name}::set_${var.name} (${var.vtype} ${var.name}) { +% if flow_graph.get_option('thread_safe_setters'): + ## with self._lock: + return; +% else: + this->${var.name} = ${var.name}; + % for callback in callbacks[var.name]: + ${callback}; + % endfor +% endif +} + +% endfor + +int main (int argc, char **argv) { + % if parameters: + % for parameter in parameters: + ${parameter.vtype} ${parameter.name}; + % endfor + + po::options_description desc("Options"); + desc.add_options() + ("help", "display help") + % for parameter in parameters: + ("${parameter.name}", po::value<${parameter.vtype}>(&${parameter.name}), "${parameter.label}") + % endfor + ; + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << std::endl; + return 0; + } + % endif + % if flow_graph.get_option('realtime_scheduling'): + if (enable_realtime_scheduling() != RT_OK) { + std::cout << "Error: failed to enable real-time scheduling." << std::endl; + } + % endif + + % if generate_options == 'no_gui': + ${class_name}* top_block = new ${class_name}(); + ## TODO: params + % if flow_graph.get_option('run_options') == 'prompt': + top_block->tb->start(); + % for m in monitors: + (top_block->${m.name}).start(); + % endfor + std::cout << "Press Enter to quit: "; + std::cin.ignore(); + top_block->tb->stop(); + % elif flow_graph.get_option('run_options') == 'run': + top_block->tb->start(); + % endif + % for m in monitors: + (top_block->${m.name}).start(); + % endfor + top_block->tb->wait(); + % elif generate_options == 'qt_gui': + QApplication app(argc, argv); + + ${class_name}* top_block = new ${class_name}(${param_str_without_types}); + + top_block->tb->start(); + top_block->show(); + app.exec(); + + % endif + + return 0; +} +% if generate_options == 'qt_gui': +#include "moc_${class_name}.cpp" +% endif diff --git a/grc/core/generator/cpp_templates/flow_graph.hpp.mako b/grc/core/generator/cpp_templates/flow_graph.hpp.mako new file mode 100644 index 0000000000..7ae119c44e --- /dev/null +++ b/grc/core/generator/cpp_templates/flow_graph.hpp.mako @@ -0,0 +1,193 @@ +<%def name="indent(code)">${ ' ' + '\n '.join(str(code).splitlines()) }</%def>\ +<%def name="doubleindent(code)">${ '\n '.join(str(code).splitlines()) }</%def>\ +#ifndef ${flow_graph.get_option('id').upper()}_HPP +#define ${flow_graph.get_option('id').upper()}_HPP +/******************** +GNU Radio C++ Flow Graph Header File + +Title: ${title} +% if flow_graph.get_option('author'): +Author: ${flow_graph.get_option('author')} +% endif +% if flow_graph.get_option('description'): +Description: ${flow_graph.get_option('description')} +% endif +Generated: ${generated_time} +********************/ + +/******************** +** Create includes +********************/ +% for inc in includes: +${inc} +% endfor + +% if generate_options == 'qt_gui': +#include <QVBoxLayout> +#include <QScrollArea> +#include <QWidget> +#include <QGridLayout> +#include <QSettings> +% endif + +% if parameters: +#include <iostream> +#include <boost/program_options.hpp> +% endif + +using namespace gr; + +<% +class_name = flow_graph.get_option('id') + ('_' if flow_graph.get_option('id') == 'top_block' else '') +param_str = ", ".join((param.vtype + " " + param.name) for param in parameters) +%>\ + +% if generate_options.startswith('hb'): +class ${class_name}; +typedef boost::shared_ptr<${class_name}> ${class_name}_sptr; +${class_name}_sptr make_${class_name}(); +% endif + +% if generate_options == 'no_gui': +class ${class_name} { +% elif generate_options.startswith('hb'): +class ${class_name} : public hier_block2 { +% elif generate_options == 'qt_gui': +class ${class_name} : public QWidget { + Q_OBJECT +% endif + +private: +% if generate_options == 'qt_gui': + QVBoxLayout *top_scroll_layout; + QScrollArea *top_scroll; + QWidget *top_widget; + QVBoxLayout *top_layout; + QGridLayout *top_grid_layout; + QSettings *settings; +% endif + + +% for block, make, declarations in blocks: +% if declarations: +${indent(declarations)} +% endif +% endfor + +% if parameters: +// Parameters: +% for param in parameters: + ${param.get_cpp_var_make()} +% endfor +% endif + +% if variables: +// Variables: +% for var in variables: + ${var.vtype} ${var.cpp_templates.render('var_make')} +% endfor +% endif + +public: +% if not generate_options.startswith('hb'): + top_block_sptr tb; +% endif + ${class_name}(${param_str}); + ~${class_name}(); + +% for var in parameters + variables: + ${var.vtype} get_${var.name} () const; + void set_${var.name}(${var.vtype} ${var.name}); +% endfor + +}; + + +% if generate_options.startswith('hb'): +<% in_sigs = flow_graph.get_hier_block_stream_io('in') %> +<% out_sigs = flow_graph.get_hier_block_stream_io('out') %> + +<%def name="make_io_sig(io_sigs)">\ + <% size_strs = [ '%s*%s'%(io_sig['cpp_size'], io_sig['vlen']) for io_sig in io_sigs] %>\ + % if len(io_sigs) == 0: + gr::io_signature::make(0, 0, 0)\ + % elif len(io_sigs) == 1: + gr::io_signature::make(1, 1, ${size_strs[0]})\ + % else: + gr::io_signaturev(${len(io_sigs)}, ${len(io_sigs)}, [${', '.join(size_strs)}])\ + % endif +</%def>\ + +${class_name}::${class_name} (${param_str}) : hier_block2("${title}", + ${make_io_sig(in_sigs)}, + ${make_io_sig(out_sigs)} + ) { +% for pad in flow_graph.get_hier_block_message_io('in'): + message_port_register_hier_in("${pad['label']}") +% endfor +% for pad in flow_graph.get_hier_block_message_io('out'): + message_port_register_hier_out("${pad['label']}") +% endfor + +% if flow_graph.get_option('thread_safe_setters'): +## self._lock = threading.RLock() +% endif + +% if blocks: +// Blocks: +% for blk, blk_make, declarations in blocks: + { + ${doubleindent(blk_make)} +## % if 'alias' in blk.params and blk.params['alias'].get_evaluated(): +## ${blk.name}.set_block_alias("${blk.params['alias'].get_evaluated()}") +## % endif +## % if 'affinity' in blk.params and blk.params['affinity'].get_evaluated(): +## ${blk.name}.set_processor_affinity("${blk.params['affinity'].get_evaluated()}") +## % endif +## % if len(blk.sources) > 0 and 'minoutbuf' in blk.params and int(blk.params['minoutbuf'].get_evaluated()) > 0: +## ${blk.name}.set_min_output_buffer(${blk.params['minoutbuf'].get_evaluated()}) +## % endif +## % if len(blk.sources) > 0 and 'maxoutbuf' in blk.params and int(blk.params['maxoutbuf'].get_evaluated()) > 0: +## ${blk.name}.set_max_output_buffer(${blk.params['maxoutbuf'].get_evaluated()}) +## % endif + } +% endfor +% endif + +% if connections: +// Connections: +% for connection in connections: + ${connection.rstrip()}; +% endfor +% endif +} +${class_name}::~${class_name} () { +} + +// Callbacks: +% for var in parameters + variables: +${var.vtype} ${class_name}::get_${var.name} () const { + return this->${var.name}; +} + +void ${class_name}::set_${var.name} (${var.vtype} ${var.name}) { +% if flow_graph.get_option('thread_safe_setters'): + ## with self._lock: + return; +% else: + this->${var.name} = ${var.name}; + % for callback in callbacks[var.name]: + ${callback}; + % endfor +% endif +} + +% endfor +${class_name}_sptr +make_${class_name}() +{ + return gnuradio::get_initial_sptr(new ${class_name}()); +} +% endif +#endif + diff --git a/grc/core/generator/cpp_top_block.py b/grc/core/generator/cpp_top_block.py new file mode 100644 index 0000000000..9622ad93ce --- /dev/null +++ b/grc/core/generator/cpp_top_block.py @@ -0,0 +1,361 @@ +import codecs +import yaml +import operator +import os +import tempfile +import textwrap +import time +import re + +from mako.template import Template + +from .. import Messages, blocks +from ..Constants import TOP_BLOCK_FILE_MODE +from .FlowGraphProxy import FlowGraphProxy +from ..utils import expr_utils +from .top_block import TopBlockGenerator + +DATA_DIR = os.path.dirname(__file__) + +HEADER_TEMPLATE = os.path.join(DATA_DIR, 'cpp_templates/flow_graph.hpp.mako') +SOURCE_TEMPLATE = os.path.join(DATA_DIR, 'cpp_templates/flow_graph.cpp.mako') +CMAKE_TEMPLATE = os.path.join(DATA_DIR, 'cpp_templates/CMakeLists.txt.mako') + +header_template = Template(filename=HEADER_TEMPLATE) +source_template = Template(filename=SOURCE_TEMPLATE) +cmake_template = Template(filename=CMAKE_TEMPLATE) + + +class CppTopBlockGenerator(TopBlockGenerator): + + def __init__(self, flow_graph, file_path): + """ + Initialize the top block generator object. + + Args: + flow_graph: the flow graph object + file_path: the path to write the file to + """ + + self._flow_graph = FlowGraphProxy(flow_graph) + self._generate_options = self._flow_graph.get_option('generate_options') + + self._mode = TOP_BLOCK_FILE_MODE + dirname = os.path.dirname(file_path) + # Handle the case where the directory is read-only + # In this case, use the system's temp directory + if not os.access(dirname, os.W_OK): + dirname = tempfile.gettempdir() + + filename = self._flow_graph.get_option('id') + self.file_path = os.path.join(dirname, filename) + self._dirname = dirname + + def write(self): + """generate output and write it to files""" + self._warnings() + + fg = self._flow_graph + self.title = fg.get_option('title') or fg.get_option('id').replace('_', ' ').title() + variables = fg.get_cpp_variables() + parameters = fg.get_parameters() + monitors = fg.get_monitors() + self._variable_types() + self._parameter_types() + + self.namespace = { + 'flow_graph': fg, + 'variables': variables, + 'parameters': parameters, + 'monitors': monitors, + 'generate_options': self._generate_options, + 'generated_time': time.ctime(), + } + + if not os.path.exists(self.file_path): + os.makedirs(self.file_path) + + for filename, data in self._build_cpp_header_code_from_template(): + with codecs.open(filename, 'w', encoding='utf-8') as fp: + fp.write(data) + + if not self._generate_options.startswith('hb'): + if not os.path.exists(os.path.join(self.file_path, 'build')): + os.makedirs(os.path.join(self.file_path, 'build')) + + for filename, data in self._build_cpp_source_code_from_template(): + with codecs.open(filename, 'w', encoding='utf-8') as fp: + fp.write(data) + + if fg.get_option('gen_cmake') == 'On': + for filename, data in self._build_cmake_code_from_template(): + with codecs.open(filename, 'w', encoding='utf-8') as fp: + fp.write(data) + + def _build_cpp_source_code_from_template(self): + """ + Convert the flow graph to a C++ source file. + + Returns: + a string of C++ code + """ + file_path = self.file_path + '/' + self._flow_graph.get_option('id') + '.cpp' + + output = [] + + flow_graph_code = source_template.render( + title=self.title, + includes=self._includes(), + blocks=self._blocks(), + callbacks=self._callbacks(), + connections=self._connections(), + **self.namespace + ) + # strip trailing white-space + flow_graph_code = "\n".join(line.rstrip() for line in flow_graph_code.split("\n")) + output.append((file_path, flow_graph_code)) + + return output + + + def _build_cpp_header_code_from_template(self): + """ + Convert the flow graph to a C++ header file. + + Returns: + a string of C++ code + """ + file_path = self.file_path + '/' + self._flow_graph.get_option('id') + '.hpp' + + output = [] + + flow_graph_code = header_template.render( + title=self.title, + includes=self._includes(), + blocks=self._blocks(), + callbacks=self._callbacks(), + connections=self._connections(), + **self.namespace + ) + # strip trailing white-space + flow_graph_code = "\n".join(line.rstrip() for line in flow_graph_code.split("\n")) + output.append((file_path, flow_graph_code)) + + return output + + def _build_cmake_code_from_template(self): + """ + Convert the flow graph to a CMakeLists.txt file. + + Returns: + a string of CMake code + """ + filename = 'CMakeLists.txt' + file_path = os.path.join(self.file_path, filename) + + output = [] + + flow_graph_code = cmake_template.render( + title=self.title, + includes=self._includes(), + blocks=self._blocks(), + callbacks=self._callbacks(), + connections=self._connections(), + links=self._links(), + **self.namespace + ) + # strip trailing white-space + flow_graph_code = "\n".join(line.rstrip() for line in flow_graph_code.split("\n")) + output.append((file_path, flow_graph_code)) + + return output + + def _links(self): + fg = self._flow_graph + links = fg.links() + seen = set() + output = [] + + for link_list in links: + if link_list: + for link in link_list: + seen.add(link) + + return list(seen) + + def _includes(self): + fg = self._flow_graph + includes = fg.includes() + seen = set() + output = [] + + def is_duplicate(l): + if l.startswith('#include') and l in seen: + return True + seen.add(line) + return False + + for block_ in includes: + for include_ in block_: + if not include_: + continue + line = include_.rstrip() + if not is_duplicate(line): + output.append(line) + + return output + + def _blocks(self): + fg = self._flow_graph + parameters = fg.get_parameters() + + # List of blocks not including variables and imports and parameters and disabled + def _get_block_sort_text(block): + code = block.cpp_templates.render('make').replace(block.name, ' ') + try: + code += block.params['gui_hint'].get_value() # Newer gui markup w/ qtgui + except: + pass + return code + + blocks = [ + b for b in fg.blocks + if b.enabled and not (b.get_bypassed() or b.is_import or b in parameters or b.key == 'options') + ] + + blocks = expr_utils.sort_objects(blocks, operator.attrgetter('name'), _get_block_sort_text) + blocks_make = [] + for block in blocks: + translations = block.cpp_templates.render('translations') + make = block.cpp_templates.render('make') + declarations = block.cpp_templates.render('declarations') + if translations: + translations = yaml.load(translations) + else: + translations = {} + translations.update( + {r"gr\.sizeof_([\w_]+)": r"sizeof(\1)"} + ) + for key in translations: + make = re.sub(key.replace("\\\\", "\\"), translations[key],make) + declarations = declarations.replace(key, translations[key]) + if make: + blocks_make.append((block, make, declarations)) + elif 'qt' in block.key: + # The QT Widget blocks are technically variables, + # but they contain some code we don't want to miss + blocks_make.append(('', make, declarations)) + return blocks_make + + def _variable_types(self): + fg = self._flow_graph + variables = fg.get_cpp_variables() + + for var in variables: + var.decide_type() + + def _parameter_types(self): + fg = self._flow_graph + parameters = fg.get_parameters() + + for param in parameters: + type_translation = {'eng_float' : 'double', 'intx' : 'int', 'std' : 'std::string'}; + param.vtype = type_translation[param.params['type'].value] + + def _callbacks(self): + fg = self._flow_graph + variables = fg.get_cpp_variables() + parameters = fg.get_parameters() + + # List of variable names + var_ids = [var.name for var in parameters + variables] + + replace_dict = dict((var_id, 'this->' + var_id) for var_id in var_ids) + + callbacks_all = [] + for block in fg.iter_enabled_blocks(): + callbacks_all.extend(expr_utils.expr_replace(cb, replace_dict) for cb in block.get_cpp_callbacks()) + + # Map var id to callbacks + def uses_var_id(callback): + used = expr_utils.get_variable_dependencies(callback, [var_id]) + return used and ('this->' + var_id in callback) # callback might contain var_id itself + + callbacks = {} + for var_id in var_ids: + callbacks[var_id] = [callback for callback in callbacks_all if uses_var_id(callback)] + + return callbacks + + def _connections(self): + fg = self._flow_graph + templates = {key: Template(text) + for key, text in fg.parent_platform.cpp_connection_templates.items()} + + def make_port_sig(port): + if port.parent.key in ('pad_source', 'pad_sink'): + block = 'self()' + key = fg.get_pad_port_global_key(port) + else: + block = 'this->' + port.parent_block.name + key = port.key + + if not key.isdigit(): + key = re.findall(r'\d+', key)[0] + + return '{block}, {key}'.format(block=block, key=key) + + connections = fg.get_enabled_connections() + + # Get the virtual blocks and resolve their connections + connection_factory = fg.parent_platform.Connection + virtual = [c for c in connections if isinstance(c.source_block, blocks.VirtualSource)] + for connection in virtual: + sink = connection.sink_port + for source in connection.source_port.resolve_virtual_source(): + resolved = connection_factory(fg.orignal_flowgraph, source, sink) + connections.append(resolved) + # Remove the virtual connection + connections.remove(connection) + + # Bypassing blocks: Need to find all the enabled connections for the block using + # the *connections* object rather than get_connections(). Create new connections + # that bypass the selected block and remove the existing ones. This allows adjacent + # bypassed blocks to see the newly created connections to downstream blocks, + # allowing them to correctly construct bypass connections. + bypassed_blocks = fg.get_bypassed_blocks() + for block in bypassed_blocks: + # Get the upstream connection (off of the sink ports) + # Use *connections* not get_connections() + source_connection = [c for c in connections if c.sink_port == block.sinks[0]] + # The source connection should never have more than one element. + assert (len(source_connection) == 1) + + # Get the source of the connection. + source_port = source_connection[0].source_port + + # Loop through all the downstream connections + for sink in (c for c in connections if c.source_port == block.sources[0]): + if not sink.enabled: + # Ignore disabled connections + continue + connection = connection_factory(fg.orignal_flowgraph, source_port, sink.sink_port) + connections.append(connection) + # Remove this sink connection + connections.remove(sink) + # Remove the source connection + connections.remove(source_connection[0]) + + # List of connections where each endpoint is enabled (sorted by domains, block names) + def by_domain_and_blocks(c): + return c.type, c.source_block.name, c.sink_block.name + + rendered = [] + for con in sorted(connections, key=by_domain_and_blocks): + template = templates[con.type] + code = template.render(make_port_sig=make_port_sig, source=con.source_port, sink=con.sink_port) + if not self._generate_options.startswith('hb'): + code = 'this->tb->' + code + rendered.append(code) + + return rendered diff --git a/grc/core/generator/top_block.py b/grc/core/generator/top_block.py index b5661762c0..cab1bf71cb 100644 --- a/grc/core/generator/top_block.py +++ b/grc/core/generator/top_block.py @@ -13,8 +13,10 @@ from .FlowGraphProxy import FlowGraphProxy from ..utils import expr_utils DATA_DIR = os.path.dirname(__file__) -FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.py.mako') -flow_graph_template = Template(filename=FLOW_GRAPH_TEMPLATE) + +PYTHON_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.py.mako') + +python_template = Template(filename=PYTHON_TEMPLATE) class TopBlockGenerator(object): @@ -65,6 +67,21 @@ class TopBlockGenerator(object): """generate output and write it to files""" self._warnings() + fg = self._flow_graph + self.title = fg.get_option('title') or fg.get_option('id').replace('_', ' ').title() + variables = fg.get_variables() + parameters = fg.get_parameters() + monitors = fg.get_monitors() + + self.namespace = { + 'flow_graph': fg, + 'variables': variables, + 'parameters': parameters, + 'monitors': monitors, + 'generate_options': self._generate_options, + 'generated_time': time.ctime(), + } + for filename, data in self._build_python_code_from_template(): with codecs.open(filename, 'w', encoding='utf-8') as fp: fp.write(data) @@ -106,13 +123,13 @@ class TopBlockGenerator(object): 'generated_time': time.ctime(), 'version': platform.config.version } - flow_graph_code = flow_graph_template.render( + flow_graph_code = python_template.render( title=title, imports=self._imports(), blocks=self._blocks(), callbacks=self._callbacks(), connections=self._connections(), - **namespace + **self.namespace ) # strip trailing white-space flow_graph_code = "\n".join(line.rstrip() for line in flow_graph_code.split("\n")) @@ -196,7 +213,9 @@ class TopBlockGenerator(object): # List of variable names var_ids = [var.name for var in parameters + variables] + replace_dict = dict((var_id, 'self.' + var_id) for var_id in var_ids) + callbacks_all = [] for block in fg.iter_enabled_blocks(): callbacks_all.extend(expr_utils.expr_replace(cb, replace_dict) for cb in block.get_callbacks()) @@ -204,7 +223,7 @@ class TopBlockGenerator(object): # Map var id to callbacks def uses_var_id(callback): used = expr_utils.get_variable_dependencies(callback, [var_id]) - return used and 'self.' + var_id in callback # callback might contain var_id itself + return used and (('self.' + var_id in callback) or ('this->' + var_id in callback)) # callback might contain var_id itself callbacks = {} for var_id in var_ids: @@ -218,6 +237,7 @@ class TopBlockGenerator(object): for key, text in fg.parent_platform.connection_templates.items()} def make_port_sig(port): + # TODO: make sense of this if port.parent.key in ('pad_source', 'pad_sink'): block = 'self' key = fg.get_pad_port_global_key(port) @@ -282,6 +302,7 @@ class TopBlockGenerator(object): for con in sorted(connections, key=by_domain_and_blocks): template = templates[con.type] code = template.render(make_port_sig=make_port_sig, source=con.source_port, sink=con.sink_port) + code = 'self.' + code rendered.append(code) return rendered diff --git a/grc/core/platform.py b/grc/core/platform.py index fc86be927d..88bc941495 100644 --- a/grc/core/platform.py +++ b/grc/core/platform.py @@ -22,6 +22,7 @@ from collections import namedtuple import os import logging from itertools import chain +import re import six from six.moves import range @@ -61,6 +62,7 @@ class Platform(Element): self.blocks = self.block_classes self.domains = {} self.connection_templates = {} + self.cpp_connection_templates = {} self._block_categories = {} self._auto_hier_block_generate_chain = set() @@ -138,6 +140,7 @@ class Platform(Element): self.blocks.clear() self.domains.clear() self.connection_templates.clear() + self.cpp_connection_templates.clear() self._block_categories.clear() # # FIXME: remove this as soon as converter is stable @@ -277,6 +280,7 @@ class Platform(Element): continue connection_id = str(source_id), str(sink_id) self.connection_templates[connection_id] = connection.get('connect', '') + self.cpp_connection_templates[connection_id] = connection.get('cpp_connect', '') def load_category_tree_description(self, data, file_path): """Parse category tree file and add it to list""" @@ -377,6 +381,16 @@ class Platform(Element): return [(value, name, value == generate_mode_default) for value, name in zip(param['options'], param['option_labels'])] + def get_output_language(self): + for param in self.block_classes['options'].parameters_data: + if param.get('id') == 'output_language': + break + else: + return [] + output_language_default = param.get('default') + return [(value, name, value == output_language_default) + for value, name in zip(param['options'], param['option_labels'])] + ############################################## # Factories ############################################## diff --git a/grc/core/schema_checker/block.py b/grc/core/schema_checker/block.py index 92ed48758c..e36865fed0 100644 --- a/grc/core/schema_checker/block.py +++ b/grc/core/schema_checker/block.py @@ -35,6 +35,15 @@ TEMPLATES_SCHEME = expand( make=str_, callbacks=list, ) +CPP_TEMPLATES_SCHEME = expand( + includes=list, + declarations=str_, + make=str_, + var_make=str_, + callbacks=list, + link=list, + translations=dict, +) BLOCK_SCHEME = expand( id=Spec(types=str_, required=True, item_scheme=None), label=str_, @@ -49,6 +58,7 @@ BLOCK_SCHEME = expand( value=str_, templates=Spec(types=dict, required=False, item_scheme=TEMPLATES_SCHEME), + cpp_templates=Spec(types=dict, required=False, item_scheme=CPP_TEMPLATES_SCHEME), documentation=str_, grc_source=str_, diff --git a/grc/core/schema_checker/domain.py b/grc/core/schema_checker/domain.py index 86c29ed3c6..19b0a510d0 100644 --- a/grc/core/schema_checker/domain.py +++ b/grc/core/schema_checker/domain.py @@ -3,6 +3,7 @@ from .utils import Spec, expand, str_ DOMAIN_CONNECTION = expand( type=Spec(types=list, required=True, item_scheme=None), connect=str_, + cpp_connect=str_, ) DOMAIN_SCHEME = expand( diff --git a/grc/gui/Executor.py b/grc/gui/Executor.py index efed54b042..7d7caaaf98 100644 --- a/grc/gui/Executor.py +++ b/grc/gui/Executor.py @@ -44,7 +44,11 @@ class ExecFlowGraphThread(threading.Thread): self.update_callback = callback try: - self.process = self.page.process = self._popen() + if self.flow_graph.get_option('output_language') == 'python': + self.process = self.page.process = self._popen() + elif self.flow_graph.get_option('output_language') == 'cpp': + self.process = self.page.process = self._cpp_popen() + self.update_callback() self.start() except Exception as e: @@ -75,6 +79,31 @@ class ExecFlowGraphThread(threading.Thread): shell=False, universal_newlines=True ) + def _cpp_popen(self): + """ + Execute this C++ flow graph after generating and compiling it. + """ + generator = self.page.get_generator() + run_command = generator.file_path + '/build/' + self.flow_graph.get_option('id') + + dirname = generator.file_path + builddir = os.path.join(dirname, 'build') + + if os.path.isfile(run_command): + os.remove(run_command) + + xterm_executable = find_executable(self.xterm_executable) + + run_command_args = ['cmake .. &&', 'make && ', xterm_executable, '-e', run_command] + Messages.send_start_exec(' '.join(run_command_args)) + + return subprocess.Popen( + args=' '.join(run_command_args), + cwd=builddir, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + shell=True, universal_newlines=True + ) + def run(self): """ Wait on the executing process by reading from its stdout. diff --git a/grc/tests/test_cpp.py b/grc/tests/test_cpp.py new file mode 100644 index 0000000000..fc52218477 --- /dev/null +++ b/grc/tests/test_cpp.py @@ -0,0 +1,18 @@ + + +from argparse import Namespace +from os import path +import tempfile +import subprocess + +from .test_compiler import * + +def test_cpp(): + test_compiler('test_cpp.grc') + if not os.path.exists('test_cpp/build'): + os.makedirs('directory') + return_code = subprocess.Popen('cmake ..', cwd='./build/') + assert(return_code == 0) + return_code = subprocess.Popen('make', cwd='./build/') + assert(return_code == 0) + |