From 0143e511f7a5f3595907787a832bee4e3cd03daf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 13 Sep 2009 11:52:46 +0200 Subject: Add code stream interface and SLOC counter --- tests/compiler/sloc-counter/driver.cxx | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/compiler/sloc-counter/driver.cxx (limited to 'tests/compiler/sloc-counter/driver.cxx') diff --git a/tests/compiler/sloc-counter/driver.cxx b/tests/compiler/sloc-counter/driver.cxx new file mode 100644 index 0000000..b5d6462 --- /dev/null +++ b/tests/compiler/sloc-counter/driver.cxx @@ -0,0 +1,37 @@ +// file : tests/compiler/sloc-counter/driver.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include +#include + +#include +#include + +using namespace std; +using namespace cutl::compiler; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " " << endl; + return 1; + } + + ostream_filter filt (cout); + + ifstream ifs(argv[1]); + + for (istream::int_type c (ifs.get ()); + c != istream::traits_type::eof (); + c = ifs.get ()) + { + cout.put (istream::traits_type::to_char_type (c)); + } + + cout << endl + << filt.stream ().count () << endl; +} -- cgit v1.1