[med-svn] [libgtextutils] 21/83: Added source files and pkgconfig.

Charles Plessy plessy at moszumanska.debian.org
Wed Jan 8 13:37:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch debian/unstable
in repository libgtextutils.

commit adc7d0a3b8ec29a965ffb544b5dcd3fe6bd3bb1f
Author: A. Gordon <gordon at cshl.edu>
Date:   Wed Feb 25 19:28:40 2009 -0500

    Added source files and pkgconfig.
---
 Makefile.am                         |  3 +++
 configure.ac                        | 40 +++++++++++++++++++++++++++++++++++
 gtextutils-0.1.pc.in                | 10 +++++++++
 src/Makefile.am                     |  1 +
 src/gtextutils/Makefile.am          | 26 +++++++++++++++++++++++
 src/gtextutils/print_utils.h        | 30 ++++++++++++++++++++++++++
 src/gtextutils/stream_wrapper.cpp   | 42 +++++++++++++++++++++++++++++++++++++
 src/gtextutils/stream_wrapper.h     | 36 +++++++++++++++++++++++++++++++
 src/gtextutils/text_line_reader.cpp | 28 +++++++++++++++++++++++++
 src/gtextutils/text_line_reader.h   | 31 +++++++++++++++++++++++++++
 10 files changed, 247 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 240589b..41047b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,3 +10,6 @@
 
 EXTRA_DIST = reconf configure
 SUBDIRS = m4 src doc
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gtextutils-0.1.pc
diff --git a/configure.ac b/configure.ac
index 6a32091..89b5a22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,12 +22,52 @@ LF_HOST_TYPE
 LF_SET_WARNINGS
 AC_PROG_RANLIB
 
+AC_DEFINE([CXX_HAS_BUGGY_FOR_LOOPS], [], [Description])
+AC_DEFINE([CXX_HAS_NO_BOOL], [], [Description])
+AC_DEFINE([NDEBUG], [], [Description])
+AC_DEFINE([YOUR_OS], [], [Description])
+
+dnl --enable-wall
+EXTRA_CHECKS="-Wall -Wextra -Wformat-nonliteral -Wformat-security -Wswitch-default -Wswitch-enum -Wunused-parameter -Wfloat-equal -Werror"
+AC_ARG_ENABLE(wall,
+[  --enable-wall          Enable many common GCC warnings (-Wall,-Wextra, -Werror etc., default enabled)],
+[case "${enableval}" in
+  yes) wall=true ;;
+  no)  wall=false ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-wall) ;;
+esac],[wall=true])
+if test "$wall" = "true"
+then
+  CFLAGS="${CFLAGS} ${EXTRA_CHECKS}"
+  CXXFLAGS="${CXXFLAGS} ${EXTRA_CHECKS}"
+fi
+
+dnl --enable-debug
+AC_ARG_ENABLE(debug,
+[  --enable-debug          Enable debug mode (default enabled)],
+[case "${enableval}" in
+  yes) debug=true ;;
+  no)  debug=false ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
+esac],[debug=true])
+if test "$debug" = "true"
+then
+  CFLAGS="${CFLAGS} -DDEBUG -g -O1"
+  CXXFLAGS="${CFLAGS} -DDEBUG -g -O1"
+else
+  CFLAGS="${CFLAGS} -O3"
+  CXXFLAGS="${CFLAGS} -O3"
+fi
+
+
 AC_CONFIG_FILES([
    Makefile
    README
    doc/Makefile
    m4/Makefile
    src/Makefile
+   src/gtextutils/Makefile
+   gtextutils-0.1.pc
 ])
 
 AC_OUTPUT
diff --git a/gtextutils-0.1.pc.in b/gtextutils-0.1.pc.in
new file mode 100644
index 0000000..f85474f
--- /dev/null
+++ b/gtextutils-0.1.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gtextutils
+Description: Gordon's text-utility classes
+Version: @VERSION@
+Libs: -L${libdir} -lgtextutils-0.1
+Cflags: -I${includedir}/gtextutils-1.0
diff --git a/src/Makefile.am b/src/Makefile.am
index a1542a4..c2a8511 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,3 +8,4 @@
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
+SUBDIRS = gtextutils
diff --git a/src/gtextutils/Makefile.am b/src/gtextutils/Makefile.am
new file mode 100644
index 0000000..5491f1d
--- /dev/null
+++ b/src/gtextutils/Makefile.am
@@ -0,0 +1,26 @@
+# Copyright (C) 2008 Assaf Gordon <gordon at cshl.edu>
+#  
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without 
+# modifications, as long as this notice is preserved.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+
+lib_LIBRARIES = libgtextutils.a
+
+libgtextutils_a_SOURCES = stream_wrapper.cpp stream_wrapper.h \
+		          text_line_reader.cpp text_line_reader.h \
+			  print_utils.h
+
+libgtextutils_a_includedir = $(includedir)/gtextutils-0.1/gtextutils
+
+libgtextutils_a_include_HEADERS = print_utils.h \
+		  text_line_reader.h \
+		  stream_wrapper.h
+
+#EXAMPLE_RELEASE=0:0:1
+#EXAMPLE_LIBRARY_VERSION=0:0:0
+#libgtextutils_a_LDFLAGS= -version-info $(EXAMPLE_LIBRARY_VERSION) -release $(EXAMPLE_RELEASE)
diff --git a/src/gtextutils/print_utils.h b/src/gtextutils/print_utils.h
new file mode 100644
index 0000000..ece706d
--- /dev/null
+++ b/src/gtextutils/print_utils.h
@@ -0,0 +1,30 @@
+#ifndef __PRINT_UTILS_H__
+#define __PRINT_UTILS_H__
+
+#include <string>
+#include <sstream>
+
+template<class COLLECTION>
+inline
+std::string
+join_collection(const COLLECTION &col, const std::string& delimiter="\t")
+{
+	std::ostringstream os;
+	bool first = true ;
+
+	typename COLLECTION::const_iterator it = col.begin();
+
+	while ( it != col.end() ) {
+		if ( first ) 
+			first = false;
+		else
+			os << delimiter ;
+		os << *it ;
+		it++ ;
+	}
+
+	return os.str();
+}
+
+#endif
+
diff --git a/src/gtextutils/stream_wrapper.cpp b/src/gtextutils/stream_wrapper.cpp
new file mode 100755
index 0000000..7a2de3f
--- /dev/null
+++ b/src/gtextutils/stream_wrapper.cpp
@@ -0,0 +1,42 @@
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <ios>
+
+#include <err.h>
+
+#include "stream_wrapper.h"
+
+
+InputStreamWrapper::InputStreamWrapper(const std::string & filename) :
+	use_stdin(filename.length()==0)
+{
+	if (!use_stdin) {
+		input_file.open(filename.c_str()) ;
+		if (!input_file)
+			err(1,"Failed to open input file (%s)", 
+				filename.c_str()) ;
+	}
+};
+
+OutputStreamWrapper::OutputStreamWrapper(const std::string & filename, bool _compressed ) :
+	use_stdout(filename.length()==0), compressed(_compressed)
+{
+	if (compressed) {
+		/* compressed output stream:
+		   fork and run GZIP */
+
+	} 
+	else {
+		/* normal (not-compressed) output file:
+		   just open the file (if needed) */
+		if (!use_stdout) {
+			output_file.open(filename.c_str()) ;
+			if (!output_file)
+				err(1,"Failed to create output file (%s)", 
+						filename.c_str()) ;
+		}
+	}
+};
+	
+
diff --git a/src/gtextutils/stream_wrapper.h b/src/gtextutils/stream_wrapper.h
new file mode 100755
index 0000000..bd653f8
--- /dev/null
+++ b/src/gtextutils/stream_wrapper.h
@@ -0,0 +1,36 @@
+#ifndef __STREAM_WRAPPER__
+#define __STREAM_WRAPPER__
+
+#include <fstream>
+
+class InputStreamWrapper
+{
+private:
+	std::ifstream input_file ;
+	bool use_stdin;
+
+public:
+	InputStreamWrapper(const std::string & filename = "") ;
+
+	std::istream& stream() { return (use_stdin)?std::cin:input_file; } ;
+
+	operator std::istream&() { return stream() ; }
+};
+
+class OutputStreamWrapper
+{
+private:
+	std::ofstream output_file ;
+	bool use_stdout;
+	bool compressed ;
+
+public:
+	OutputStreamWrapper(const std::string & filename = "", bool _compressed = false) ;
+
+	std::ostream& stream() { return (use_stdout)?std::cout:output_file; } ;
+
+	operator std::ostream&() { return stream() ; }
+};
+
+#endif
+
diff --git a/src/gtextutils/text_line_reader.cpp b/src/gtextutils/text_line_reader.cpp
new file mode 100644
index 0000000..e3331ee
--- /dev/null
+++ b/src/gtextutils/text_line_reader.cpp
@@ -0,0 +1,28 @@
+#include <istream>
+#include <sstream>
+
+#include "text_line_reader.h"
+
+using namespace std;
+
+
+TextLineReader::TextLineReader(istream& _input_stream) :
+	input_stream(_input_stream), current_line_number(0)
+{
+}
+
+bool TextLineReader::next_line() 
+{
+	current_line_number++;
+	getline(input_stream, current_line_string ) ;
+
+	current_line_stream.str( current_line_string ) ;
+	current_line_stream.seekg(0, ios_base::beg );
+	current_line_stream.clear();
+	
+	if (input_stream.eof())
+		return false;
+
+	return input_stream ;
+}
+
diff --git a/src/gtextutils/text_line_reader.h b/src/gtextutils/text_line_reader.h
new file mode 100644
index 0000000..239ca54
--- /dev/null
+++ b/src/gtextutils/text_line_reader.h
@@ -0,0 +1,31 @@
+#ifndef __TEXT_FILE_READER__
+#define __TEXT_FILE_READER__
+
+#include <string>
+#include <istream>
+#include <sstream>
+
+class TextLineReader
+{
+private:
+	std::istream& input_stream ;
+	size_t current_line_number;
+	std::string current_line_string ;
+	std::istringstream current_line_stream ;
+
+	TextLineReader(const TextLineReader&);
+    	TextLineReader& operator=(const TextLineReader&);
+
+public:
+	TextLineReader(std::istream& _input_stream) ; 
+
+	size_t line_number() const { return current_line_number ; }
+
+	bool next_line() ;
+
+	const std::string& line_string() const { return current_line_string; }
+	std::istringstream& line_stream() { return current_line_stream; }
+};
+
+#endif
+

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/libgtextutils.git



More information about the debian-med-commit mailing list