From 559f82a0d10f604b0b27cfb8663d93b1625dbd8b Mon Sep 17 00:00:00 2001 From: eb Date: Fri, 4 Aug 2006 01:54:23 +0000 Subject: Cleaned up top-level README, and fixed or deleted lower level ones as appropriate. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3133 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 README.hacking (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking new file mode 100644 index 000000000..7e211e0b3 --- /dev/null +++ b/README.hacking @@ -0,0 +1,178 @@ +# -*- Outline -*- +# +# Copyright 2004 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + + +Random notes on coding conventions, some explanations about why things +aren't done differently, etc, etc, + + +* C++ and Python + +GNU Radio is now a hybrid system. Some parts of the system are built +in C++ and some of it in Python. In general, prefer Python to C++. +Signal processing primitives are still built in C++ for performance. + +It is no longer possible to build user applications entirely in C++. +Essential parts of the runtime system have been moved into Python. + + +* C++ namespaces + +In the cleanup process, I considered putting everything in the +gnuradio namespace and dropping the Gr|gr prefix. In fact, I think +it's probably the right idea, but when I tested it out, I ran into +problems with SWIG's handling of namespaces. Bottom line, SWIG +(1.3.21) got confused and generated bad code when I started playing +around with namespaces in a not particularly convoluted way. I saw +problems using the boost::shared_ptr template in combination with +classes defined in the gnuradio namespace. It wasn't pretty... + + +* Naming conventions + +Death to CamelCaseNames! We've returned to a kinder, gentler era. +We're now using the "STL style" naming convention with a couple of +modifications since we're not using namespaces. + +With the exception of macros and other constant values, all +identifiers shall be lower case with words_separated_like_this. + +Macros and constant values (e.g., enumerated values, +static const int FOO = 23) shall be in UPPER_CASE. + + +** Global names + +All globally visible names (types, functions, variables, consts, etc) +shall begin with a "package prefix", followed by an '_'. The bulk of +the code in GNU Radio logically belongs to the "gr" package, hence +names look like gr_open_file (...). + +Large coherent bodies of code may use other package prefixes, but +let's try to keep them to a well thought out list. See the list +below. + +*** Package prefixes + +These are the current package prefixes: + + gr_ Almost everything + + gri_ Implementation primitives. Sometimes we + have both a gr_ and a gri_. In that case, + gr_ would be derived from gr_block and gri_ + would be the low level guts of the function. + + atsc_ Code related to the Advanced Television + Standards Committee HDTV implementation + + usrp_ Universal Software Radio Peripheral + + qa_ Quality Assurance. Test code. + + +** Class data members (instance variables) + +All class data members shall begin with d_. + +The big win is when you're staring at a block of code it's obvious +which of the things being assigned to persist outside of the block. +This also keeps you from having to be creative with parameter names +for methods and constructors. You just use the same name as the +instance variable, without the d_. + +class gr_wonderfulness { + std::string d_name; + double d_wonderfulness_factor; + +public: + gr_wonderfulness (std::string name, double wonderfulness_factor) + : d_name (name), d_wonderfulness_factor (wonderfulness_factor) + { + ... + } + ... +}; + + +** Class static data members (class variables) + +All class static data members shall begin with s_. + + +** File names + +Each significant class shall be contained in it's own file. The +declaration of class gr_foo shall be in gr_foo.h, the definition in +gr_foo.cc. + + + +* Storage management + +Strongly consider using the boost smart pointer templates, scoped_ptr +and shared_ptr. scoped_ptr should be used for locals that contain +pointers to objects that we need to delete when we exit the current +scope. shared_ptr implements transparent reference counting and is a +major win. You never have to worry about calling delete. The right +thing happens. + +See http://www.boost.org/libs/smart_ptr/smart_ptr.htm + + +* Unit tests + +Build unit tests for everything non-trivial and run them after every +change. Check out Extreme Programming: +http://c2.com/cgi/wiki?ExtremeProgrammingRoadmap + +Unit tests should also be written for all examples. This should kill +off the bit rot we've been plagued with. + +** C++ unit tests + +For C++ we're using the cppunit framework. cppunit has its bad +smells, but it's mostly workable. http://cppunit.sf.net + +Currently each directory contains files qa_.{h,cc} +that bring together all the qa_ test suites in the directory. +We ought to be able to automate this without too much trouble. + +The directory gnuradio-core/src/tests contains programs that run +the tests. test_all runs all of the registered C++ unit tests. + +As far as I can tell, the cppunit TestFactoryRegistry maybe able to be +tricked into doing what we want. As is, I don't think it's enough by +itself, since there's nothing dragging the qa* files out of the +library and into the program. I haven't tested out this idea. + +** Python unit tests + +We use the standard unittest package for unit testing of Python code. + + +* Misc tips + +ccache, a compiler cache, can really speed up your builds. +See http://ccache.samba.org/ + +Be sure to create links for gcc and g++ -- cgit From 86f5c92427b3f4bb30536d76cf63c3fca388fb2f Mon Sep 17 00:00:00 2001 From: eb Date: Wed, 13 Sep 2006 21:30:04 +0000 Subject: Updated FSF address in all files. Fixes ticket:51 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3534 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index 7e211e0b3..46ba09402 100644 --- a/README.hacking +++ b/README.hacking @@ -16,8 +16,8 @@ # # 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. # -- cgit From 5a2864573c870ad6f3ff3dc818b3603ff9340618 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sat, 4 Nov 2006 21:04:37 +0000 Subject: Added note about line ending styles. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3930 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index 46ba09402..1a604395b 100644 --- a/README.hacking +++ b/README.hacking @@ -170,6 +170,31 @@ library and into the program. I haven't tested out this idea. We use the standard unittest package for unit testing of Python code. +* Subversion line ending styles + +All text files in the tree should have the subversion property +'svn:eol-style' set to 'native', with the following exceptions: + +config/*.m4 +configure.ac +gr-howto-write-a-block/config/*.m4 +gr-howto-write-a-block/configure.ac + +The easiest way to ensure this is to add or edit the following lines in +your svn client configuration file (~/.subversion/config): + +enable-auto-props=yes + +[auto-props] +*.c = svn:eol-style=native +*.cc = svn:eol-style=native +*.i = svn:eol-style=native +*.h = svn:eol-style=native +*.am = svn:eol-style=native +*.py = svn:eol-style=native +*.ac = svn:eol-style=LF +*.m4 = svn:eol-style=LF + * Misc tips ccache, a compiler cache, can really speed up your builds. -- cgit From 937b719d2e57d0497293d603da10cac2532346f6 Mon Sep 17 00:00:00 2001 From: eb Date: Sat, 21 Jul 2007 03:44:38 +0000 Subject: Updated license from GPL version 2 or later to GPL version 3 or later. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6044 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index 1a604395b..774a9f699 100644 --- a/README.hacking +++ b/README.hacking @@ -6,7 +6,7 @@ # # 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 2, or (at your option) +# 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, -- cgit From d00c31fe6b935cf1210e714018d490aa4571133b Mon Sep 17 00:00:00 2001 From: eb Date: Fri, 5 Oct 2007 00:20:23 +0000 Subject: documented standard command line options and conventions git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6590 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index 774a9f699..21274f177 100644 --- a/README.hacking +++ b/README.hacking @@ -1,6 +1,6 @@ # -*- Outline -*- # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -201,3 +201,141 @@ ccache, a compiler cache, can really speed up your builds. See http://ccache.samba.org/ Be sure to create links for gcc and g++ + + +* Standard command line options + +When writing programs that are executable from the command line, +please follow these guidelines for command line argument names (short +and long) and types of the arguments. We list them below using the +Python optparse syntax. In general, the default value should be coded +into the help string using the "... [default=%default]" syntax. + +** Mandatory options by gr_block + +*** USRP source + +Any program using a USRP source (usrp.source_*) shall include: + + add_option("", "--which-usrp", type="intx", default=0, + help="select which USRP to use [default=%default]") + + add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0), + help="select USRP Rx side A or B [default=A]") + +You are free to change the default if it makes sense in your application. + + +*** USRP sink + +Any program using a USRP sink (usrp.sink_*) shall include: + + add_option("", "--which-usrp", type="intx", default=0, + help="select which USRP to use [default=%default]") + + add_option("-T", "--tx-subdev-spec", type="subdev", default=(0, 0), + help="select USRP Tx side A or B [default=A]") + +You are free to change the default if it makes sense in your application. + + +*** Audio source + +Any program using an audio source shall include: + + add_option("-I", "--audio-input", type="string", default="", + help="pcm input device name. E.g., hw:0,0 or /dev/dsp") + +The default must be "". This allows an audio module-dependent default +to be specified in the user preferences file. + + +*** Audio sink + + add_option("-O", "--audio-output", type="string", default="", + help="pcm output device name. E.g., hw:0,0 or /dev/dsp") + +The default must be "". This allows an audio module-dependent default +to be specified in the user preferences file. + + +** Standard options names by parameter + +Whenever you want an integer, use the "intx" type. This allows the +user to input decimal, hex or octal numbers. E.g., 10, 012, 0xa. + +Whenever you want a float, use the "eng_float" type. This allows the +user to input numbers with SI suffixes. E.g, 10000, 10k, 10M, 10m, 92.1M + +If your program allows the user to specify values for any of the +following parameters, please use these options to specify them: + + +To specify a frequency (typically an RF center frequency) use: + + add_option("-f", "--freq", type="eng_float", default=, + help="set frequency to FREQ [default=%default]") + + +To specify a decimation factor use: + + add_option("-d", "--decim", type="intx", default=, + help="set decimation rate to DECIM [default=%default]") + + +To specify an interpolation factor use: + + add_option("-i", "--interp", type="intx", default=, + help="set interpolation rate to INTERP [default=%default]") + + +To specify a gain setting use: + + add_option("-g", "--gain", type="eng_float", default=, + help="set gain in dB [default=%default]") + + +If your application specifies both a tx and an rx gain, use: + + add_option("", "--rx-gain", type="eng_float", default=, + help="set receive gain in dB [default=%default]") + + add_option("", "--tx-gain", type="eng_float", default=, + help="set transmit gain in dB [default=%default]") + + +To specify the number of channels of something use: + + add_option("-n", "--nchannels", type="intx", default=1, + help="specify number of channels [default=%default]") + + +To specify an output filename use: + + add_option("-o", "--output-filename", type="string", default=, + help="specify output-filename [default=%default]") + + +To specify a rate use: + + add_option("-r", "--bit-rate", type="eng_float", default=, + help="specify bit-rate [default=%default]") + or + + add_option("-r", "--sample-rate", type="eng_float", default=, + help="specify sample-rate [default=%default]") + + +If your application has a verbose option, use: + + add_option('-v', '--verbose', action="store_true", default=False, + help="verbose output") + + +If your application allows the user to specify the "fast USB" options, use: + + add_option("", "--fusb-block-size", type="intx", default=0, + help="specify fast usb block size [default=%default]") + + add_option("", "--fusb-nblocks", type="intx", default=0, + help="specify number of fast usb blocks [default=%default]") -- cgit From eb5c6240718e57d6dc81be48cd29f7f3241625d3 Mon Sep 17 00:00:00 2001 From: eb Date: Fri, 29 Aug 2008 00:25:01 +0000 Subject: added note about boost and DISTCHECK_CONFIGURE_FLAGS git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9441 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index 21274f177..204d07f7c 100644 --- a/README.hacking +++ b/README.hacking @@ -1,6 +1,6 @@ # -*- Outline -*- # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2008 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,11 +20,21 @@ # Boston, MA 02110-1301, USA. # - Random notes on coding conventions, some explanations about why things aren't done differently, etc, etc, +* Boost 1.35 + +Until boost 1.35 or later is common in distributions, you'll need to +build boost from source yourself. See README.building-boost. + +Also, when running make distcheck you'll need to provide the +DISTCHECK_CONFIGURE_FLAGS. E.g., + + $ make distcheck DISTCHECK_CONFIGURE_FLAGS=--with-boost=/opt/boost_1_36_0 + + * C++ and Python GNU Radio is now a hybrid system. Some parts of the system are built -- cgit From 78c121b8af6995a59335fee39ee7f00600a14658 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sat, 23 May 2009 22:26:03 +0000 Subject: Doc cleanup git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11106 221aa14e-8319-0410-a670-987f0aec2ac5 --- README.hacking | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index 204d07f7c..ff01a0a53 100644 --- a/README.hacking +++ b/README.hacking @@ -1,6 +1,6 @@ # -*- Outline -*- # -# Copyright 2004,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2007,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -41,9 +41,6 @@ GNU Radio is now a hybrid system. Some parts of the system are built in C++ and some of it in Python. In general, prefer Python to C++. Signal processing primitives are still built in C++ for performance. -It is no longer possible to build user applications entirely in C++. -Essential parts of the runtime system have been moved into Python. - * C++ namespaces -- cgit From e30b824e9165bff69f09121631c3d5a706cbbd39 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 19 Oct 2011 15:10:58 -0700 Subject: Removing usrp, usrp2, gr-usrp, gr-usrp2. Everything is moving to using UHD. Also removes related M4 and dependency requirements for USRP-related libs. --- README.hacking | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index ff01a0a53..de6358abf 100644 --- a/README.hacking +++ b/README.hacking @@ -92,8 +92,6 @@ These are the current package prefixes: atsc_ Code related to the Advanced Television Standards Committee HDTV implementation - usrp_ Universal Software Radio Peripheral - qa_ Quality Assurance. Test code. @@ -220,32 +218,6 @@ into the help string using the "... [default=%default]" syntax. ** Mandatory options by gr_block -*** USRP source - -Any program using a USRP source (usrp.source_*) shall include: - - add_option("", "--which-usrp", type="intx", default=0, - help="select which USRP to use [default=%default]") - - add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0), - help="select USRP Rx side A or B [default=A]") - -You are free to change the default if it makes sense in your application. - - -*** USRP sink - -Any program using a USRP sink (usrp.sink_*) shall include: - - add_option("", "--which-usrp", type="intx", default=0, - help="select which USRP to use [default=%default]") - - add_option("-T", "--tx-subdev-spec", type="subdev", default=(0, 0), - help="select USRP Tx side A or B [default=A]") - -You are free to change the default if it makes sense in your application. - - *** Audio source Any program using an audio source shall include: -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- README.hacking | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'README.hacking') diff --git a/README.hacking b/README.hacking index de6358abf..58b269887 100644 --- a/README.hacking +++ b/README.hacking @@ -1,24 +1,24 @@ # -*- Outline -*- # # Copyright 2004,2007,2008,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. -# +# Random notes on coding conventions, some explanations about why things aren't done differently, etc, etc, @@ -103,7 +103,7 @@ The big win is when you're staring at a block of code it's obvious which of the things being assigned to persist outside of the block. This also keeps you from having to be creative with parameter names for methods and constructors. You just use the same name as the -instance variable, without the d_. +instance variable, without the d_. class gr_wonderfulness { std::string d_name; @@ -147,7 +147,7 @@ See http://www.boost.org/libs/smart_ptr/smart_ptr.htm * Unit tests Build unit tests for everything non-trivial and run them after every -change. Check out Extreme Programming: +change. Check out Extreme Programming: http://c2.com/cgi/wiki?ExtremeProgrammingRoadmap Unit tests should also be written for all examples. This should kill @@ -177,7 +177,7 @@ We use the standard unittest package for unit testing of Python code. * Subversion line ending styles -All text files in the tree should have the subversion property +All text files in the tree should have the subversion property 'svn:eol-style' set to 'native', with the following exceptions: config/*.m4 @@ -192,7 +192,7 @@ enable-auto-props=yes [auto-props] *.c = svn:eol-style=native -*.cc = svn:eol-style=native +*.cc = svn:eol-style=native *.i = svn:eol-style=native *.h = svn:eol-style=native *.am = svn:eol-style=native @@ -303,7 +303,7 @@ To specify a rate use: add_option("-r", "--sample-rate", type="eng_float", default=, help="specify sample-rate [default=%default]") - + If your application has a verbose option, use: @@ -311,7 +311,7 @@ If your application has a verbose option, use: help="verbose output") -If your application allows the user to specify the "fast USB" options, use: +If your application allows the user to specify the "fast USB" options, use: add_option("", "--fusb-block-size", type="intx", default=0, help="specify fast usb block size [default=%default]") -- cgit