From cf98fce94b3c7e310582be9541503f1387022459 Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Sun, 30 Nov 2014 10:37:16 +0100 Subject: [PATCH] parsevect fixes --- Makefile | 4 ++-- README.md | 2 +- parsevect | 29 +++++++++++++++++++---------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index a8c2037..93e7c57 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ all: clean-vect @echo Auto-detected optimization parameters: $(PARAMS_SIMD) @echo c99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.so - -./parsevect dumpvect*.vect libcsdr.c + -./parsevect dumpvect*.vect c99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) csdr.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o csdr arm-cross: clean-vect #note: this doesn't work since having added FFTW @@ -52,7 +52,7 @@ arm-cross: clean-vect clean-vect: rm -f dumpvect*.vect clean: clean-vect - rm libcsdr.so csdr + rm -f libcsdr.so csdr install: install -m 0755 libcsdr.so /usr/lib install -m 0755 csdr /usr/bin diff --git a/README.md b/README.md index f985e5d..33a8485 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ E.g. you can send `-0.05 0.02\n` #### Testbench -`csdr` was tested with GNU Radio Companion flowgraphs. These flowgraphs are available under the directory `grc_tests`, and they require the `gr-ha5kfu` set of blocks for GNU Radio. +`csdr` was tested with GNU Radio Companion flowgraphs. These flowgraphs are available under the directory `grc_tests`, and they require the gr-ha5kfu set of blocks for GNU Radio. ## [Licensing] (#licensing) diff --git a/parsevect b/parsevect index f380e3b..5da79e2 100755 --- a/parsevect +++ b/parsevect @@ -1,4 +1,5 @@ -#!/usr/bin/python +#!/usr/bin/python2 +print "" # python2.7 is required to run parsevect instead of python3 """ This software is part of libcsdr, a set of simple DSP routines for Software Defined Radio. @@ -30,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ import sys +import os try: vectfile=open(sys.argv[1],"r").readlines() @@ -58,17 +60,24 @@ Colors: \033[1;0m""" checkline = lambda k: cfile[linenum-k] if "//@" in cfile[linenum-k] else corresponds +fallback=False for row in vectfile: if "LOOP VECTORIZED" in row or "not vectorized" in row: filename=row.split(":")[0] - loadcfile(filename) - linenum=int(row.split(":")[1]) - corresponds="//@" - corresponds=checkline(1) - corresponds=checkline(2) - corresponds=corresponds.split("//@")[1][:-1] - yellow=corresponds.startswith("@") - if yellow: corresponds=corresponds[1:] - print row[:-1], "\033[1;33m" if yellow else "\033[1;31m" if "not " in row else "\033[1;32m", corresponds, "\033[1;0m" + if not fallback and not os.path.isfile(filename): + print "parsevect: Log format mismatch (perhaps gcc version is older than 4.8.2). Comments and colors will not be matched to rows." + fallback = True + if fallback: + print row[:-1] + else: + loadcfile(filename) + linenum=int(row.split(":")[1]) + corresponds="//@" + corresponds=checkline(1) + corresponds=checkline(2) + corresponds=corresponds.split("//@")[1][:-1] + yellow=corresponds.startswith("@") + if yellow: corresponds=corresponds[1:] + print row[:-1], "\033[1;33m" if yellow else "\033[1;31m" if "not " in row else "\033[1;32m", corresponds, "\033[1;0m"