diff options
Diffstat (limited to 'gnuradio-core/src')
39 files changed, 321 insertions, 429 deletions
diff --git a/gnuradio-core/src/lib/Makefile.am b/gnuradio-core/src/lib/Makefile.am index 1281b4aa6..4db2ff167 100644 --- a/gnuradio-core/src/lib/Makefile.am +++ b/gnuradio-core/src/lib/Makefile.am @@ -66,4 +66,7 @@ libgnuradio_core_qa_la_LIBADD = \ bin_PROGRAMS = gnuradio-config-info gnuradio_config_info_SOURCES = gnuradio-config-info.cc -gnuradio_config_info_LDADD = libgnuradio-core.la $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) +gnuradio_config_info_LDADD = libgnuradio-core.la \ + $(BOOST_LDFLAGS) \ + $(BOOST_PROGRAM_OPTIONS_LIB) \ + $(BOOST_FILESYSTEM_LIB) diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index ebc7ad203..dee13e239 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -120,8 +120,7 @@ x86_SUBCODE = \ ccomplex_dotprod_sse.S \ fcomplex_dotprod_3dnow.S \ fcomplex_dotprod_sse.S \ - short_dotprod_mmx.S \ - cpuid_x86.S + short_dotprod_mmx.S x86_64_SUBCODE = \ float_dotprod_sse64.S \ @@ -134,8 +133,7 @@ x86_64_SUBCODE = \ ccomplex_dotprod_sse64.S \ fcomplex_dotprod_3dnow64.S \ fcomplex_dotprod_sse64.S \ - short_dotprod_mmx64.S \ - cpuid_x86_64.S + short_dotprod_mmx64.S x86_qa_CODE = \ qa_dotprod_x86.cc \ @@ -312,6 +310,7 @@ grinclude_HEADERS = \ noinst_HEADERS = \ assembly.h \ + gcc_x86_cpuid.h \ dotprod_fff_altivec.h \ dotprod_fff_armv7_a.h \ dotprod_ccf_armv7_a.h \ diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc index 5fc04271a..0dc0c38b7 100644 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc +++ b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc @@ -24,7 +24,6 @@ #include <config.h> #endif #include <gr_complex.h> -#include "gr_fir_ccc_simd.h" #include "ccomplex_dotprod_generic.h" #include <iostream> diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc index 89eb6db87..8cbc4aa70 100644 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc +++ b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc @@ -24,7 +24,6 @@ #include <config.h> #endif #include <gr_complex.h> -#include "gr_fir_scc_simd.h" #include "complex_dotprod_generic.h" diff --git a/gnuradio-core/src/lib/filter/cpuid_x86.S b/gnuradio-core/src/lib/filter/cpuid_x86.S deleted file mode 100644 index 4e1a9404f..000000000 --- a/gnuradio-core/src/lib/filter/cpuid_x86.S +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# -# execute CPUID instruction, return EAX, EBX, ECX and EDX values in result -# -# void cpuid_x86 (unsigned int op, unsigned int result[4]); -# - -#include "assembly.h" - -.file "cpuid_x86.S" - .version "01.01" -.text -.globl GLOB_SYMB(cpuid_x86) - DEF_FUNC_HEAD(cpuid_x86) -GLOB_SYMB(cpuid_x86): - pushl %ebp - movl %esp, %ebp - pushl %ebx # must save in PIC mode, holds GOT pointer - pushl %esi - - movl 8(%ebp), %eax # op - movl 12(%ebp), %esi # result - cpuid - movl %eax, 0(%esi) - movl %ebx, 4(%esi) - movl %ecx, 8(%esi) - movl %edx, 12(%esi) - - popl %esi - popl %ebx - popl %ebp - ret - -FUNC_TAIL(cpuid_x86) - .ident "Hand coded cpuid assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/cpuid_x86_64.S b/gnuradio-core/src/lib/filter/cpuid_x86_64.S deleted file mode 100644 index 32b1847cd..000000000 --- a/gnuradio-core/src/lib/filter/cpuid_x86_64.S +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright 2003,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# -# execute CPUID instruction, return EAX, EBX, ECX and EDX values in result -# -# void cpuid_x86 (unsigned int op, unsigned int result[4]); -# - -#include "assembly.h" - -.file "cpuid_x86_64.S" - .version "01.01" -.text -.globl GLOB_SYMB(cpuid_x86) - DEF_FUNC_HEAD(cpuid_x86) -GLOB_SYMB(cpuid_x86): - mov %rbx, %r11 # must save in PIC mode, holds GOT pointer - - mov %rdi, %rax # op - cpuid - movl %eax, 0(%rsi) # result - movl %ebx, 4(%rsi) - movl %ecx, 8(%rsi) - movl %edx, 12(%rsi) - - mov %r11, %rbx - retq - -FUNC_TAIL(cpuid_x86) - .ident "Hand coded cpuid64 assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h new file mode 100644 index 000000000..2d0916fb3 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 3, or (at your option) any + * later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Under Section 7 of GPL version 3, you are granted additional + * permissions described in the GCC Runtime Library Exception, version + * 3.1, as published by the Free Software Foundation. + * + * You should have received a copy of the GNU General Public License and + * a copy of the GCC Runtime Library Exception along with this program; + * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* %ecx */ +#define bit_SSE3 (1 << 0) +#define bit_PCLMUL (1 << 1) +#define bit_SSSE3 (1 << 9) +#define bit_FMA (1 << 12) +#define bit_CMPXCHG16B (1 << 13) +#define bit_SSE4_1 (1 << 19) +#define bit_SSE4_2 (1 << 20) +#define bit_MOVBE (1 << 22) +#define bit_POPCNT (1 << 23) +#define bit_AES (1 << 25) +#define bit_XSAVE (1 << 26) +#define bit_OSXSAVE (1 << 27) +#define bit_AVX (1 << 28) + +/* %edx */ +#define bit_CMPXCHG8B (1 << 8) +#define bit_CMOV (1 << 15) +#define bit_MMX (1 << 23) +#define bit_FXSAVE (1 << 24) +#define bit_SSE (1 << 25) +#define bit_SSE2 (1 << 26) + +/* Extended Features */ +/* %ecx */ +#define bit_LAHF_LM (1 << 0) +#define bit_SSE4a (1 << 6) +#define bit_SSE5 (1 << 11) + +/* %edx */ +#define bit_LM (1 << 29) +#define bit_3DNOWP (1 << 30) +#define bit_3DNOW (1 << 31) + + +#if defined(__i386__) && defined(__PIC__) +/* %ebx may be the PIC register. */ +#if __GNUC__ >= 3 +#define __cpuid(level, a, b, c, d) \ + __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchg{l}\t{%%}ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchg{l}\t{%%}ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#else +/* Host GCCs older than 3.0 weren't supporting Intel asm syntax + nor alternatives in i386 code. */ +#define __cpuid(level, a, b, c, d) \ + __asm__ ("xchgl\t%%ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchgl\t%%ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("xchgl\t%%ebx, %1\n\t" \ + "cpuid\n\t" \ + "xchgl\t%%ebx, %1\n\t" \ + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#endif +#else +#define __cpuid(level, a, b, c, d) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level)) + +#define __cpuid_count(level, count, a, b, c, d) \ + __asm__ ("cpuid\n\t" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ + : "0" (level), "2" (count)) +#endif + +/* Return highest supported input value for cpuid instruction. ext can + be either 0x0 or 0x8000000 to return highest supported value for + basic or extended cpuid information. Function returns 0 if cpuid + is not supported or whatever cpuid returns in eax register. If sig + pointer is non-null, then first four bytes of the signature + (as found in ebx register) are returned in location pointed by sig. */ + +static __inline unsigned int +__get_cpuid_max (unsigned int __ext, unsigned int *__sig) +{ + unsigned int __eax, __ebx, __ecx, __edx; + +#ifndef __x86_64__ +#if __GNUC__ >= 3 + /* See if we can use cpuid. On AMD64 we always can. */ + __asm__ ("pushf{l|d}\n\t" + "pushf{l|d}\n\t" + "pop{l}\t%0\n\t" + "mov{l}\t{%0, %1|%1, %0}\n\t" + "xor{l}\t{%2, %0|%0, %2}\n\t" + "push{l}\t%0\n\t" + "popf{l|d}\n\t" + "pushf{l|d}\n\t" + "pop{l}\t%0\n\t" + "popf{l|d}\n\t" + : "=&r" (__eax), "=&r" (__ebx) + : "i" (0x00200000)); +#else +/* Host GCCs older than 3.0 weren't supporting Intel asm syntax + nor alternatives in i386 code. */ + __asm__ ("pushfl\n\t" + "pushfl\n\t" + "popl\t%0\n\t" + "movl\t%0, %1\n\t" + "xorl\t%2, %0\n\t" + "pushl\t%0\n\t" + "popfl\n\t" + "pushfl\n\t" + "popl\t%0\n\t" + "popfl\n\t" + : "=&r" (__eax), "=&r" (__ebx) + : "i" (0x00200000)); +#endif + + if (!((__eax ^ __ebx) & 0x00200000)) + return 0; +#endif + + /* Host supports cpuid. Return highest supported cpuid input value. */ + __cpuid (__ext, __eax, __ebx, __ecx, __edx); + + if (__sig) + *__sig = __ebx; + + return __eax; +} + +/* Return cpuid data for requested cpuid level, as found in returned + eax, ebx, ecx and edx registers. The function checks if cpuid is + supported and returns 1 for valid cpuid information or 0 for + unsupported cpuid level. All pointers are required to be non-null. */ + +static __inline int +__get_cpuid (unsigned int __level, + unsigned int *__eax, unsigned int *__ebx, + unsigned int *__ecx, unsigned int *__edx) +{ + unsigned int __ext = __level & 0x80000000; + + if (__get_cpuid_max (__ext, 0) < __level) + return 0; + + __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx); + return 1; +} diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc index ac8a2eeb7..da970e133 100644 --- a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc +++ b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc @@ -21,13 +21,12 @@ */ #include <gr_cpu.h> +#include "gcc_x86_cpuid.h" /* * execute CPUID instruction, return EAX, EBX, ECX and EDX values in result */ -extern "C" { -void cpuid_x86 (unsigned int op, unsigned int result[4]); -}; +#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3) /* * CPUID functions returning a single datum @@ -35,28 +34,28 @@ void cpuid_x86 (unsigned int op, unsigned int result[4]); static inline unsigned int cpuid_eax(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[0]; } static inline unsigned int cpuid_ebx(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[1]; } static inline unsigned int cpuid_ecx(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[2]; } static inline unsigned int cpuid_edx(unsigned int op) { - unsigned int regs[4]; + unsigned int regs[4] = {0,0,0,0}; cpuid_x86 (op, regs); return regs[3]; } diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc index 1bf4a6f4b..891905dd0 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc @@ -99,7 +99,7 @@ gri_fft_filter_ccc_generic::compute_sizes(int ntaps) { int old_fftsize = d_fftsize; d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); + d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); d_nsamples = d_fftsize - d_ntaps + 1; if (0) diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc index 74058fa93..b3fbe1d1a 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc @@ -86,7 +86,7 @@ gri_fft_filter_fff_generic::compute_sizes(int ntaps) { int old_fftsize = d_fftsize; d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); + d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); d_nsamples = d_fftsize - d_ntaps + 1; if (0) diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 08610c58a..3ceea7a6d 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -100,7 +100,6 @@ libgeneral_la_SOURCES = \ gr_lms_dfe_cc.cc \ gr_lms_dfe_ff.cc \ gr_map_bb.cc \ - gr_math.cc \ gr_misc.cc \ gr_mpsk_receiver_cc.cc \ gr_nlog10_ff.cc \ diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc index d5425bfc8..c5e1320a3 100644 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc +++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc @@ -39,7 +39,7 @@ gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb() { float RATE = 0.5; float ebn0 = 12.0; - float esn0 = RATE*pow(10.0, ebn0/10); + float esn0 = RATE*pow(10.0, ebn0/10.0); gen_met(d_mettab, 100, esn0, 0.0, 256); viterbi_chunks_init(d_state0); diff --git a/gnuradio-core/src/lib/general/gr_firdes.cc b/gnuradio-core/src/lib/general/gr_firdes.cc index 8efeb3438..5d192d67e 100644 --- a/gnuradio-core/src/lib/general/gr_firdes.cc +++ b/gnuradio-core/src/lib/general/gr_firdes.cc @@ -574,7 +574,7 @@ gr_firdes::gaussian (double gain, vector<float> taps(ntaps); double scale = 0; double dt = 1.0/spb; - double s = 1.0/(sqrt(log(2)) / (2*M_PI*bt)); + double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt)); double t0 = -0.5 * ntaps; double ts; for(int i=0;i<ntaps;i++) diff --git a/gnuradio-core/src/lib/general/gr_fxpt.cc b/gnuradio-core/src/lib/general/gr_fxpt.cc index e752364a5..fae02c71e 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.cc +++ b/gnuradio-core/src/lib/general/gr_fxpt.cc @@ -30,9 +30,8 @@ const float gr_fxpt::s_sine_table[1 << NBITS][2] = { #include "sine_table.h" }; -// gcc 4.x fix -const float gr_fxpt::TWO_TO_THE_31; -const float gr_fxpt::PI; +const float gr_fxpt::PI = 3.14159265358979323846; +const float gr_fxpt::TWO_TO_THE_31 = 2147483648.0; #if 0 /* diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h index 520729f8d..c98d31b27 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.h +++ b/gnuradio-core/src/lib/general/gr_fxpt.h @@ -40,8 +40,8 @@ class gr_fxpt static const int WORDBITS = 32; static const int NBITS = 10; static const float s_sine_table[1 << NBITS][2]; - static const float PI = 3.14159265358979323846; - static const float TWO_TO_THE_31 = 2147483648.0; + static const float PI; + static const float TWO_TO_THE_31; public: static gr_int32 diff --git a/gnuradio-core/src/lib/general/gr_math.cc b/gnuradio-core/src/lib/general/gr_math.cc deleted file mode 100644 index 82dff469c..000000000 --- a/gnuradio-core/src/lib/general/gr_math.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_math.h> -#include <math.h> - -/* - * Greatest Common Divisor, using Euclid's algorithm. - * [There are faster algorithms. See Knuth 4.5.2 if you care] - */ - -long -gr_gcd (long m, long n) -{ - if (m < 0) - m = -m; - - if (n < 0) - n = -n; - - while (n != 0){ - long t = m % n; - m = n; - n = t; - } - - return m; -} - - -/* - * These really need some configure hacking to figure out the right answer. - * As a stop gap, try for a macro, and if not that, then try std:: - */ - -// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise - -#if defined(isnan) || !defined(CXX_HAS_STD_ISNAN) - -int -gr_isnan (double value) -{ - return isnan (value); -} - -#else - -int -gr_isnan (double value) -{ - return std::isnan (value); -} - -#endif - -// returns a non-zero value if the value of x has its sign bit set. -// -// This is not the same as `x < 0.0', because IEEE 754 floating point -// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but -// `gr_signbit (-0.0)' will return a nonzero value. - -#ifdef signbit - -int -gr_signbit (double x) -{ - return signbit (x); -} - -#else - -int -gr_signbit (double x) -{ - return std::signbit (x); -} - - -#endif diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h index ea0f20027..f5935c1da 100644 --- a/gnuradio-core/src/lib/general/gr_math.h +++ b/gnuradio-core/src/lib/general/gr_math.h @@ -35,19 +35,6 @@ gr_is_power_of_2(long x) return x != 0 && (x & (x-1)) == 0; } -long gr_gcd (long m, long n); - -// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise -int gr_isnan (double value); - -// returns a non-zero value if the value of x has its sign bit set. -// -// This is not the same as `x < 0.0', because IEEE 754 floating point -// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but -// `gr_signbit (-0.0)' will return a nonzero value. - -int gr_signbit (double x); - /*! * \brief Fast arc tangent using table lookup and linear interpolation * \ingroup misc diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc index 3457370eb..279945766 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc @@ -281,7 +281,7 @@ gr_ofdm_frame_sink::set_sym_value_out(const std::vector<gr_complex> &sym_positio d_sym_position = sym_position; d_sym_value_out = sym_value_out; - d_nbits = (unsigned long)ceil(log10(d_sym_value_out.size()) / log10(2.0)); + d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0)); return true; } diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc index 370b029cd..cc4aba0cb 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc +++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc @@ -113,7 +113,7 @@ gr_ofdm_mapper_bcv::gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constella throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); } - d_nbits = (unsigned long)ceil(log10(d_constellation.size()) / log10(2.0)); + d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0)); } gr_ofdm_mapper_bcv::~gr_ofdm_mapper_bcv(void) diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index e535f28c7..f20b15ca0 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2008 Free Software Foundation, Inc. + * Copyright 2003,2008,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,6 +21,7 @@ */ #include <gri_fft.h> +#include <gr_sys_paths.h> #include <fftw3.h> #include <gr_complex.h> #include <stdlib.h> @@ -29,6 +30,9 @@ #include <cassert> #include <stdexcept> +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> +namespace fs = boost::filesystem; boost::mutex & gri_fft_planner::mutex() @@ -38,26 +42,18 @@ gri_fft_planner::mutex() return s_planning_mutex; } -static char * +static const char * wisdom_filename () { - static const char *filename = ".gr_fftw_wisdom"; - - char *home = getenv ("HOME"); - if (home){ - char *p = new char[strlen (home) + strlen (filename) + 2]; - strcpy (p, home); - strcat (p, "/"); - strcat (p, filename); - return p; - } - return 0; + static fs::path path; + path = fs::path(gr_appdata_path()) / ".gr_fftw_wisdom"; + return path.string().c_str(); } static void gri_fftw_import_wisdom () { - char *filename = wisdom_filename (); + const char *filename = wisdom_filename (); FILE *fp = fopen (filename, "r"); if (fp != 0){ int r = fftwf_import_wisdom_from_file (fp); @@ -66,13 +62,12 @@ gri_fftw_import_wisdom () fprintf (stderr, "gri_fftw: can't import wisdom from %s\n", filename); } } - delete [] filename; } static void gri_fftw_export_wisdom () { - char *filename = wisdom_filename (); + const char *filename = wisdom_filename (); FILE *fp = fopen (filename, "w"); if (fp != 0){ fftwf_export_wisdom_to_file (fp); @@ -82,7 +77,6 @@ gri_fftw_export_wisdom () fprintf (stderr, "gri_fftw: "); perror (filename); } - delete [] filename; } // ---------------------------------------------------------------- diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc index 9885b3852..113006a22 100644 --- a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc +++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc @@ -53,7 +53,7 @@ qa_gr_fxpt_vco::t0 () float input[SIN_COS_BLOCK_SIZE]; for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - input[i] = sin(i); + input[i] = sin(double(i)); } for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ @@ -85,7 +85,7 @@ qa_gr_fxpt_vco::t1 () double max_error = 0; for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){ - input[i] = sin(i); + input[i] = sin(double(i)); } ref_vco.cos (ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL); diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am index bd18cf143..1cc6014a1 100644 --- a/gnuradio-core/src/lib/missing/Makefile.am +++ b/gnuradio-core/src/lib/missing/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2008,2009 Free Software Foundation, Inc. +# Copyright 2003,2004,2008,2009,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -AM_CPPFLAGS = $(GNURADIO_INCLUDES) $(WITH_INCLUDES) +AM_CPPFLAGS = $(GRUEL_INCLUDES) $(GNURADIO_INCLUDES) $(WITH_INCLUDES) EXTRA_DIST += \ getopt.h \ diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index 3dd2b42f5..eca92e526 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2003,2004,2007,2008,2009,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -58,7 +58,7 @@ libruntime_la_SOURCES = \ gr_sync_block.cc \ gr_sync_decimator.cc \ gr_sync_interpolator.cc \ - gr_tmp_path.cc \ + gr_sys_paths.cc \ gr_top_block.cc \ gr_top_block_impl.cc \ gr_tpb_detail.cc \ @@ -121,7 +121,7 @@ grinclude_HEADERS = \ gr_tpb_detail.h \ gr_tpb_thread_body.h \ gr_timer.h \ - gr_tmp_path.h \ + gr_sys_paths.h \ gr_types.h \ gr_unittests.h \ gr_vmcircbuf.h \ diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 03d5a8738..fa3722714 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -31,6 +31,7 @@ #include <iostream> #include <assert.h> #include <algorithm> +#include <boost/math/common_factor_rt.hpp> static long s_buffer_count = 0; // counts for debugging storage mgmt static long s_buffer_reader_count = 0; @@ -73,7 +74,7 @@ static long s_buffer_reader_count = 0; static long minimum_buffer_items (long type_size, long page_size) { - return page_size / gr_gcd (type_size, page_size); + return page_size / boost::math::gcd (type_size, page_size); } diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc index 5f7412248..c2ca047a8 100644 --- a/gnuradio-core/src/lib/runtime/gr_preferences.cc +++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2010 Free Software Foundation, Inc. + * Copyright 2003,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,6 +25,7 @@ #endif #include <gr_preferences.h> +#include <gr_sys_paths.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -33,12 +34,9 @@ #include <unistd.h> #include <string.h> - -#ifdef MKDIR_TAKES_ONE_ARG -#define gr_mkdir(pathname, mode) mkdir(pathname) -#else -#define gr_mkdir(pathname, mode) mkdir((pathname), (mode)) -#endif +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> +namespace fs = boost::filesystem; /* * The simplest thing that could possibly work: @@ -48,27 +46,19 @@ static const char * pathname (const char *key) { - static char buf[200]; - snprintf (buf, sizeof (buf), "%s/.gnuradio/prefs/%s", getenv ("HOME"), key); - return buf; + static fs::path path; + path = fs::path(gr_appdata_path()) / ".gnuradio" / "prefs" / key; + return path.string().c_str(); } static void ensure_dir_path () { - char path[200]; - struct stat statbuf; - - snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME")); - if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) - return; - - // blindly try to make it // FIXME make this robust. C++ SUCKS! + fs::path path = fs::path(gr_appdata_path()) / ".gnuradio"; + if (!fs::is_directory(path)) fs::create_directory(path); - snprintf (path, sizeof (path), "%s/.gnuradio", getenv ("HOME")); - gr_mkdir (path, 0750); - snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME")); - gr_mkdir (path, 0750); + path = path / "prefs"; + if (!fs::is_directory(path)) fs::create_directory(path); } const char * diff --git a/gnuradio-core/src/lib/runtime/gr_sys_paths.cc b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc new file mode 100644 index 000000000..9d10a3ccd --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include <gr_sys_paths.h> +#include <cstdlib> //getenv +#include <cstdio> //P_tmpdir (maybe) + +const char *gr_tmp_path(){ + const char *path; + + //first case, try TMP environment variable + path = getenv("TMP"); + if (path) return path; + + //second case, try P_tmpdir when its defined + #ifdef P_tmpdir + if (P_tmpdir) return P_tmpdir; + #endif /*P_tmpdir*/ + + //fall-through case, nothing worked + return "/tmp"; +} + +const char *gr_appdata_path(){ + const char *path; + + //first case, try HOME environment variable (unix) + path = getenv("HOME"); + if (path) return path; + + //second case, try APPDATA environment variable (windows) + path = getenv("APPDATA"); + if (path) return path; + + //fall-through case, nothing worked + return gr_tmp_path(); +} diff --git a/gnuradio-core/src/lib/runtime/gr_tmp_path.h b/gnuradio-core/src/lib/runtime/gr_sys_paths.h index 3d02043c7..aa8249775 100644 --- a/gnuradio-core/src/lib/runtime/gr_tmp_path.h +++ b/gnuradio-core/src/lib/runtime/gr_sys_paths.h @@ -1,6 +1,5 @@ -/* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,12 +19,13 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GR_TMP_PATH_H_ -#define _GR_TMP_PATH_H_ +#ifndef _GR_SYS_PATHS_H_ +#define _GR_SYS_PATHS_H_ -/*! - * \brief return directory portion of pathname used for temporary files. - */ -const char *gr_tmp_path (); +//! directory to create temporary files +const char *gr_tmp_path(); + +//! directory to store application data +const char *gr_appdata_path(); -#endif /* _GR_TMP_PATH_H_ */ +#endif /* _GR_SYS_PATHS_H_ */ diff --git a/gnuradio-core/src/lib/runtime/gr_tmp_path.cc b/gnuradio-core/src/lib/runtime/gr_tmp_path.cc deleted file mode 100644 index 1f0c830cd..000000000 --- a/gnuradio-core/src/lib/runtime/gr_tmp_path.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_tmp_path.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -const char * -gr_tmp_path () -{ - static char *pp = 0; - - if (pp) - return pp; - - char *s = getenv ("TMP"); - if (s){ - pp = strdup (s); - return pp; - } - -#ifdef P_tmpdir - if (P_tmpdir){ - pp = strdup (P_tmpdir); - return pp; - } -#endif - - pp = strdup ("/tmp"); - return pp; -} - diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h index 70aa6f294..59149bb2e 100644 --- a/gnuradio-core/src/lib/runtime/gr_unittests.h +++ b/gnuradio-core/src/lib/runtime/gr_unittests.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -31,37 +31,11 @@ #include <sys/stat.h> #include <unistd.h> +#include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> -#ifdef MKDIR_TAKES_ONE_ARG -#define gr_mkdir(pathname, mode) mkdir(pathname) -#else -#define gr_mkdir(pathname, mode) mkdir((pathname), (mode)) -#endif - -/* - * Mostly taken from gr_preferences.cc/h - * The simplest thing that could possibly work: - * the key is the filename; the value is the file contents. - */ - -static void -ensure_unittest_path (const char *path) -{ - struct stat statbuf; - if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) - return; - - // blindly try to make it // FIXME make this robust. C++ SUCKS! - gr_mkdir (path, 0750); +static std::string get_unittest_path(const std::string &filename){ + boost::filesystem::path path = boost::filesystem::current_path() / ".unittests"; + if (!boost::filesystem::is_directory(path)) boost::filesystem::create_directory(path); + return (path / filename).string(); } - -static void -get_unittest_path (const char *filename, char *fullpath, size_t pathsize) -{ - char path[200]; - snprintf (path, sizeof(path), "./.unittests"); - snprintf (fullpath, pathsize, "%s/%s", path, filename); - - ensure_unittest_path(path); -} - diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc index 65fe0c488..42c459484 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2005 Free Software Foundation, Inc. + * Copyright 2003,2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -36,7 +36,6 @@ #include <errno.h> #include <stdio.h> #include <gr_pagesize.h> -#include <gr_tmp_path.h> #include <gr_vmcircbuf_createfilemapping.h> #ifdef HAVE_CREATEFILEMAPPING diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc index 3017036ef..4f7ae39cd 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_shm_open.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -37,7 +37,7 @@ #include <errno.h> #include <stdio.h> #include <gr_pagesize.h> -#include <gr_tmp_path.h> +#include <gr_sys_paths.h> gr_vmcircbuf_mmap_shm_open::gr_vmcircbuf_mmap_shm_open (int size) diff --git a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc index faae4b396..ee8b0c485 100644 --- a/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc +++ b/gnuradio-core/src/lib/runtime/gr_vmcircbuf_mmap_tmpfile.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -39,7 +39,7 @@ #include <stdio.h> #include <string.h> #include <gr_pagesize.h> -#include <gr_tmp_path.h> +#include <gr_sys_paths.h> gr_vmcircbuf_mmap_tmpfile::gr_vmcircbuf_mmap_tmpfile (int size) : gr_vmcircbuf (size) diff --git a/gnuradio-core/src/tests/Makefile.am b/gnuradio-core/src/tests/Makefile.am index c75bb8c2a..5879a13d8 100644 --- a/gnuradio-core/src/tests/Makefile.am +++ b/gnuradio-core/src/tests/Makefile.am @@ -59,7 +59,7 @@ noinst_SCRIPTS = \ benchmark_dotprod -LIBGNURADIO = $(GNURADIO_CORE_LA) +LIBGNURADIO = $(GNURADIO_CORE_LA) $(BOOST_FILESYSTEM_LIB) LIBGNURADIOQA = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core-qa.la $(LIBGNURADIO) benchmark_dotprod_fff_SOURCES = benchmark_dotprod_fff.cc diff --git a/gnuradio-core/src/tests/benchmark_vco.cc b/gnuradio-core/src/tests/benchmark_vco.cc index ed0ae3b67..3a6ade78c 100644 --- a/gnuradio-core/src/tests/benchmark_vco.cc +++ b/gnuradio-core/src/tests/benchmark_vco.cc @@ -63,7 +63,7 @@ benchmark (void test (float *x, const float *y), const char *implementation_name // touch memory memset(output, 0, BLOCK_SIZE*sizeof(float)); for (int i = 0; i<BLOCK_SIZE; i++) - input[i] = sin(i); + input[i] = sin(double(i)); // get starting CPU usage #ifdef HAVE_SYS_RESOURCE_H diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 17ee32f34..6cec8ad0e 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -34,11 +34,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_all.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_all.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc index 51642f81a..66cb2a312 100644 --- a/gnuradio-core/src/tests/test_atsc.cc +++ b/gnuradio-core/src/tests/test_atsc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_atsc.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_atsc.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_atsc::suite ()); diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc index 2781cfb35..3227a9ff2 100644 --- a/gnuradio-core/src/tests/test_filter.cc +++ b/gnuradio-core/src/tests/test_filter.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_filter.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_filter::suite ()); diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc index 16ee9c3ad..ca6dee40a 100644 --- a/gnuradio-core/src/tests/test_general.cc +++ b/gnuradio-core/src/tests/test_general.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_general.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_general.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_general::suite ()); diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc index c7983a23e..77af3001b 100644 --- a/gnuradio-core/src/tests/test_runtime.cc +++ b/gnuradio-core/src/tests/test_runtime.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2010 Free Software Foundation, Inc. + * Copyright 2002,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,11 +29,8 @@ int main (int argc, char **argv) { - char path[200]; - get_unittest_path ("gnuradio_core_runtime.xml", path, 200); - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(path); + std::ofstream xmlfile(get_unittest_path("gnuradio_core_runtime.xml").c_str()); CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); |