From 54179f7f860dcf8bc986fd90a22a5be8322b5fdf Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 24 Feb 2010 14:42:25 -0800 Subject: Created gr uhd skeleton build. Checks uhd pkg config and gens the makefiles. --- gr-uhd/swig/.gitignore | 2 ++ gr-uhd/swig/Makefile.am | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 gr-uhd/swig/.gitignore create mode 100644 gr-uhd/swig/Makefile.am (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/.gitignore b/gr-uhd/swig/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/gr-uhd/swig/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am new file mode 100644 index 000000000..b78d07ee8 --- /dev/null +++ b/gr-uhd/swig/Makefile.am @@ -0,0 +1,22 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +include $(top_srcdir)/Makefile.common -- cgit From 7c23fd43214e8a729b3022db281dc85040f0e749 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 26 Feb 2010 15:17:38 -0800 Subject: Created simple source (with nothing in it) and some swig build stuff. Seems to work and compile --- gr-uhd/swig/.gitignore | 2 + gr-uhd/swig/Makefile.am | 44 +++++++ gr-uhd/swig/Makefile.swig.gen | 259 ++++++++++++++++++++++++++++++++++++++++++ gr-uhd/swig/__init__.py | 28 +++++ gr-uhd/swig/uhd_swig.i | 31 +++++ 5 files changed, 364 insertions(+) create mode 100644 gr-uhd/swig/Makefile.swig.gen create mode 100644 gr-uhd/swig/__init__.py create mode 100644 gr-uhd/swig/uhd_swig.i (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/.gitignore b/gr-uhd/swig/.gitignore index b336cc7ce..02d25cc00 100644 --- a/gr-uhd/swig/.gitignore +++ b/gr-uhd/swig/.gitignore @@ -1,2 +1,4 @@ +/uhd_swig.cc +/uhd_swig.py /Makefile /Makefile.in diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index b78d07ee8..3b1fd20f8 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -20,3 +20,47 @@ # include $(top_srcdir)/Makefile.common + +AM_CPPFLAGS = \ + $(STD_DEFINES_AND_INCLUDES) \ + $(PYTHON_CPPFLAGS) \ + $(WITH_INCLUDES) \ + -I$(top_srcdir)/gr-uhd/lib + +if PYTHON +# ---------------------------------------------------------------- +# The SWIG library +# TESTS = run_tests + +TOP_SWIG_IFILES = \ + uhd_swig.i + +# Install so that they end up available as: +# import gnuradio.uhd +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/uhd +uhd_swig_pythondir_category = \ + gnuradio/uhd + +# additional libraries for linking with the SWIG-generated library +uhd_swig_la_swig_libadd = \ + $(top_builddir)/gr-uhd/lib/libgnuradio-uhd.la + +# additional Python files to be installed along with the SWIG-generated one +uhd_swig_python = \ + __init__.py + +# additional SWIG files to be installed +uhd_swig_swiginclude_headers = + +include $(top_srcdir)/Makefile.swig + +# FIXME better way to set this? +STD_SWIG_PYTHON_ARGS += -I$(top_srcdir)/gr-uhd/lib + +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) + +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) +endif diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen new file mode 100644 index 000000000..3804461a4 --- /dev/null +++ b/gr-uhd/swig/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for uhd_swig.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/uhd_swig +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/uhd_swig +## +## The following can be overloaded to change the install location, but +## this has to be done in the including Makefile.am -before- +## Makefile.swig is included. + +uhd_swig_pythondir_category ?= gnuradio/uhd_swig +uhd_swig_pylibdir_category ?= $(uhd_swig_pythondir_category) +uhd_swig_pythondir = $(pythondir)/$(uhd_swig_pythondir_category) +uhd_swig_pylibdir = $(pyexecdir)/$(uhd_swig_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +uhd_swig_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## right thing. For more info, see < +## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > + +## Stamps used to ensure parallel make does the right thing. These +## are removed by "make clean", but otherwise unused except during the +## parallel built. These will not be included in a tarball, because +## the SWIG-generated files will be removed from the distribution. + +STAMPS += $(DEPDIR)/uhd_swig-generate-* + +## Other cleaned files: dependency files generated by SWIG or this Makefile + +MOSTLYCLEANFILES += $(DEPDIR)/*.S* + +## Add the .py and .cc files to the list of SWIG built sources. The +## .h file is sometimes built, but not always ... so that one has to +## be added manually by the including Makefile.am . + +swig_built_sources += uhd_swig.py uhd_swig.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +uhd_swig_swiginclude_HEADERS = \ + uhd_swig.i \ + $(uhd_swig_swiginclude_headers) + +uhd_swig_pylib_LTLIBRARIES = \ + _uhd_swig.la + +_uhd_swig_la_SOURCES = \ + uhd_swig.cc \ + $(uhd_swig_la_swig_sources) + +_uhd_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(uhd_swig_la_swig_libadd) + +_uhd_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(uhd_swig_la_swig_ldflags) + +_uhd_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(uhd_swig_la_swig_cxxflags) + +uhd_swig_python_PYTHON = \ + uhd_swig.py \ + $(uhd_swig_python) + +## Entry rule for running SWIG + +uhd_swig.h uhd_swig.py uhd_swig.cc: uhd_swig.i +## This rule will get called only when MAKE decides that one of the +## targets needs to be created or re-created, because: +## +## * The .i file is newer than any or all of the generated files; +## +## * Any or all of the .cc, .h, or .py files does not exist and is +## needed (in the case this file is not needed, the rule for it is +## ignored); or +## +## * Some SWIG-based dependecy of the .cc file isn't met and hence the +## .cc file needs be be regenerated. Explanation: Because MAKE +## knows how to handle dependencies for .cc files (regardless of +## their name or extension), then the .cc file is used as a target +## instead of the .i file -- but with the dependencies of the .i +## file. It is this last reason why the line: +## +## if test -f $@; then :; else +## +## cannot be used in this case: If a .i file dependecy is not met, +## then the .cc file needs to be rebuilt. But if the stamp is newer +## than the .cc file, and the .cc file exists, then in the original +## version (with the 'test' above) the internal MAKE call will not +## be issued and hence the .cc file will not be rebuilt. +## +## Once execution gets to here, it should always proceed no matter the +## state of a stamp (as discussed in link above). The +## $(DEPDIR)/uhd_swig-generate stuff is used to allow for parallel +## builds to "do the right thing". The stamp has no relationship with +## either the target files or dependency file; it is used solely for +## the protection of multiple builds during a given call to MAKE. +## +## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM +## (15). At a caught signal, the quoted command will be issued before +## exiting. In this case, remove any stamp, whether temporary of not. +## The trap is valid until the process exits; the process includes all +## commands appended via "\"s. +## + trap 'rm -rf $(DEPDIR)/uhd_swig-generate-*' 1 2 13 15; \ +## +## Create a temporary directory, which acts as a lock. The first +## process to create the directory will succeed and issue the MAKE +## command to do the actual work, while all subsequent processes will +## fail -- leading them to wait for the first process to finish. +## + if mkdir $(DEPDIR)/uhd_swig-generate-lock 2>/dev/null; then \ +## +## This code is being executed by the first process to succeed in +## creating the directory lock. +## +## Remove the stamp associated with this filename. +## + rm -f $(DEPDIR)/uhd_swig-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-stamp WHAT=$<; \ +## +## Now that the .cc, .h, and .py files have been (re)created from the +## .i file, future checking of this rule during the same MAKE +## execution will come back that the rule doesn't need to be executed +## because none of the conditions mentioned at the start of this rule +## will be positive. Remove the the directory lock, which frees up +## any waiting process(es) to continue. +## + rmdir $(DEPDIR)/uhd_swig-generate-lock; \ + else \ +## +## This code is being executed by any follower processes while the +## directory lock is in place. +## +## Wait until the first process is done, testing once per second. +## + while test -d $(DEPDIR)/uhd_swig-generate-lock; do \ + sleep 1; \ + done; \ +## +## Succeed if and only if the first process succeeded; exit this +## process returning the status of the generated stamp. +## + test -f $(DEPDIR)/uhd_swig-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/uhd_swig-generate-stamp: +## This rule will be called only by the first process issuing the +## above rule to succeed in creating the lock directory, after +## removing the actual stamp file in order to guarantee that MAKE will +## execute this rule. +## +## Call SWIG to generate the various output files; special +## post-processing on 'mingw32' host OS for the dependency file. +## + if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ + -MD -MF $(DEPDIR)/uhd_swig.Std \ + -module uhd_swig -o uhd_swig.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/uhd_swig.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig.Std \ + > $(DEPDIR)/uhd_swig.Sd; \ + $(RM) $(DEPDIR)/uhd_swig.Std; \ + $(MV) $(DEPDIR)/uhd_swig.Sd $(DEPDIR)/uhd_swig.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/uhd_swig.S*; exit 1; \ + fi; +## +## Mess with the SWIG output .Std dependency file, to create a +## dependecy file valid for the input .i file: Basically, simulate the +## dependency file created for libraries by GNU's libtool for C++, +## where all of the dependencies for the target are first listed, then +## each individual dependency is listed as a target with no further +## dependencies. +## +## (1) remove the current dependency file +## + $(RM) $(DEPDIR)/uhd_swig.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/uhd_swig.Std $(DEPDIR)/uhd_swig.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/uhd_swig.d +## +## (4) from the SWIG file, remove the first line (the target); remove +## trailing " \" and " " from each line. Append ":" to each line, +## followed by 2 carriage returns, then append this to the end of +## the dependency file. +## + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/uhd_swig.Std +## +## Create the stamp for this filename generation, to signal success in +## executing this rule; allows other threads waiting on this process +## to continue. +## + touch $(DEPDIR)/uhd_swig-generate-stamp + +# KLUDGE: Force runtime include of a SWIG dependency file. This is +# not guaranteed to be portable, but will probably work. If it works, +# we have accurate dependencies for our swig stuff, which is good. + +@am__include@ @am__quote@./$(DEPDIR)/uhd_swig.d@am__quote@ + diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py new file mode 100644 index 000000000..2fed17e57 --- /dev/null +++ b/gr-uhd/swig/__init__.py @@ -0,0 +1,28 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# The presence of this file turns this directory into a Python package + +# Add SWIG generated code to this namespace +from uhd_swig import * + +# Add other content from pure-Python modules here + diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i new file mode 100644 index 000000000..e20d22a26 --- /dev/null +++ b/gr-uhd/swig/uhd_swig.i @@ -0,0 +1,31 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +%include "gnuradio.i" + +%{ +#include +%} + +GR_SWIG_BLOCK_MAGIC(uhd,simple_source) + +%include -- cgit From 6d71414a0a467dc37fc903b327be22f8d0ddeade Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 2 Mar 2010 14:43:20 -0800 Subject: Added the uhd simple sink lib block, swig wrapper, grc wrapper. It seems to work, but still getting the kinks out of tx->usrp2 --- gr-uhd/swig/uhd_swig.i | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index e20d22a26..06a1c88ff 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -24,8 +24,11 @@ %{ #include +#include %} GR_SWIG_BLOCK_MAGIC(uhd,simple_source) - %include + +GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) +%include -- cgit From 6851718b6d9a97a8c9397a1548708c7075de98e4 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 29 Mar 2010 15:30:02 -0700 Subject: added swig includes and tune result return --- gr-uhd/swig/uhd_swig.i | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 06a1c88ff..363d9c914 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -27,6 +27,9 @@ #include %} +%include +%include + GR_SWIG_BLOCK_MAGIC(uhd,simple_source) %include -- cgit From a87552815119742d98561f9b53ab0da5513514bb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 30 Mar 2010 14:08:11 -0700 Subject: gr-uhd working with io type --- gr-uhd/swig/Makefile.am | 5 ++++- gr-uhd/swig/uhd_swig.i | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 3b1fd20f8..183e6b587 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -25,6 +25,7 @@ AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) \ + $(UHD_CFLAGS) \ -I$(top_srcdir)/gr-uhd/lib if PYTHON @@ -56,7 +57,9 @@ uhd_swig_swiginclude_headers = include $(top_srcdir)/Makefile.swig # FIXME better way to set this? -STD_SWIG_PYTHON_ARGS += -I$(top_srcdir)/gr-uhd/lib +STD_SWIG_PYTHON_ARGS += \ + $(UHD_CFLAGS) \ + -I$(top_srcdir)/gr-uhd/lib # add some of the variables generated inside the Makefile.swig.gen BUILT_SOURCES = $(swig_built_sources) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 363d9c914..2642f9450 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -27,8 +27,10 @@ #include %} +%include %include %include +%include GR_SWIG_BLOCK_MAGIC(uhd,simple_source) %include -- cgit From 1e71bdae9956d64e06bdfbb0c87530619807e100 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 30 Jun 2010 10:12:02 -0700 Subject: uhd: added calls to set time and clock config --- gr-uhd/swig/uhd_swig.i | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 2642f9450..5956a686c 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -31,6 +31,8 @@ %include %include %include +%include +%include GR_SWIG_BLOCK_MAGIC(uhd,simple_source) %include -- cgit From 4e636b2b4bb29d5224aeff4ae79af121020338f1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 2 Jul 2010 18:30:31 -0700 Subject: uhd mimo: created mimo source and sink block for gr-uhd --- gr-uhd/swig/uhd_swig.i | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 5956a686c..34e140887 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -23,6 +23,8 @@ %include "gnuradio.i" %{ +#include +#include #include #include %} @@ -34,6 +36,12 @@ %include %include +GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) +%include + +GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink) +%include + GR_SWIG_BLOCK_MAGIC(uhd,simple_source) %include -- cgit From 385eafd8559b90a027604dd5c0ab734bea54f6d8 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 21 Sep 2010 17:12:47 -0700 Subject: uhd: added grc and swig wrappers for single usrp --- gr-uhd/swig/uhd_swig.i | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 34e140887..d755dfeee 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -21,12 +21,20 @@ */ %include "gnuradio.i" +%include "std_string.i" +%include "std_vector.i" + +namespace std { + %template(StringVector) vector; +} %{ #include #include #include #include +#include +#include %} %include @@ -47,3 +55,9 @@ GR_SWIG_BLOCK_MAGIC(uhd,simple_source) GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) %include + +GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source) +%include + +GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) +%include -- cgit From 873228d25b3ea5df8eb10f6652518f144858af61 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 18 Oct 2010 13:46:51 -0700 Subject: uhd: filled in multi usrp code and swig file --- gr-uhd/swig/uhd_swig.i | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index d755dfeee..1631a768a 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -29,10 +29,13 @@ namespace std { } %{ -#include -#include -#include -#include +#include //deprecated +#include //deprecated +#include //deprecated +#include //deprecated + +#include +#include #include #include %} @@ -44,17 +47,23 @@ namespace std { %include %include -GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) -%include +GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) //deprecated +%include //deprecated + +GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink) //deprecated +%include //deprecated + +GR_SWIG_BLOCK_MAGIC(uhd,simple_source) //deprecated +%include //deprecated -GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink) -%include +GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) //deprecated +%include //deprecated -GR_SWIG_BLOCK_MAGIC(uhd,simple_source) -%include +GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_source) +%include -GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) -%include +GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_sink) +%include GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source) %include -- cgit From 343cba5663d0eefdd3ee3918bef812dc1bd75508 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 18 Oct 2010 18:29:20 -0700 Subject: uhd: tweaked and tested multi usrp with a single channel --- gr-uhd/swig/uhd_swig.i | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 1631a768a..6f29f706d 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -20,6 +20,9 @@ * Boston, MA 02110-1301, USA. */ +//////////////////////////////////////////////////////////////////////// +// standard includes +//////////////////////////////////////////////////////////////////////// %include "gnuradio.i" %include "std_string.i" %include "std_vector.i" @@ -28,6 +31,9 @@ namespace std { %template(StringVector) vector; } +//////////////////////////////////////////////////////////////////////// +// block headers +//////////////////////////////////////////////////////////////////////// %{ #include //deprecated #include //deprecated @@ -40,6 +46,9 @@ namespace std { #include %} +//////////////////////////////////////////////////////////////////////// +// used types +//////////////////////////////////////////////////////////////////////// %include %include %include @@ -47,6 +56,9 @@ namespace std { %include %include +//////////////////////////////////////////////////////////////////////// +// block magic +//////////////////////////////////////////////////////////////////////// GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) //deprecated %include //deprecated @@ -70,3 +82,11 @@ GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source) GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) %include + +//////////////////////////////////////////////////////////////////////// +// helpful constants +//////////////////////////////////////////////////////////////////////// +%{ +static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; +%} +static const size_t ALL_MBOARDS; -- cgit From cd6b9eee92cbb16c4b36f568b812de4dc918eac8 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 21 Oct 2010 15:09:31 -0700 Subject: uhd: install swig exception handler --- gr-uhd/swig/uhd_swig.i | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 6f29f706d..5b3b52472 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -20,6 +20,24 @@ * Boston, MA 02110-1301, USA. */ +//////////////////////////////////////////////////////////////////////// +// Language independent exception handler +//////////////////////////////////////////////////////////////////////// +%include exception.i + +%exception { + try { + $action + } + catch(std::exception &e) { + SWIG_exception(SWIG_RuntimeError, e.what()); + } + catch(...) { + SWIG_exception(SWIG_RuntimeError, "Unknown exception"); + } + +} + //////////////////////////////////////////////////////////////////////// // standard includes //////////////////////////////////////////////////////////////////////// -- cgit From 5a2de999da86d48cd7f005d08cc48965cb8c7a65 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 25 Oct 2010 16:22:05 -0700 Subject: uhd: move tune functions to tune_request and provide wrapper for simple case --- gr-uhd/swig/uhd_swig.i | 1 + 1 file changed, 1 insertion(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 5b3b52472..d332bb617 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -69,6 +69,7 @@ namespace std { //////////////////////////////////////////////////////////////////////// %include %include +%include %include %include %include -- cgit From 3dab5d93a45928baa4fb23878d644751e06943a0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 28 Oct 2010 13:24:23 -0700 Subject: uhd: make a tune_request_t that inherits from float for GRC, added docs --- gr-uhd/swig/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 2fed17e57..0fdacb796 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -21,8 +21,20 @@ # The presence of this file turns this directory into a Python package +######################################################################## # Add SWIG generated code to this namespace +######################################################################## from uhd_swig import * +######################################################################## # Add other content from pure-Python modules here +######################################################################## +class tune_request_t(tune_request_t, float): + """ + Make the python tune request object inherit from float + so that it can be passed in GRC as a frequency parameter. + The type checking in GRC will accept the tune request. + """ + def __new__(self, *args): return float.__new__(self) + def __float__(self): return self.target_freq -- cgit From 38c60bd0bfb411c2557b84f92bcbd66395475ba6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 1 Nov 2010 19:01:49 -0700 Subject: uhd: swig changes for templated ranges --- gr-uhd/swig/uhd_swig.i | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index d332bb617..3c6773374 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -68,6 +68,7 @@ namespace std { // used types //////////////////////////////////////////////////////////////////////// %include +%include %include %include %include @@ -75,6 +76,17 @@ namespace std { %include %include +//Re-create range typedefs here with %template as they are not imported. +//Replicate all the levels of templated inheritance so swig understands. + +%template(float_range_t) uhd::range_t; +%template(_float_range_vector_t) std::vector >; +%template(gain_range_t) uhd::meta_range_t; + +%template(double_range_t) uhd::range_t; +%template(_double_range_vector_t) std::vector >; +%template(freq_range_t) uhd::meta_range_t; + //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -- cgit From ed4094208c501e91838ccc333059e4731e8ae908 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 14 Oct 2010 12:34:08 -0600 Subject: regenerated after changes to the template --- gr-uhd/swig/Makefile.swig.gen | 59 +++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 14 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 3804461a4..36475a12e 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -72,7 +72,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += uhd_swig.py uhd_swig.cc +swig_built_sources += uhd_swig.py uhd_swig_python.cc ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -83,21 +83,21 @@ uhd_swig_swiginclude_HEADERS = \ $(uhd_swig_swiginclude_headers) uhd_swig_pylib_LTLIBRARIES = \ - _uhd_swig.la + _uhd_swig_python.la -_uhd_swig_la_SOURCES = \ - uhd_swig.cc \ +_uhd_swig_python_la_SOURCES = \ + uhd_swig_python.cc \ $(uhd_swig_la_swig_sources) -_uhd_swig_la_LIBADD = \ +_uhd_swig_python_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(uhd_swig_la_swig_libadd) -_uhd_swig_la_LDFLAGS = \ +_uhd_swig_python_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(uhd_swig_la_swig_ldflags) -_uhd_swig_la_CXXFLAGS = \ +_uhd_swig_python_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ $(uhd_swig_la_swig_cxxflags) @@ -105,9 +105,23 @@ uhd_swig_python_PYTHON = \ uhd_swig.py \ $(uhd_swig_python) +if GUILE +uhd_swig_pylib_LTLIBRARIES += _uhd_swig_guile.la + +_uhd_swig_guile_la_SOURCES = \ + uhd_swig_guile.cc \ + $(uhd_swig_la_swig_sources) + +# Guile can use the same flags as python does +_uhd_swig_guile_la_LIBADD = $(_uhd_swig_python_la_LIBADD) +_uhd_swig_guile_la_LDFLAGS = $(_uhd_swig_python_la_LDFLAGS) +_uhd_swig_guile_la_CXXFLAGS = $(_uhd_swig_python_la_CXXFLAGS) + +endif # end of GUILE + ## Entry rule for running SWIG -uhd_swig.h uhd_swig.py uhd_swig.cc: uhd_swig.i +uhd_swig.h uhd_swig.py uhd_swig_python.cc: uhd_swig.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -159,11 +173,12 @@ uhd_swig.h uhd_swig.py uhd_swig.cc: uhd_swig.i ## ## Remove the stamp associated with this filename. ## - rm -f $(DEPDIR)/uhd_swig-generate-stamp; \ + rm -f $(DEPDIR)/uhd_swig-generate-*stamp; \ ## ## Tell MAKE to run the rule for creating this stamp. ## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-python-stamp WHAT=$<; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -187,11 +202,27 @@ uhd_swig.h uhd_swig.py uhd_swig.cc: uhd_swig.i ## Succeed if and only if the first process succeeded; exit this ## process returning the status of the generated stamp. ## - test -f $(DEPDIR)/uhd_swig-generate-stamp; \ + test -f $(DEPDIR)/uhd_swig-generate-python-stamp; \ exit $$?; \ fi; -$(DEPDIR)/uhd_swig-generate-stamp: +$(DEPDIR)/uhd_swig-generate-guile-stamp: + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(uhd_swig_swig_args) \ + -MD -MF $(DEPDIR)/uhd_swig.Std \ + -module uhd_swig -o uhd_swig_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/uhd_swig.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig.Std \ + > $(DEPDIR)/uhd_swig.Sd; \ + $(RM) $(DEPDIR)/uhd_swig.Std; \ + $(MV) $(DEPDIR)/uhd_swig.Sd $(DEPDIR)/uhd_swig.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/uhd_swig.S*; exit 1; \ + fi; + touch $(DEPDIR)/uhd_swig-generate-guile-stamp + +$(DEPDIR)/uhd_swig-generate-python-stamp: ## This rule will be called only by the first process issuing the ## above rule to succeed in creating the lock directory, after ## removing the actual stamp file in order to guarantee that MAKE will @@ -202,7 +233,7 @@ $(DEPDIR)/uhd_swig-generate-stamp: ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ -MD -MF $(DEPDIR)/uhd_swig.Std \ - -module uhd_swig -o uhd_swig.cc $(WHAT); then \ + -module uhd_swig -o uhd_swig_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ $(RM) $(DEPDIR)/uhd_swig.Sd; \ $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig.Std \ @@ -249,7 +280,7 @@ $(DEPDIR)/uhd_swig-generate-stamp: ## executing this rule; allows other threads waiting on this process ## to continue. ## - touch $(DEPDIR)/uhd_swig-generate-stamp + touch $(DEPDIR)/uhd_swig-generate-python-stamp # KLUDGE: Force runtime include of a SWIG dependency file. This is # not guaranteed to be portable, but will probably work. If it works, -- cgit From f97d37a216d1a3ff888f8b57c0090f9def9dd021 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 18 Oct 2010 19:24:49 -0700 Subject: Update generated files --- gr-uhd/swig/Makefile.swig.gen | 112 ++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 32 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 36475a12e..d10f6baa5 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -38,6 +38,16 @@ uhd_swig_pylibdir_category ?= $(uhd_swig_pythondir_category) uhd_swig_pythondir = $(pythondir)/$(uhd_swig_pythondir_category) uhd_swig_pylibdir = $(pyexecdir)/$(uhd_swig_pylibdir_category) +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +uhd_swig_scmlibdir = @GUILE_PKLIBDIR@/gnuradio + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/uhd_swig +# FIXME: determince whether these should be installed with gnuradio. +uhd_swig_scmdir = @GUILE_PKDATADIR@/gnuradio + ## SWIG headers are always installed into the same directory. uhd_swig_swigincludedir = $(swigincludedir) @@ -73,6 +83,9 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## be added manually by the including Makefile.am . swig_built_sources += uhd_swig.py uhd_swig_python.cc +if GUILE +swig_built_sources += uhd_swig.scm uhd_swig_guile.cc +endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -106,11 +119,11 @@ uhd_swig_python_PYTHON = \ $(uhd_swig_python) if GUILE -uhd_swig_pylib_LTLIBRARIES += _uhd_swig_guile.la - +uhd_swig_scmlib_LTLIBRARIES = _uhd_swig_guile.la _uhd_swig_guile_la_SOURCES = \ - uhd_swig_guile.cc \ + uhd_swig_guile.cc \ $(uhd_swig_la_swig_sources) +uhd_swig_scm_DATA = uhd_swig.scm # Guile can use the same flags as python does _uhd_swig_guile_la_LIBADD = $(_uhd_swig_python_la_LIBADD) @@ -121,7 +134,8 @@ endif # end of GUILE ## Entry rule for running SWIG -uhd_swig.h uhd_swig.py uhd_swig_python.cc: uhd_swig.i +# $(python_deps) $(guile_deps): uhd_swig.i +uhd_swig_python.h uhd_swig.py uhd_swig_python.cc: uhd_swig.i ## This rule will get called only when MAKE decides that one of the ## targets needs to be created or re-created, because: ## @@ -178,7 +192,6 @@ uhd_swig.h uhd_swig.py uhd_swig_python.cc: uhd_swig.i ## Tell MAKE to run the rule for creating this stamp. ## $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-python-stamp WHAT=$<; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-guile-stamp WHAT=$<; \ ## ## Now that the .cc, .h, and .py files have been (re)created from the ## .i file, future checking of this rule during the same MAKE @@ -206,21 +219,23 @@ uhd_swig.h uhd_swig.py uhd_swig_python.cc: uhd_swig.i exit $$?; \ fi; -$(DEPDIR)/uhd_swig-generate-guile-stamp: - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(uhd_swig_swig_args) \ - -MD -MF $(DEPDIR)/uhd_swig.Std \ - -module uhd_swig -o uhd_swig_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/uhd_swig.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig.Std \ - > $(DEPDIR)/uhd_swig.Sd; \ - $(RM) $(DEPDIR)/uhd_swig.Std; \ - $(MV) $(DEPDIR)/uhd_swig.Sd $(DEPDIR)/uhd_swig.Std; \ - fi; \ +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. +uhd_swig_guile.h uhd_swig.scm uhd_swig_guile.cc: uhd_swig.i +if GUILE + trap 'rm -rf $(DEPDIR)/uhd_swig-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/uhd_swig-generate-lock 2>/dev/null; then \ + rm -f $(DEPDIR)/uhd_swig-generate-*stamp; \ + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-guile-stamp WHAT=$<; \ + rmdir $(DEPDIR)/uhd_swig-generate-lock; \ else \ - $(RM) $(DEPDIR)/uhd_swig.S*; exit 1; \ + while test -d $(DEPDIR)/uhd_swig-generate-lock; do \ + sleep 1; \ + done; \ + test -f $(DEPDIR)/uhd_swig-generate-guile-stamp; \ + exit $$?; \ fi; - touch $(DEPDIR)/uhd_swig-generate-guile-stamp +endif # end of GUILE $(DEPDIR)/uhd_swig-generate-python-stamp: ## This rule will be called only by the first process issuing the @@ -232,17 +247,17 @@ $(DEPDIR)/uhd_swig-generate-python-stamp: ## post-processing on 'mingw32' host OS for the dependency file. ## if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ - -MD -MF $(DEPDIR)/uhd_swig.Std \ + -MD -MF $(DEPDIR)/uhd_swig_python.Std \ -module uhd_swig -o uhd_swig_python.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/uhd_swig.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig.Std \ - > $(DEPDIR)/uhd_swig.Sd; \ - $(RM) $(DEPDIR)/uhd_swig.Std; \ - $(MV) $(DEPDIR)/uhd_swig.Sd $(DEPDIR)/uhd_swig.Std; \ + $(RM) $(DEPDIR)/uhd_swig_python.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig_python.Std \ + > $(DEPDIR)/uhd_swig_python.Sd; \ + $(RM) $(DEPDIR)/uhd_swig_python.Std; \ + $(MV) $(DEPDIR)/uhd_swig_python.Sd $(DEPDIR)/uhd_swig_python.Std; \ fi; \ else \ - $(RM) $(DEPDIR)/uhd_swig.S*; exit 1; \ + $(RM) $(DEPDIR)/uhd_swig_python.S*; exit 1; \ fi; ## ## Mess with the SWIG output .Std dependency file, to create a @@ -254,27 +269,27 @@ $(DEPDIR)/uhd_swig-generate-python-stamp: ## ## (1) remove the current dependency file ## - $(RM) $(DEPDIR)/uhd_swig.d + $(RM) $(DEPDIR)/uhd_swig_python.d ## ## (2) Copy the whole SWIG file: ## - cp $(DEPDIR)/uhd_swig.Std $(DEPDIR)/uhd_swig.d + cp $(DEPDIR)/uhd_swig_python.Std $(DEPDIR)/uhd_swig_python.d ## ## (3) all a carriage return to the end of the dependency file. ## - echo "" >> $(DEPDIR)/uhd_swig.d + echo "" >> $(DEPDIR)/uhd_swig_python.d ## ## (4) from the SWIG file, remove the first line (the target); remove ## trailing " \" and " " from each line. Append ":" to each line, ## followed by 2 carriage returns, then append this to the end of ## the dependency file. ## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig_python.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig_python.d ## ## (5) remove the SWIG-generated file ## - $(RM) $(DEPDIR)/uhd_swig.Std + $(RM) $(DEPDIR)/uhd_swig_python.Std ## ## Create the stamp for this filename generation, to signal success in ## executing this rule; allows other threads waiting on this process @@ -286,5 +301,38 @@ $(DEPDIR)/uhd_swig-generate-python-stamp: # not guaranteed to be portable, but will probably work. If it works, # we have accurate dependencies for our swig stuff, which is good. -@am__include@ @am__quote@./$(DEPDIR)/uhd_swig.d@am__quote@ +@am__include@ @am__quote@./$(DEPDIR)/uhd_swig_python.d@am__quote@ + +if GUILE +$(DEPDIR)/uhd_swig-generate-guile-stamp: +# the comments for the target above apply to this target as well, but it seemed +# silly to include them twice. The only main change is for guile. + if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(uhd_swig_swig_args) \ + -MD -MF $(DEPDIR)/uhd_swig_guile.Std \ + -module uhd_swig -o uhd_swig_guile.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/uhd_swig_guile.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig_guile.Std \ + > $(DEPDIR)/uhd_swig_guile.Sd; \ + $(RM) $(DEPDIR)/uhd_swig_guile.Std; \ + $(MV) $(DEPDIR)/uhd_swig_guile.Sd $(DEPDIR)/uhd_swig_guile.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/uhd_swig_guile.S*; exit 1; \ + fi; + touch $(DEPDIR)/uhd_swig-generate-guile-stamp + $(RM) $(DEPDIR)/uhd_swig_guile.d + cp $(DEPDIR)/uhd_swig_guile.Std $(DEPDIR)/uhd_swig_guile.d + echo "" >> $(DEPDIR)/uhd_swig_guile.d + $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig_guile.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig_guile.d + $(RM) $(DEPDIR)/uhd_swig_guile.Std + touch $(DEPDIR)/uhd_swig-generate-guile-stamp +else + touch $(DEPDIR)/uhd_swig-generate-guile-stamp +endif + +@am__include@ @am__quote@./$(DEPDIR)/uhd_swig_guile.d@am__quote@ + +#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i -- cgit From 1e34972f4433cbfef3500fc73a285c7c436cfd6b Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 22:00:09 -0700 Subject: Rengenerate Makefile.swig.gen's --- gr-uhd/swig/Makefile.swig.gen | 246 +++++------------------------------------- 1 file changed, 28 insertions(+), 218 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index d10f6baa5..e06723814 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -41,12 +41,12 @@ uhd_swig_pylibdir = $(pyexecdir)/$(uhd_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -uhd_swig_scmlibdir = @GUILE_PKLIBDIR@/gnuradio +uhd_swig_scmlibdir = $(libdir)/guile/gnuradio # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/uhd_swig # FIXME: determince whether these should be installed with gnuradio. -uhd_swig_scmdir = @GUILE_PKDATADIR@/gnuradio +uhd_swig_scmdir = $(guiledir)/gnuradio ## SWIG headers are always installed into the same directory. @@ -82,9 +82,11 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## .h file is sometimes built, but not always ... so that one has to ## be added manually by the including Makefile.am . -swig_built_sources += uhd_swig.py uhd_swig_python.cc +# generating the py or scm file also generates the .cc or .h files, +# but dependencies work better without the .cc ort .h files listed. +swig_built_sources += uhd_swig.py if GUILE -swig_built_sources += uhd_swig.scm uhd_swig_guile.cc +swig_built_sources += uhd_swig.scm endif ## Various SWIG variables. These can be overloaded in the including @@ -96,243 +98,51 @@ uhd_swig_swiginclude_HEADERS = \ $(uhd_swig_swiginclude_headers) uhd_swig_pylib_LTLIBRARIES = \ - _uhd_swig_python.la + _uhd_swig.la -_uhd_swig_python_la_SOURCES = \ - uhd_swig_python.cc \ +_uhd_swig_la_SOURCES = \ + python/uhd_swig.cc \ $(uhd_swig_la_swig_sources) -_uhd_swig_python_la_LIBADD = \ +_uhd_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(uhd_swig_la_swig_libadd) -_uhd_swig_python_la_LDFLAGS = \ +# _uhd_swig_la_DEPENDENCIES = python/uhd_swig.lo + +_uhd_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(uhd_swig_la_swig_ldflags) -_uhd_swig_python_la_CXXFLAGS = \ +_uhd_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(uhd_swig_la_swig_cxxflags) uhd_swig_python_PYTHON = \ uhd_swig.py \ - $(uhd_swig_python) + $(uhd_swig) if GUILE -uhd_swig_scmlib_LTLIBRARIES = _uhd_swig_guile.la -_uhd_swig_guile_la_SOURCES = \ - uhd_swig_guile.cc \ +uhd_swig_scmlib_LTLIBRARIES = uhd_swig_guile.la +uhd_swig_guile_la_SOURCES = \ + guile/uhd_swig.cc \ $(uhd_swig_la_swig_sources) uhd_swig_scm_DATA = uhd_swig.scm # Guile can use the same flags as python does -_uhd_swig_guile_la_LIBADD = $(_uhd_swig_python_la_LIBADD) -_uhd_swig_guile_la_LDFLAGS = $(_uhd_swig_python_la_LDFLAGS) -_uhd_swig_guile_la_CXXFLAGS = $(_uhd_swig_python_la_CXXFLAGS) - -endif # end of GUILE +uhd_swig_guile_la_LIBADD = $(_uhd_swig_la_LIBADD) +uhd_swig_guile_la_LDFLAGS = $(_uhd_swig_la_LDFLAGS) +uhd_swig_guile_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) -## Entry rule for running SWIG - -# $(python_deps) $(guile_deps): uhd_swig.i -uhd_swig_python.h uhd_swig.py uhd_swig_python.cc: uhd_swig.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/uhd_swig-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/uhd_swig-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/uhd_swig-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/uhd_swig-generate-*stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-python-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/uhd_swig-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/uhd_swig-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/uhd_swig-generate-python-stamp; \ - exit $$?; \ - fi; +guile/uhd_swig.lo: uhd_swig.lo +uhd_swig.scm: uhd_swig.i -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. -uhd_swig_guile.h uhd_swig.scm uhd_swig_guile.cc: uhd_swig.i -if GUILE - trap 'rm -rf $(DEPDIR)/uhd_swig-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/uhd_swig-generate-lock 2>/dev/null; then \ - rm -f $(DEPDIR)/uhd_swig-generate-*stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-guile-stamp WHAT=$<; \ - rmdir $(DEPDIR)/uhd_swig-generate-lock; \ - else \ - while test -d $(DEPDIR)/uhd_swig-generate-lock; do \ - sleep 1; \ - done; \ - test -f $(DEPDIR)/uhd_swig-generate-guile-stamp; \ - exit $$?; \ - fi; endif # end of GUILE -$(DEPDIR)/uhd_swig-generate-python-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ - -MD -MF $(DEPDIR)/uhd_swig_python.Std \ - -module uhd_swig -o uhd_swig_python.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/uhd_swig_python.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig_python.Std \ - > $(DEPDIR)/uhd_swig_python.Sd; \ - $(RM) $(DEPDIR)/uhd_swig_python.Std; \ - $(MV) $(DEPDIR)/uhd_swig_python.Sd $(DEPDIR)/uhd_swig_python.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/uhd_swig_python.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/uhd_swig_python.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/uhd_swig_python.Std $(DEPDIR)/uhd_swig_python.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/uhd_swig_python.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig_python.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig_python.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/uhd_swig_python.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/uhd_swig-generate-python-stamp - -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. - -@am__include@ @am__quote@./$(DEPDIR)/uhd_swig_python.d@am__quote@ - -if GUILE -$(DEPDIR)/uhd_swig-generate-guile-stamp: -# the comments for the target above apply to this target as well, but it seemed -# silly to include them twice. The only main change is for guile. - if $(SWIG) $(STD_SWIG_GUILE_ARGS) $(uhd_swig_swig_args) \ - -MD -MF $(DEPDIR)/uhd_swig_guile.Std \ - -module uhd_swig -o uhd_swig_guile.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/uhd_swig_guile.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig_guile.Std \ - > $(DEPDIR)/uhd_swig_guile.Sd; \ - $(RM) $(DEPDIR)/uhd_swig_guile.Std; \ - $(MV) $(DEPDIR)/uhd_swig_guile.Sd $(DEPDIR)/uhd_swig_guile.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/uhd_swig_guile.S*; exit 1; \ - fi; - touch $(DEPDIR)/uhd_swig-generate-guile-stamp - $(RM) $(DEPDIR)/uhd_swig_guile.d - cp $(DEPDIR)/uhd_swig_guile.Std $(DEPDIR)/uhd_swig_guile.d - echo "" >> $(DEPDIR)/uhd_swig_guile.d - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig_guile.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig_guile.d - $(RM) $(DEPDIR)/uhd_swig_guile.Std - touch $(DEPDIR)/uhd_swig-generate-guile-stamp -else - touch $(DEPDIR)/uhd_swig-generate-guile-stamp -endif - -@am__include@ @am__quote@./$(DEPDIR)/uhd_swig_guile.d@am__quote@ +python/uhd_swig.lo: +uhd_swig.lo: uhd_swig.py uhd_swig.scm +uhd_swig.py: uhd_swig.i -#gnuradio_swig_py_runtime_python.h: gnuradio_swig_py_runtime.i +-include python/uhd_swig.d -- cgit From 6421d47062f4bf5abbdf26142616a5965f1edfa0 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 22 Oct 2010 23:28:06 -0700 Subject: regenerate --- gr-uhd/swig/Makefile.swig.gen | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index e06723814..88ed33834 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -41,7 +41,7 @@ uhd_swig_pylibdir = $(pyexecdir)/$(uhd_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -uhd_swig_scmlibdir = $(libdir)/guile/gnuradio +uhd_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/uhd_swig @@ -124,16 +124,16 @@ uhd_swig_python_PYTHON = \ $(uhd_swig) if GUILE -uhd_swig_scmlib_LTLIBRARIES = uhd_swig_guile.la -uhd_swig_guile_la_SOURCES = \ +uhd_swig_scmlib_LTLIBRARIES = libguile-uhd_swig.la +libguile_uhd_swig_la_SOURCES = \ guile/uhd_swig.cc \ $(uhd_swig_la_swig_sources) uhd_swig_scm_DATA = uhd_swig.scm # Guile can use the same flags as python does -uhd_swig_guile_la_LIBADD = $(_uhd_swig_la_LIBADD) -uhd_swig_guile_la_LDFLAGS = $(_uhd_swig_la_LDFLAGS) -uhd_swig_guile_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) +libguile_uhd_swig_la_LIBADD = $(_uhd_swig_la_LIBADD) +libguile_uhd_swig_la_LDFLAGS = $(_uhd_swig_la_LDFLAGS) +libguile_uhd_swig_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) guile/uhd_swig.lo: uhd_swig.lo uhd_swig.scm: uhd_swig.i -- cgit From d94769a975612072dc03fa378bc79856c07cd66b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 30 Oct 2010 12:14:41 -0600 Subject: add load-extension support --- gr-uhd/swig/uhd_swig.i | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index d332bb617..8486b24a5 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -109,3 +109,13 @@ GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; %} static const size_t ALL_MBOARDS; + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-uhd_swig" "scm_init_gnuradio_uhd_swig_module") +%} + +%goops %{ +(use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif -- cgit From 2c54f4a56304b3dba7a66ed1baf06dc0bd8393e8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 31 Oct 2010 10:12:43 -0700 Subject: additional regenerated files --- gr-uhd/swig/Makefile.swig.gen | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 88ed33834..86ead5b00 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -46,7 +46,7 @@ uhd_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile # is installed, usually /usr/share/guile/site/uhd_swig # FIXME: determince whether these should be installed with gnuradio. -uhd_swig_scmdir = $(guiledir)/gnuradio +uhd_swig_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -128,7 +128,7 @@ uhd_swig_scmlib_LTLIBRARIES = libguile-uhd_swig.la libguile_uhd_swig_la_SOURCES = \ guile/uhd_swig.cc \ $(uhd_swig_la_swig_sources) -uhd_swig_scm_DATA = uhd_swig.scm +nobase_uhd_swig_scm_DATA = gnuradio/uhd_swig.scm gnuradio/uhd_swig-primitive.scm # Guile can use the same flags as python does libguile_uhd_swig_la_LIBADD = $(_uhd_swig_la_LIBADD) @@ -137,6 +137,9 @@ libguile_uhd_swig_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) guile/uhd_swig.lo: uhd_swig.lo uhd_swig.scm: uhd_swig.i +gnuradio/uhd_swig-primitive.scm: uhd_swig.scm + +-include guile/uhd_swig.d endif # end of GUILE -- cgit From 23d960981d6afcedb3a7fd1066a8acbfb0b4afdf Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sun, 31 Oct 2010 14:16:25 -0700 Subject: Use uhd_swig_swig_args instead of stomping on STD_SWIG_PYTHON_ARGS --- gr-uhd/swig/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 183e6b587..744dd8efe 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -56,8 +56,7 @@ uhd_swig_swiginclude_headers = include $(top_srcdir)/Makefile.swig -# FIXME better way to set this? -STD_SWIG_PYTHON_ARGS += \ +uhd_swig_swig_args = \ $(UHD_CFLAGS) \ -I$(top_srcdir)/gr-uhd/lib -- cgit From bc8fd41b84219cd08f057c524fe0b90ffef6f8aa Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 1 Nov 2010 16:28:14 -0700 Subject: regenerated --- gr-uhd/swig/Makefile.swig.gen | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 86ead5b00..c0823e5f2 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -84,10 +84,10 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* # generating the py or scm file also generates the .cc or .h files, # but dependencies work better without the .cc ort .h files listed. -swig_built_sources += uhd_swig.py -if GUILE -swig_built_sources += uhd_swig.scm -endif +# swig_built_sources += uhd_swig.py +# if GUILE +# swig_built_sources += gnuradio/uhd_swig.scm +# endif ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including @@ -135,15 +135,14 @@ libguile_uhd_swig_la_LIBADD = $(_uhd_swig_la_LIBADD) libguile_uhd_swig_la_LDFLAGS = $(_uhd_swig_la_LDFLAGS) libguile_uhd_swig_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) -guile/uhd_swig.lo: uhd_swig.lo -uhd_swig.scm: uhd_swig.i -gnuradio/uhd_swig-primitive.scm: uhd_swig.scm +guile/uhd_swig.cc: gnuradio/uhd_swig.scm +gnuradio/uhd_swig.scm: uhd_swig.i +gnuradio/uhd_swig-primitive.scm: gnuradio/uhd_swig.scm -include guile/uhd_swig.d endif # end of GUILE -python/uhd_swig.lo: uhd_swig.lo: uhd_swig.py uhd_swig.scm uhd_swig.py: uhd_swig.i -- cgit From df92b7c6315c567e58e0d9c293d7c9c2699023d3 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 10 Nov 2010 13:01:38 -0800 Subject: regenerated --- gr-uhd/swig/Makefile.swig.gen | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index c0823e5f2..1ddbf0bd9 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -67,28 +67,10 @@ uhd_swig_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/uhd_swig-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -# generating the py or scm file also generates the .cc or .h files, -# but dependencies work better without the .cc ort .h files listed. -# swig_built_sources += uhd_swig.py -# if GUILE -# swig_built_sources += gnuradio/uhd_swig.scm -# endif - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -108,8 +90,6 @@ _uhd_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(uhd_swig_la_swig_libadd) -# _uhd_swig_la_DEPENDENCIES = python/uhd_swig.lo - _uhd_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(uhd_swig_la_swig_ldflags) @@ -123,14 +103,20 @@ uhd_swig_python_PYTHON = \ uhd_swig.py \ $(uhd_swig) +python/uhd_swig.cc: uhd_swig.py +uhd_swig.py: uhd_swig.i + +# Include the python dependencies for this file +-include python/uhd_swig.d +# end of PYTHON + if GUILE uhd_swig_scmlib_LTLIBRARIES = libguile-uhd_swig.la -libguile_uhd_swig_la_SOURCES = \ +libguile_uhd_swig_la_SOURCES = \ guile/uhd_swig.cc \ $(uhd_swig_la_swig_sources) nobase_uhd_swig_scm_DATA = gnuradio/uhd_swig.scm gnuradio/uhd_swig-primitive.scm -# Guile can use the same flags as python does libguile_uhd_swig_la_LIBADD = $(_uhd_swig_la_LIBADD) libguile_uhd_swig_la_LDFLAGS = $(_uhd_swig_la_LDFLAGS) libguile_uhd_swig_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) @@ -139,12 +125,9 @@ guile/uhd_swig.cc: gnuradio/uhd_swig.scm gnuradio/uhd_swig.scm: uhd_swig.i gnuradio/uhd_swig-primitive.scm: gnuradio/uhd_swig.scm +# Include the guile dependencies for this file -include guile/uhd_swig.d endif # end of GUILE -uhd_swig.lo: uhd_swig.py uhd_swig.scm -uhd_swig.py: uhd_swig.i - --include python/uhd_swig.d -- cgit From 8180bb1d7020e07c9b0a217820c68d07f0d98a74 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 16 Nov 2010 21:33:50 -0800 Subject: regenerated --- gr-uhd/swig/Makefile.swig.gen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 1ddbf0bd9..cf7351fe2 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -101,7 +101,7 @@ _uhd_swig_la_CXXFLAGS = \ uhd_swig_python_PYTHON = \ uhd_swig.py \ - $(uhd_swig) + $(uhd_swig_python) python/uhd_swig.cc: uhd_swig.py uhd_swig.py: uhd_swig.i -- cgit From 4eadee57c588940347027c7e7f99ac7e993874fd Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 17 Nov 2010 13:54:04 -0800 Subject: Add support for guile std::vector< std::complex >. --- gr-uhd/swig/uhd_swig.i | 2 -- 1 file changed, 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 8486b24a5..b3abf29be 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -42,8 +42,6 @@ // standard includes //////////////////////////////////////////////////////////////////////// %include "gnuradio.i" -%include "std_string.i" -%include "std_vector.i" namespace std { %template(StringVector) vector; -- cgit From ff877cabe2384dc2155ef5af92ee8b959fd29806 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Fri, 19 Nov 2010 08:07:52 -0700 Subject: regenerated --- gr-uhd/swig/Makefile.swig.gen | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index cf7351fe2..782800c9b 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -79,6 +79,7 @@ uhd_swig_swiginclude_HEADERS = \ uhd_swig.i \ $(uhd_swig_swiginclude_headers) +if PYTHON uhd_swig_pylib_LTLIBRARIES = \ _uhd_swig.la @@ -86,6 +87,10 @@ _uhd_swig_la_SOURCES = \ python/uhd_swig.cc \ $(uhd_swig_la_swig_sources) +uhd_swig_python_PYTHON = \ + uhd_swig.py \ + $(uhd_swig_python) + _uhd_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(uhd_swig_la_swig_libadd) @@ -99,27 +104,34 @@ _uhd_swig_la_CXXFLAGS = \ -I$(top_builddir) \ $(uhd_swig_la_swig_cxxflags) -uhd_swig_python_PYTHON = \ - uhd_swig.py \ - $(uhd_swig_python) - python/uhd_swig.cc: uhd_swig.py uhd_swig.py: uhd_swig.i # Include the python dependencies for this file -include python/uhd_swig.d -# end of PYTHON + +endif # end of if python if GUILE -uhd_swig_scmlib_LTLIBRARIES = libguile-uhd_swig.la + +uhd_swig_scmlib_LTLIBRARIES = \ + libguile-uhd_swig.la libguile_uhd_swig_la_SOURCES = \ guile/uhd_swig.cc \ $(uhd_swig_la_swig_sources) -nobase_uhd_swig_scm_DATA = gnuradio/uhd_swig.scm gnuradio/uhd_swig-primitive.scm - -libguile_uhd_swig_la_LIBADD = $(_uhd_swig_la_LIBADD) -libguile_uhd_swig_la_LDFLAGS = $(_uhd_swig_la_LDFLAGS) -libguile_uhd_swig_la_CXXFLAGS = $(_uhd_swig_la_CXXFLAGS) +nobase_uhd_swig_scm_DATA = \ + gnuradio/uhd_swig.scm \ + gnuradio/uhd_swig-primitive.scm +libguile_uhd_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(uhd_swig_la_swig_libadd) +libguile_uhd_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(uhd_swig_la_swig_ldflags) +libguile_uhd_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(uhd_swig_la_swig_cxxflags) guile/uhd_swig.cc: gnuradio/uhd_swig.scm gnuradio/uhd_swig.scm: uhd_swig.i -- cgit From 655a7afcbcaf159e66a404b455a9581e0fe2cba3 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 19 Nov 2010 11:47:28 -0800 Subject: uhd: removed deprecated interfaces (simple and mimo) --- gr-uhd/swig/uhd_swig.i | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 3c6773374..695cf1cd2 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -53,11 +53,6 @@ namespace std { // block headers //////////////////////////////////////////////////////////////////////// %{ -#include //deprecated -#include //deprecated -#include //deprecated -#include //deprecated - #include #include #include @@ -90,18 +85,6 @@ namespace std { //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) //deprecated -%include //deprecated - -GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink) //deprecated -%include //deprecated - -GR_SWIG_BLOCK_MAGIC(uhd,simple_source) //deprecated -%include //deprecated - -GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) //deprecated -%include //deprecated - GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_source) %include -- cgit From ac0b247d245dcc9cfd3e376c0e0ab2b6f18376d4 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 23 Nov 2010 23:34:10 -0800 Subject: Add uhd.scm wrapper for uhd_swig.scm --- gr-uhd/swig/Makefile.am | 9 ++++++--- gr-uhd/swig/gnuradio/uhd.scm | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 gr-uhd/swig/gnuradio/uhd.scm (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 744dd8efe..abf38b293 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -20,6 +20,7 @@ # include $(top_srcdir)/Makefile.common +include $(top_srcdir)/Makefile.swig AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ @@ -28,7 +29,11 @@ AM_CPPFLAGS = \ $(UHD_CFLAGS) \ -I$(top_srcdir)/gr-uhd/lib -if PYTHON +if GUILE +nobase_guile_DATA = \ + gnuradio/uhd.scm +endif + # ---------------------------------------------------------------- # The SWIG library # TESTS = run_tests @@ -54,7 +59,6 @@ uhd_swig_python = \ # additional SWIG files to be installed uhd_swig_swiginclude_headers = -include $(top_srcdir)/Makefile.swig uhd_swig_swig_args = \ $(UHD_CFLAGS) \ @@ -65,4 +69,3 @@ BUILT_SOURCES = $(swig_built_sources) # Do not distribute the output of SWIG no_dist_files = $(swig_built_sources) -endif diff --git a/gr-uhd/swig/gnuradio/uhd.scm b/gr-uhd/swig/gnuradio/uhd.scm new file mode 100644 index 000000000..1999bbb0f --- /dev/null +++ b/gr-uhd/swig/gnuradio/uhd.scm @@ -0,0 +1,26 @@ +;;; +;;; Copyright 2010 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Radio +;;; +;;; GNU Radio is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. +;;; +;;; GNU Radio is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . +;;; + +;;; Semi bogus module that just reexports the uhd_swig module + +(define-module (gnuradio uhd) + #:use-module (gnuradio uhd_swig) + #:duplicates (merge-generics replace check)) + +(re-export-all '(gnuradio uhd_swig)) -- cgit From 4f578fca338f749c075c46f1a5f16ea5218c9f31 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 00:06:38 -0800 Subject: use export-safely --- gr-uhd/swig/gnuradio/uhd.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/gnuradio/uhd.scm b/gr-uhd/swig/gnuradio/uhd.scm index 1999bbb0f..906aef2a6 100644 --- a/gr-uhd/swig/gnuradio/uhd.scm +++ b/gr-uhd/swig/gnuradio/uhd.scm @@ -20,6 +20,7 @@ ;;; Semi bogus module that just reexports the uhd_swig module (define-module (gnuradio uhd) + #:use-module (gnuradio export-safely) #:use-module (gnuradio uhd_swig) #:duplicates (merge-generics replace check)) -- cgit From d692a41f98e7b888c745efbb9fcbbb0400f39025 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 17:29:11 -0800 Subject: Major Makefile.am housecleaning. Passes distcheck. Move all occurrences of swig_built_sources out of Makefile.am's. Move all SWIG related use of BUILT_SOURCES out of Makefile.am's. Clean up 'if PYTHON' conditionalization in gr-* Still left to do: fix Makefile.swig CLEANFILES and no_dist_files such that they remove exactly the generated files. --- gr-uhd/swig/Makefile.am | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index abf38b293..11c0cabb2 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -22,6 +22,8 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig +EXTRA_DIST += $(nobase_guile_DATA) + AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ @@ -59,13 +61,6 @@ uhd_swig_python = \ # additional SWIG files to be installed uhd_swig_swiginclude_headers = - uhd_swig_swig_args = \ $(UHD_CFLAGS) \ -I$(top_srcdir)/gr-uhd/lib - -# add some of the variables generated inside the Makefile.swig.gen -BUILT_SOURCES = $(swig_built_sources) - -# Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) -- cgit From 401465831199fa8e29f36d604d9004020a657e72 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 18:35:20 -0800 Subject: Update .gitignore's --- gr-uhd/swig/gnuradio/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 gr-uhd/swig/gnuradio/.gitignore (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/gnuradio/.gitignore b/gr-uhd/swig/gnuradio/.gitignore new file mode 100644 index 000000000..820cedd8c --- /dev/null +++ b/gr-uhd/swig/gnuradio/.gitignore @@ -0,0 +1,2 @@ +uhd_swig-primitive.scm +uhd_swig.scm -- cgit From b005e7d9f481ed39591d97ef697621368e6505c0 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 19:08:21 -0800 Subject: Update .gitignore's --- gr-uhd/swig/.gitignore | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/.gitignore b/gr-uhd/swig/.gitignore index 02d25cc00..8a421846d 100644 --- a/gr-uhd/swig/.gitignore +++ b/gr-uhd/swig/.gitignore @@ -2,3 +2,5 @@ /uhd_swig.py /Makefile /Makefile.in +/guile +/python -- cgit From 775bd35cde0b42f3aaab76f4014e5915783ecb44 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 30 Nov 2010 12:08:16 -0500 Subject: uhd: added libdir to UHD CFLAGS (shared by lib and swig) --- gr-uhd/swig/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 183e6b587..fd496fc7b 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -25,8 +25,7 @@ AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) \ - $(UHD_CFLAGS) \ - -I$(top_srcdir)/gr-uhd/lib + $(UHD_CFLAGS) if PYTHON # ---------------------------------------------------------------- -- cgit From 389d93f465b2114959aa86931d6b473634950e46 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 1 Dec 2010 10:53:32 -0500 Subject: uhd: default channel params to zero for single source and sink blocks --- gr-uhd/swig/Makefile.am | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index fd496fc7b..9eb3eab11 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -56,9 +56,7 @@ uhd_swig_swiginclude_headers = include $(top_srcdir)/Makefile.swig # FIXME better way to set this? -STD_SWIG_PYTHON_ARGS += \ - $(UHD_CFLAGS) \ - -I$(top_srcdir)/gr-uhd/lib +STD_SWIG_PYTHON_ARGS += $(UHD_CFLAGS) # add some of the variables generated inside the Makefile.swig.gen BUILT_SOURCES = $(swig_built_sources) -- cgit From 7d8f756d11189d9378a1bbeb921baabc9c0bf643 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 1 Dec 2010 15:31:41 -0500 Subject: uhd: replaced CFLAGS with CPPFLAGS variable, and fixed swig args FIXME --- gr-uhd/swig/Makefile.am | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 9eb3eab11..33a690a7b 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -25,7 +25,9 @@ AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) \ - $(UHD_CFLAGS) + $(UHD_CPPFLAGS) + +uhd_swig_swig_args = $(UHD_CPPFLAGS) if PYTHON # ---------------------------------------------------------------- @@ -55,9 +57,6 @@ uhd_swig_swiginclude_headers = include $(top_srcdir)/Makefile.swig -# FIXME better way to set this? -STD_SWIG_PYTHON_ARGS += $(UHD_CFLAGS) - # add some of the variables generated inside the Makefile.swig.gen BUILT_SOURCES = $(swig_built_sources) -- cgit From e92f2cb6166631f3248ff846376693306eb8f6f1 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 1 Dec 2010 14:39:38 -0800 Subject: WITH_INCLUDES _must_ be last --- gr-uhd/swig/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 33a690a7b..b201f676b 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -24,8 +24,8 @@ include $(top_srcdir)/Makefile.common AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ - $(WITH_INCLUDES) \ - $(UHD_CPPFLAGS) + $(UHD_CPPFLAGS) \ + $(WITH_INCLUDES) uhd_swig_swig_args = $(UHD_CPPFLAGS) -- cgit From 0b5f66113f43d2ba94a1ca741b5ce65e1f9f2c02 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:30:54 -0800 Subject: Rename libguile- to libguile-gnuradio- to match guile library naming convention. The stuff in gnuradio-core ends up with funky names, but that could be fixed by renaming gnuradio_core_filter.i -> core_filter.i etc. --- gr-uhd/swig/uhd_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 7344f7a72..c7664157b 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -122,7 +122,7 @@ static const size_t ALL_MBOARDS; #if SWIGGUILE %scheme %{ -(load-extension "libguile-uhd_swig" "scm_init_gnuradio_uhd_swig_module") +(load-extension "libguile-gnuradio-uhd_swig" "scm_init_gnuradio_uhd_swig_module") %} %goops %{ -- cgit From 6df0423fe1880f5c33daa333604552ea68ac9593 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:34:24 -0800 Subject: Regenerated Makefile.swig.gen's --- gr-uhd/swig/Makefile.swig.gen | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 782800c9b..b73ccd3c4 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -115,20 +115,20 @@ endif # end of if python if GUILE uhd_swig_scmlib_LTLIBRARIES = \ - libguile-uhd_swig.la -libguile_uhd_swig_la_SOURCES = \ + libguile-gnuradio-uhd_swig.la +libguile_gnuradio_uhd_swig_la_SOURCES = \ guile/uhd_swig.cc \ $(uhd_swig_la_swig_sources) nobase_uhd_swig_scm_DATA = \ gnuradio/uhd_swig.scm \ gnuradio/uhd_swig-primitive.scm -libguile_uhd_swig_la_LIBADD = \ +libguile_gnuradio_uhd_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(uhd_swig_la_swig_libadd) -libguile_uhd_swig_la_LDFLAGS = \ +libguile_gnuradio_uhd_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(uhd_swig_la_swig_ldflags) -libguile_uhd_swig_la_CXXFLAGS = \ +libguile_gnuradio_uhd_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ $(uhd_swig_la_swig_cxxflags) -- cgit From 08907ee94fb6c34531d57b988324c67c26c8b747 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 10 Dec 2010 16:15:40 -0800 Subject: Use load-extension-global instead of load-extension --- gr-uhd/swig/uhd_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 079f8120e..80a6a588a 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -105,7 +105,7 @@ static const size_t ALL_MBOARDS; #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-uhd_swig" "scm_init_gnuradio_uhd_swig_module") +(load-extension-global "libguile-gnuradio-uhd_swig" "scm_init_gnuradio_uhd_swig_module") %} %goops %{ -- cgit From 1047775464c1bb8a86e727487551e2b14abd476e Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 13 Dec 2010 12:21:35 -0500 Subject: gr_uhd: Quick fix for make distcheck failures if UHD is not installed. --- gr-uhd/swig/Makefile.swig.gen | 10 +++++++++- gr-uhd/swig/uhd_swig.i | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen index 3804461a4..f764332f2 100644 --- a/gr-uhd/swig/Makefile.swig.gen +++ b/gr-uhd/swig/Makefile.swig.gen @@ -200,7 +200,15 @@ $(DEPDIR)/uhd_swig-generate-stamp: ## Call SWIG to generate the various output files; special ## post-processing on 'mingw32' host OS for the dependency file. ## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ + +## If UHD was installed, defined GR_HAVE_UHD for swigging headers +if GR_DEFINE_HAVE_UHD + MY_SWIG_PYTHON_ARGS = $(STD_SWIG_PYTHON_ARGS) -DGR_HAVE_UHD +else + MY_SWIG_PYTHON_ARGS = $(STD_SWIG_PYTHON_ARGS) +endif + + if $(SWIG) $(MY_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \ -MD -MF $(DEPDIR)/uhd_swig.Std \ -module uhd_swig -o uhd_swig.cc $(WHAT); then \ if test $(host_os) = mingw32; then \ diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 695cf1cd2..4acf2dc83 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +// Defined during configure; avoids trying to locate +// header files if UHD was not installed. +#ifdef GR_HAVE_UHD + //////////////////////////////////////////////////////////////////////// // Language independent exception handler //////////////////////////////////////////////////////////////////////// @@ -104,3 +108,6 @@ GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; %} static const size_t ALL_MBOARDS; + +#endif + -- cgit From 440b0e3bdd81282a83805693c8eb822ee6815f72 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 26 Dec 2010 14:03:29 -0500 Subject: gr-uhd: Fixing makefile to define GR_HAVE_UHD for swig. This was lost in the makefile updates with the guile work. This is a better place/fix, anyway. --- gr-uhd/swig/Makefile.am | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index 3b7b3cc60..f227ac015 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -65,3 +65,9 @@ uhd_swig_swiginclude_headers = uhd_swig_swig_args = \ $(UHD_CFLAGS) \ -I$(top_srcdir)/gr-uhd/lib + +## If UHD was installed, defined GR_HAVE_UHD for swigging headers +if GR_DEFINE_HAVE_UHD + uhd_swig_swig_args += -DGR_HAVE_UHD +endif + -- cgit From b8f174ce7eae1cfe8deda0353da4557a238730c9 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 27 Dec 2010 22:37:30 -0800 Subject: Add minimal Python and Guile QA code to gr-uhd. --- gr-uhd/swig/.gitignore | 2 ++ gr-uhd/swig/Makefile.am | 15 +++++++++++++-- gr-uhd/swig/qa_uhd.py | 40 ++++++++++++++++++++++++++++++++++++++++ gr-uhd/swig/run_guile_tests.in | 14 ++++++++++++++ gr-uhd/swig/run_tests.in | 10 ++++++++++ gr-uhd/swig/uhd.test | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 116 insertions(+), 2 deletions(-) create mode 100755 gr-uhd/swig/qa_uhd.py create mode 100644 gr-uhd/swig/run_guile_tests.in create mode 100644 gr-uhd/swig/run_tests.in create mode 100644 gr-uhd/swig/uhd.test (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/.gitignore b/gr-uhd/swig/.gitignore index 8a421846d..8afaca254 100644 --- a/gr-uhd/swig/.gitignore +++ b/gr-uhd/swig/.gitignore @@ -4,3 +4,5 @@ /Makefile.in /guile /python +/run_guile_tests +/run_tests diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index f227ac015..e93571a66 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -22,7 +22,12 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig -EXTRA_DIST += $(nobase_guile_DATA) +TESTS = +EXTRA_DIST += run_tests.in run_guile_tests.in $(nobase_guile_DATA) +DISTCLEANFILES += run_tests run_guile_tests + +noinst_PYTHON = qa_uhd.py +noinst_GUILE = uhd.test AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ @@ -39,7 +44,6 @@ endif # ---------------------------------------------------------------- # The SWIG library -# TESTS = run_tests TOP_SWIG_IFILES = \ uhd_swig.i @@ -71,3 +75,10 @@ if GR_DEFINE_HAVE_UHD uhd_swig_swig_args += -DGR_HAVE_UHD endif +if PYTHON +TESTS += run_tests +endif + +if GUILE +TESTS += run_guile_tests +endif diff --git a/gr-uhd/swig/qa_uhd.py b/gr-uhd/swig/qa_uhd.py new file mode 100755 index 000000000..2973d04cd --- /dev/null +++ b/gr-uhd/swig/qa_uhd.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# +# Copyright 2005,2008,2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +import uhd_swig + +class test_uhd(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_000_nop (self): + """Just see if we can import the module... + They may not have a UHD device connected, etc. Don't try to run anything""" + pass + +if __name__ == '__main__': + gr_unittest.run(test_uhd, "test_uhd.xml") diff --git a/gr-uhd/swig/run_guile_tests.in b/gr-uhd/swig/run_guile_tests.in new file mode 100644 index 000000000..5d08b0dd5 --- /dev/null +++ b/gr-uhd/swig/run_guile_tests.in @@ -0,0 +1,14 @@ +#!/bin/sh + +. @top_builddir@/setup_guile_test_env + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +add_local_paths \ + @srcdir@ \ + @abs_builddir@ \ + @abs_builddir@ + +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ diff --git a/gr-uhd/swig/run_tests.in b/gr-uhd/swig/run_tests.in new file mode 100644 index 000000000..195e71316 --- /dev/null +++ b/gr-uhd/swig/run_tests.in @@ -0,0 +1,10 @@ +#!/bin/sh + +# 1st parameter is absolute path to component source directory +# 2nd parameter is absolute path to component build directory +# 3rd parameter is path to Python QA directory + +@top_builddir@/run_tests.sh \ + @abs_top_srcdir@/gr-uhd \ + @abs_top_builddir@/gr-uhd \ + @srcdir@ diff --git a/gr-uhd/swig/uhd.test b/gr-uhd/swig/uhd.test new file mode 100644 index 000000000..adc51c884 --- /dev/null +++ b/gr-uhd/swig/uhd.test @@ -0,0 +1,37 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Radio +;;; +;;; GNU Radio is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. +;;; +;;; GNU Radio is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + +(define-module (test-module) + #:use-module (oop goops) + #:use-module (gnuradio core) + #:use-module (gnuradio test-suite lib) + #:duplicates (merge-generics replace check)) + +;;; Just see if we can import the module... +;;; They may not have a UHD device attached, powered up etc. + +(use-modules (gnuradio uhd)) -- cgit From 5e00de56713729b7c366884d3a1e31ffa3423b13 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 5 Jan 2011 12:46:39 -0800 Subject: uhd: removed ranges template stuff, added some python polish in __init__.py --- gr-uhd/swig/__init__.py | 6 ++++++ gr-uhd/swig/uhd_swig.i | 11 ----------- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 0fdacb796..6d09f19f0 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -30,6 +30,12 @@ from uhd_swig import * # Add other content from pure-Python modules here ######################################################################## +#make the meta-range printable in python +meta_range_t.__str__ = lambda s: s.to_pp_string().strip() + +class freq_range_t(meta_range_t): pass #a typedef for the user +class gain_range_t(meta_range_t): pass #a typedef for the user + class tune_request_t(tune_request_t, float): """ Make the python tune request object inherit from float diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 76f44a491..cf4ecf920 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -73,17 +73,6 @@ namespace std { %include %include -//Re-create range typedefs here with %template as they are not imported. -//Replicate all the levels of templated inheritance so swig understands. - -%template(float_range_t) uhd::range_t; -%template(_float_range_vector_t) std::vector >; -%template(gain_range_t) uhd::meta_range_t; - -%template(double_range_t) uhd::range_t; -%template(_double_range_vector_t) std::vector >; -%template(freq_range_t) uhd::meta_range_t; - //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -- cgit From c63edcbe834c0929a7e0c7907f7c79ffc3fc5667 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 5 Jan 2011 16:19:19 -0800 Subject: uhd: swig + python tweaks to uhd types --- gr-uhd/swig/__init__.py | 9 ++++++++- gr-uhd/swig/uhd_swig.i | 12 ++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 6d09f19f0..a8082bc34 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -30,7 +30,8 @@ from uhd_swig import * # Add other content from pure-Python modules here ######################################################################## -#make the meta-range printable in python +#make the ranges printable in python +range_t.__str__ = lambda s: s.to_pp_string().strip() meta_range_t.__str__ = lambda s: s.to_pp_string().strip() class freq_range_t(meta_range_t): pass #a typedef for the user @@ -44,3 +45,9 @@ class tune_request_t(tune_request_t, float): """ def __new__(self, *args): return float.__new__(self) def __float__(self): return self.target_freq + +######################################################################## +# Create aliases for global attributes to avoid the "_t" +######################################################################## +for attr in globals().keys(): + if attr.endswith('_t'): globals()[attr[:-2]] = globals()[attr] diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index cf4ecf920..5628a1203 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -24,6 +24,8 @@ // header files if UHD was not installed. #ifdef GR_HAVE_UHD +#define GR_UHD_API + //////////////////////////////////////////////////////////////////////// // Language independent exception handler //////////////////////////////////////////////////////////////////////// @@ -47,10 +49,6 @@ //////////////////////////////////////////////////////////////////////// %include "gnuradio.i" -namespace std { - %template(StringVector) vector; -} - //////////////////////////////////////////////////////////////////////// // block headers //////////////////////////////////////////////////////////////////////// @@ -61,6 +59,12 @@ namespace std { #include %} +//////////////////////////////////////////////////////////////////////// +// templated types +//////////////////////////////////////////////////////////////////////// +%template(string_vector_t) std::vector; +%template(range_vector_t) std::vector; + //////////////////////////////////////////////////////////////////////// // used types //////////////////////////////////////////////////////////////////////// -- cgit From cf33e1e5f75c627907811e07e4c3c7a6b6175e8a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 5 Jan 2011 16:22:47 -0800 Subject: uhd: added export macros (not used now) and updated copyright dates --- gr-uhd/swig/__init__.py | 2 +- gr-uhd/swig/uhd_swig.i | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index a8082bc34..157733880 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 5628a1203..89f82e9f4 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * -- cgit From dfcc8cc28d8e5d0ca1de62b1622438be2439ebd1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 5 Jan 2011 19:08:26 -0800 Subject: uhd: use the actual device and io types, do hacks in the init.py, also use clock config convenience --- gr-uhd/swig/__init__.py | 41 ++++++++++++++++++++++++++++++++++++++--- gr-uhd/swig/uhd_swig.i | 21 ++++++++++++++++----- 2 files changed, 54 insertions(+), 8 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 157733880..0991f5b6b 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -27,13 +27,15 @@ from uhd_swig import * ######################################################################## -# Add other content from pure-Python modules here +# Make types with to_string functions printable ######################################################################## - -#make the ranges printable in python range_t.__str__ = lambda s: s.to_pp_string().strip() meta_range_t.__str__ = lambda s: s.to_pp_string().strip() +device_addr_t.__str__ = lambda s: s.to_pp_string().strip() +######################################################################## +# Add other content from pure-Python modules here +######################################################################## class freq_range_t(meta_range_t): pass #a typedef for the user class gain_range_t(meta_range_t): pass #a typedef for the user @@ -46,8 +48,41 @@ class tune_request_t(tune_request_t, float): def __new__(self, *args): return float.__new__(self) def __float__(self): return self.target_freq +class device_addr_t(device_addr_t, str): + """ + Make the python tune request object inherit from string + so that it can be passed in GRC as a string parameter. + The type checking in GRC will accept the device address. + Define the set/get item special methods for dict access. + """ + def __new__(self, *args): return str.__new__(self) + def __getitem__(self, key): return self.get(key) + def __setitem__(self, key, val): self.set(key, val) + ######################################################################## # Create aliases for global attributes to avoid the "_t" ######################################################################## for attr in globals().keys(): if attr.endswith('_t'): globals()[attr[:-2]] = globals()[attr] + +######################################################################## +# Cast constructor args (FIXME swig handle overloads?) +######################################################################## +for attr in ( + 'single_usrp_source', 'single_usrp_sink', + 'multi_usrp_source', 'multi_usrp_sink' +): + def constructor_factory(old_constructor): + def constructor_interceptor(*args, **kwargs): + args = list(args) + kwargs = dict(kwargs) + for index, key, cast in ( + (0, 'device_addr', device_addr), + (1, 'io_type', io_type), + ): + if len(args) > index: args[index] = cast(args[index]) + if kwargs.has_key(key): kwargs[key] = cast(kwargs[key]) + return old_constructor(*args, **kwargs) + return constructor_interceptor + import uhd_swig + globals()[attr] = constructor_factory(getattr(uhd_swig, attr)) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 89f82e9f4..e25dbce90 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -60,21 +60,32 @@ %} //////////////////////////////////////////////////////////////////////// -// templated types +// used types //////////////////////////////////////////////////////////////////////// %template(string_vector_t) std::vector; -%template(range_vector_t) std::vector; -//////////////////////////////////////////////////////////////////////// -// used types -//////////////////////////////////////////////////////////////////////// %include + %include + +%include +%template(string_string_dict_t) uhd::dict; //define after dict + +%include + +%include + +%template(range_vector_t) std::vector; //define before range %include + %include + %include + %include + %include + %include //////////////////////////////////////////////////////////////////////// -- cgit From 69ae2c9b1eca4c69d9007b146aa54fd1b75fcd28 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 5 Jan 2011 20:15:10 -0800 Subject: uhd: make the repr and str installation more generic --- gr-uhd/swig/__init__.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 0991f5b6b..18b5dfefc 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -26,13 +26,6 @@ ######################################################################## from uhd_swig import * -######################################################################## -# Make types with to_string functions printable -######################################################################## -range_t.__str__ = lambda s: s.to_pp_string().strip() -meta_range_t.__str__ = lambda s: s.to_pp_string().strip() -device_addr_t.__str__ = lambda s: s.to_pp_string().strip() - ######################################################################## # Add other content from pure-Python modules here ######################################################################## @@ -61,9 +54,13 @@ class device_addr_t(device_addr_t, str): ######################################################################## # Create aliases for global attributes to avoid the "_t" +# Install the __str__ and __repr__ handlers if applicable ######################################################################## for attr in globals().keys(): - if attr.endswith('_t'): globals()[attr[:-2]] = globals()[attr] + myobj = globals()[attr] + if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() + if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() + if attr.endswith('_t'): globals()[attr[:-2]] = myobj ######################################################################## # Cast constructor args (FIXME swig handle overloads?) -- cgit From 81d3460c5c6a950c8b734f192aa62cd1f8718d7c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 12 Jan 2011 15:20:13 -0800 Subject: uhd: swig up the device discovery --- gr-uhd/swig/__init__.py | 21 +++++++++++---------- gr-uhd/swig/uhd_swig.i | 5 +++++ 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 18b5dfefc..1a9f8358d 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -21,6 +21,17 @@ # The presence of this file turns this directory into a Python package +######################################################################## +# Create aliases for uhd swig attributes to avoid the "_t" +# Install the __str__ and __repr__ handlers if applicable +######################################################################## +import uhd_swig +for attr in dir(uhd_swig): + myobj = getattr(uhd_swig, attr) + if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() + if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() + if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) + ######################################################################## # Add SWIG generated code to this namespace ######################################################################## @@ -52,16 +63,6 @@ class device_addr_t(device_addr_t, str): def __getitem__(self, key): return self.get(key) def __setitem__(self, key, val): self.set(key, val) -######################################################################## -# Create aliases for global attributes to avoid the "_t" -# Install the __str__ and __repr__ handlers if applicable -######################################################################## -for attr in globals().keys(): - myobj = globals()[attr] - if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() - if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() - if attr.endswith('_t'): globals()[attr[:-2]] = myobj - ######################################################################## # Cast constructor args (FIXME swig handle overloads?) ######################################################################## diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index e25dbce90..3c317beb4 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -88,6 +88,11 @@ %include +%include + +%include +%template(device_addr_vector_t) std::vector; + //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -- cgit From 8afa393725c2bfda7c341b7202acfa40cc3245d2 Mon Sep 17 00:00:00 2001 From: Jason Abele Date: Fri, 21 Jan 2011 19:24:33 -0800 Subject: Added first pass at swigging dboard iface --- gr-uhd/swig/uhd_swig.i | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 3c317beb4..e90f850bd 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -93,6 +93,15 @@ %include %template(device_addr_vector_t) std::vector; +//////////////////////////////////////////////////////////////////////// +// swig dboard_iface for python access +//////////////////////////////////////////////////////////////////////// +%include stdint.i +%include +%include + +%template(dboard_iface_sptr) boost::shared_ptr; + //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -- cgit From 7787d1fc1aecc7b59e476c31865b4f32348cb729 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 10 Feb 2011 00:56:55 -0800 Subject: uhd: replaced multi/single usrp stuff with just one usrp wrapper --- gr-uhd/swig/Makefile.am | 6 ++---- gr-uhd/swig/__init__.py | 13 +++++++++---- gr-uhd/swig/uhd_swig.i | 20 ++++++-------------- 3 files changed, 17 insertions(+), 22 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index e93571a66..035fb2112 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -66,9 +66,7 @@ uhd_swig_python = \ # additional SWIG files to be installed uhd_swig_swiginclude_headers = -uhd_swig_swig_args = \ - $(UHD_CFLAGS) \ - -I$(top_srcdir)/gr-uhd/lib +uhd_swig_swig_args = $(UHD_CPPFLAGS) ## If UHD was installed, defined GR_HAVE_UHD for swigging headers if GR_DEFINE_HAVE_UHD diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 1a9f8358d..b464f903d 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -66,10 +66,7 @@ class device_addr_t(device_addr_t, str): ######################################################################## # Cast constructor args (FIXME swig handle overloads?) ######################################################################## -for attr in ( - 'single_usrp_source', 'single_usrp_sink', - 'multi_usrp_source', 'multi_usrp_sink' -): +for attr in ('usrp_source', 'usrp_sink'): def constructor_factory(old_constructor): def constructor_interceptor(*args, **kwargs): args = list(args) @@ -84,3 +81,11 @@ for attr in ( return constructor_interceptor import uhd_swig globals()[attr] = constructor_factory(getattr(uhd_swig, attr)) + +######################################################################## +# Aliases for deprecated constructors +######################################################################## +single_usrp_source = usrp_source +single_usrp_sink = usrp_sink +multi_usrp_source = usrp_source +multi_usrp_sink = usrp_sink diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index e90f850bd..a42344fab 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -53,10 +53,8 @@ // block headers //////////////////////////////////////////////////////////////////////// %{ -#include -#include -#include -#include +#include +#include %} //////////////////////////////////////////////////////////////////////// @@ -105,17 +103,11 @@ //////////////////////////////////////////////////////////////////////// // block magic //////////////////////////////////////////////////////////////////////// -GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_source) -%include +GR_SWIG_BLOCK_MAGIC(uhd,usrp_source) +%include -GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_sink) -%include - -GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source) -%include - -GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink) -%include +GR_SWIG_BLOCK_MAGIC(uhd,usrp_sink) +%include //////////////////////////////////////////////////////////////////////// // helpful constants -- cgit From cf4c96c754fee998b14df771d78f086b08ecbd80 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 15 Feb 2011 14:42:35 -0800 Subject: uhd: tweaks for swig/python init file --- gr-uhd/swig/__init__.py | 116 +++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 61 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index b464f903d..276f381d0 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -17,75 +17,69 @@ # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# - -# The presence of this file turns this directory into a Python package +# ######################################################################## -# Create aliases for uhd swig attributes to avoid the "_t" -# Install the __str__ and __repr__ handlers if applicable +# Prepare uhd swig module to make it more pythonic ######################################################################## -import uhd_swig -for attr in dir(uhd_swig): - myobj = getattr(uhd_swig, attr) - if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() - if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() - if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) +def _prepare_uhd_swig(): + import uhd_swig -######################################################################## -# Add SWIG generated code to this namespace -######################################################################## -from uhd_swig import * + #some useful typedefs for the user + setattr(uhd_swig, 'freq_range_t', uhd_swig.meta_range_t) + setattr(uhd_swig, 'gain_range_t', uhd_swig.meta_range_t) -######################################################################## -# Add other content from pure-Python modules here -######################################################################## -class freq_range_t(meta_range_t): pass #a typedef for the user -class gain_range_t(meta_range_t): pass #a typedef for the user + #Make the python tune request object inherit from float + #so that it can be passed in GRC as a frequency parameter. + #The type checking in GRC will accept the tune request. + class tune_request_t(uhd_swig.tune_request_t, float): + def __new__(self, *args): return float.__new__(self) + def __float__(self): return self.target_freq + setattr(uhd_swig, 'tune_request_t', tune_request_t) -class tune_request_t(tune_request_t, float): - """ - Make the python tune request object inherit from float - so that it can be passed in GRC as a frequency parameter. - The type checking in GRC will accept the tune request. - """ - def __new__(self, *args): return float.__new__(self) - def __float__(self): return self.target_freq + #Make the python tune request object inherit from string + #so that it can be passed in GRC as a string parameter. + #The type checking in GRC will accept the device address. + #Define the set/get item special methods for dict access. + class device_addr_t(uhd_swig.device_addr_t, str): + def __new__(self, *args): return str.__new__(self) + def __getitem__(self, key): return self.get(key) + def __setitem__(self, key, val): self.set(key, val) + setattr(uhd_swig, 'device_addr_t', device_addr_t) -class device_addr_t(device_addr_t, str): - """ - Make the python tune request object inherit from string - so that it can be passed in GRC as a string parameter. - The type checking in GRC will accept the device address. - Define the set/get item special methods for dict access. - """ - def __new__(self, *args): return str.__new__(self) - def __getitem__(self, key): return self.get(key) - def __setitem__(self, key, val): self.set(key, val) + #handle general things on all uhd_swig attributes + #Install the __str__ and __repr__ handlers if applicable + #Create aliases for uhd swig attributes to avoid the "_t" + for attr in dir(uhd_swig): + myobj = getattr(uhd_swig, attr) + if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() + if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() + if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) -######################################################################## -# Cast constructor args (FIXME swig handle overloads?) -######################################################################## -for attr in ('usrp_source', 'usrp_sink'): - def constructor_factory(old_constructor): - def constructor_interceptor(*args, **kwargs): - args = list(args) - kwargs = dict(kwargs) - for index, key, cast in ( - (0, 'device_addr', device_addr), - (1, 'io_type', io_type), - ): - if len(args) > index: args[index] = cast(args[index]) - if kwargs.has_key(key): kwargs[key] = cast(kwargs[key]) - return old_constructor(*args, **kwargs) - return constructor_interceptor - import uhd_swig - globals()[attr] = constructor_factory(getattr(uhd_swig, attr)) + #Cast constructor args (FIXME swig handle overloads?) + for attr in ('usrp_source', 'usrp_sink'): + def constructor_factory(old_constructor): + def constructor_interceptor(*args, **kwargs): + args = list(args) + kwargs = dict(kwargs) + for index, key, cast in ( + (0, 'device_addr', device_addr), + (1, 'io_type', io_type), + ): + if len(args) > index: args[index] = cast(args[index]) + if kwargs.has_key(key): kwargs[key] = cast(kwargs[key]) + return old_constructor(*args, **kwargs) + return constructor_interceptor + setattr(uhd_swig, attr, constructor_factory(getattr(uhd_swig, attr))) + + #Aliases for deprecated constructors + setattr(uhd_swig, 'single_usrp_source', uhd_swig.usrp_source) + setattr(uhd_swig, 'single_usrp_sink', uhd_swig.usrp_sink) + setattr(uhd_swig, 'multi_usrp_source', uhd_swig.usrp_source) + setattr(uhd_swig, 'multi_usrp_sink', uhd_swig.usrp_sink) ######################################################################## -# Aliases for deprecated constructors +# Initialize this module with the contents of uhd swig ######################################################################## -single_usrp_source = usrp_source -single_usrp_sink = usrp_sink -multi_usrp_source = usrp_source -multi_usrp_sink = usrp_sink +_prepare_uhd_swig() +from uhd_swig import * -- cgit From 5bb8acf24e4913d2a969db70476af65c498b032f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 25 Feb 2011 15:34:04 -0800 Subject: uhd: added sensors api to gr-uhd blocks and swig support --- gr-uhd/swig/__init__.py | 7 +++++-- gr-uhd/swig/uhd_swig.i | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 276f381d0..7ed689ec0 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -52,8 +52,11 @@ def _prepare_uhd_swig(): #Create aliases for uhd swig attributes to avoid the "_t" for attr in dir(uhd_swig): myobj = getattr(uhd_swig, attr) - if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() - if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() + if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda o: o.to_string().strip() + if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda o: o.to_pp_string().strip() + if hasattr(myobj, 'to_bool'): myobj.__nonzero__ = lambda o: o.to_bool() + if hasattr(myobj, 'to_int'): myobj.__int__ = lambda o: o.to_int() + if hasattr(myobj, 'to_real'): myobj.__float__ = lambda o: o.to_real() if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) #Cast constructor args (FIXME swig handle overloads?) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index a42344fab..b814471b2 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -91,6 +91,8 @@ %include %template(device_addr_vector_t) std::vector; +%include + //////////////////////////////////////////////////////////////////////// // swig dboard_iface for python access //////////////////////////////////////////////////////////////////////// -- cgit From b812a91c0beb33ff755f4426f36a2a3e2c9b295c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 12 Mar 2011 17:46:00 -0800 Subject: uhd: use %ignore to hide warnings and fix errors --- gr-uhd/swig/uhd_swig.i | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-uhd/swig') diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index b814471b2..3ffcc7aea 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -66,6 +66,7 @@ %include +%ignore uhd::dict::operator[]; //ignore warnings about %extend %include %template(string_string_dict_t) uhd::dict; //define after dict @@ -88,6 +89,7 @@ %include +%ignore uhd::device::register_device; //causes compile to choke in MSVC %include %template(device_addr_vector_t) std::vector; -- cgit