From d0988f6f09a1817f75b25d6048011e12c8cb8d88 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Mon, 1 May 2017 16:01:35 +0200 Subject: [PATCH] [ion] Add a host command-line utility to filter valid events Change-Id: Iaaa26ebf079152592a973c1f4658caa00f3f0651 --- ion/Makefile | 4 ++-- ion/src/shared/tools/Makefile | 5 +++++ ion/src/shared/tools/event_filter.cpp | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ion/src/shared/tools/Makefile create mode 100644 ion/src/shared/tools/event_filter.cpp diff --git a/ion/Makefile b/ion/Makefile index cf9916488..b2af7b5ea 100644 --- a/ion/Makefile +++ b/ion/Makefile @@ -4,12 +4,12 @@ ifdef GIT PATCH_LEVEL = `git rev-parse HEAD` endif - - SFLAGS += -Iion/include -DKD_CONFIG_H=1 ion/src/shared/software_version.o: SFLAGS += -DPATCH_LEVEL=$(PATCH_LEVEL) -DVERSION=$(VERSION) include ion/src/$(PLATFORM)/Makefile +include ion/src/shared/tools/Makefile + objs += $(addprefix ion/src/shared/, \ events.o \ software_version.o \ diff --git a/ion/src/shared/tools/Makefile b/ion/src/shared/tools/Makefile new file mode 100644 index 000000000..d045c9e38 --- /dev/null +++ b/ion/src/shared/tools/Makefile @@ -0,0 +1,5 @@ +ion/src/shared/tools/event_%: ion/src/shared/tools/event_%.cpp ion/src/shared/events.cpp + @echo "HOSTCXX $@" + @$(HOSTCXX) -std=c++11 -Iion/include $^ -o $@ + +products += $(addprefix ion/src/shared/tools/, event_filter event_generator) diff --git a/ion/src/shared/tools/event_filter.cpp b/ion/src/shared/tools/event_filter.cpp new file mode 100644 index 000000000..abca28008 --- /dev/null +++ b/ion/src/shared/tools/event_filter.cpp @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char * argv[]) { + char c; + while (std::cin.get(c)) { + Ion::Events::Event e(c); + if (e.isValid()) { + std::cout.put(c); + } + } +}