Commit 38b17497 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

new project

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2078
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent ca632b35
This is a legacy version of the repository. It may be incomplete as well as
inconsistent. See README.history for details. For the old stock of the
repository copyright and licence conditions apply as specified for versions
commited after 2015-03-01. Use recent versions as a base for new development.
The legacy version is only stored to keep a record of history.
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.1 2006-04-11 07:42:03 tforb Exp $
#
# Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
#
# all stuff to create libdatwritexx and its package
#
# ----
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# ----
#
# REVISIONS and CHANGES
# 11/04/2006 V1.0 Thomas Forbriger
#
# ============================================================================
#
MODULES=sff ascii
HEADERS=$(wildcard *.h $(addsuffix /*.h,$(MODULES)))
LIBSRC=$(wildcard *.cc $(addsuffix /*.cc,$(MODULES)))
TESTSRC=$(wildcard test/*.cc)
INCINSTALLPATH=$(LOCINCLUDEDIR)/datwritexx
LIBINSTALLPATH=$(LOCLIBDIR)
# name of headers with comments stripped off
STRIPHEADER=$(addsuffix .strip,$(notdir $(HEADERS)))
# name of installed (exported) header files
INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(notdir $(HEADERS)))
# if defined, empty lines are kept in stripped comment headers
# to synchronize line numbers
EMPTYPRINT=1
#EMPTYPRINT=0
# define this to be cat in case you do not have remcmmnt available
REMCMMNT=remcmmnt
#REMCMMNT=cat
#
# general part
# ------------
#
FLAGS=
CXXFLAGS=-fhonor-std -Wall $(FLAGS)
CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)
all: install doxybrief doxyfull
install: install-include libdatwritexx.a
flist: Makefile $(wildcard *.cfg contrib/*.h) $(HEADERS) $(LIBSRC) \
$(TESTSRC) README
echo $^ | tr ' ' '\n' | sort > $@
.PHONY: edit
edit: flist; vim $<
.PHONY: clean
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.o | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.d | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist
#======================================================================
# pattern rules
# -------------
%.d: %.cc
$(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
#======================================================================
# library part
# ------------
-include $(patsubst %.cc,%.d,$(LIBSRC) $(TESTSRC))
libdatreadxx.a: $(patsubst %.cc,%.o,$(LIBSRC))
ar rcv $@ $^
ranlib $@
newlib $@
#----------------------------------------------------------------------
# comment stripping
%.hd: %.h; echo $(notdir $<.strip): $< > $@
-include $(patsubst %.h,%.hd,$(HEADERS))
# first awk rule assumes that the first non-comment line starts with '#'
# and that the first (copyright) comment end with pattern "^ */"
%.h.strip:
awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\
/^#/ { hot=0; } \
{ if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@
$(REMCMMNT) $< | awk 'BEGIN {hot=0;} \
/^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print; } next; } \
/^#/ { hot=1; } { if (hot) print; }' >> $@
#----------------------------------------------------------------------
$(INCINSTALLPATH)/%.h: %.h.strip
mkdir -p $(INCINSTALLPATH)
-rm -fv $@
ln -svf $$(pwd)/$< $@
install-include: $(INSTHEADER)
touch $@
#======================================================================
# documentation part
# ------------------
DOXYWWWPATH=$(HOME)/public_html/txt/cxx/libdatwritexx
.PHONY: doxyclean doxyview doxybriefview doxyfullconf doxybriefconf
doxyclean: ;/bin/rm -rfv doc/* docbrief/* doc docbrief
DOXYSRC=$(LIBSRC) $(HEADERS) README
doc/%: doxyfull.cfg $(DOXYSRC)
mkdir -vp $(DOXYWWWPATH)
/bin/rm -rfv doc/* doc
ln -sfv $(DOXYWWWPATH) doc
doxygen $<
docbrief/%: doxybrief.cfg $(DOXYSRC); doxygen $<
doxybriefconf doxyfullconf: doxy%conf:
doxywizard $(patsubst doxy%conf,doxy%.cfg,$@)
doxybrief: docbrief/html/index.html
doxyfull: doc/html/index.html
doxydoc: doxybrief doxyfull
doxyfullview: doxyfull; mozilla file:$(DOXYWWWPATH)/html/index.html &
doxybriefview: doxybrief; mozilla file:/docbrief/html/index.html &
doxyview: doxyfullview doxybrief
#======================================================================
# test code
# ---------
hpmotest mseedtest pdastest: %: tests/%.o libdatwritexx.a
$(CXX) $(FLAGS) -o $@ $< -I$(LOCINCLUDEDIR) \
-ldatwritexx -lsffxx -lgsexx -ltsxx -ltfxx -laff -ltime++ \
-L$(LOCLIBDIR)
newprog $@
#======================================================================
# create package
# --------------
LIBRARYNAME=libdatwritexx
VERSIONCODE=$(shell date +'%Y%m%d')
PACKAGE=$(LIBRARYNAME)$(VERSIONCODE)
PUBLICATIONPATH=$(HOME)/public_html/download/software
TMPPATH=$(HOME)/tmp/$(PACKAGE)
package:
/bin/rm -rfv $(TMPPATH); mkdir -pv $(TMPPATH)
cd $(TMPPATH)/..; cvs export -r HEAD \
-d $(PACKAGE) thof/src/libs/$(LIBRARYNAME)
cd $(TMPPATH)/..; cvs export -r HEAD -d $(PACKAGE) thof/src/LICENSE.GPL
cd $(TMPPATH)/..; cvs export -r HEAD \
-d $(PACKAGE) thof/src/README.compile
/bin/bash -c 'cd $(TMPPATH); \
export WWWBASEDIR=doxydoc; \
mkdir -v inctmp; \
make INCINSTALLPATH=inctmp all; make clean; /bin/rm -rfv inctmp'
cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
gzip --force -9 $(PUBLICATIONPATH)/$(PACKAGE).tar
cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar
$(MAKE) install
# ----- END OF Makefile -----
/*! \file libdatwritexx/README
* \brief A library to write different seismic data formats through the same interface
*
* ----------------------------------------------------------------------------
*
* $Id: README,v 1.1 2006-04-11 07:42:03 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
* A library to write different seismic data formats through the same interface
*
* This file contains:
* - documentation of namespace datwrite
* - mainpage text
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 11/04/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
/*! \brief Root namespace of library
This namespace contains the generic interface to the library.
It contains several subnamespaces with interfaces to format specific data
reading modules.
*/
namespace datwrite {
} // namespace datwrite
/*======================================================================*/
/*! \mainpage
\author Thomas Forbriger
\since April 2006
\date April 2006
\version V1.0
$Id: README,v 1.1 2006-04-11 07:42:03 tforb Exp $
Contents of this page:
- \ref sec_concept
- \ref sec_howto
\section sec_concept Concept of the library
The library defines a generic interface for modules that write seismic data.
The data must be available in SFF structures defined by libsffxx.
Comparable with libdatreadxx a generic module will be provided that supports
writing of any data format supported by the library.
\section sec_howto HOWTO read data of any supported format
An example will be provided as soon as the code is written ;-)
*/
// ----- END OF README -----
# Doxygen configuration generated by Doxywizard version 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "DATWRITE++ library: writing seismic data"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CLASS_DIAGRAMS = YES
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = YES
TAB_SIZE = 8
ENABLED_SECTIONS = internal
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
ALIASES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./
FILE_PATTERNS = README \
*.h \
*.cc
RECURSIVE = YES
EXCLUDE = contrib
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
EXTRA_PACKAGES = pslatex
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = YES
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =
/*! \file error.cc
* \brief libdatwrite error handling (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: error.cc,v 1.1 2006-04-11 07:42:04 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
* libdatwrite error handling (implementation)
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 11/04/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define DATWRITE_ERROR_CC_VERSION \
"DATWRITE_ERROR_CC V1.0 "
#define DATWRITE_ERROR_CC_CVSID \
"$Id: error.cc,v 1.1 2006-04-11 07:42:04 tforb Exp $"
#include <iostream>
#include <datwritexx/error.h>
using std::cerr;
using std::endl;
namespace datwrite {
//! initialize and instantiate
bool Exception::Mreport_on_construct=true;
//! construct from nothing
Exception::Exception():
Mmessage(0), Mfile(0), Mline(0), Mcondition(0)
{ if (Mreport_on_construct) { report(); } }
//! construct with message
Exception::Exception(const char* message):
Mmessage(message), Mfile(0), Mline(0), Mcondition(0)
{ if (Mreport_on_construct) { report(); } }
//! construct with message and file info
Exception::Exception(const char* message,
const char* condition):
Mmessage(message), Mfile(0), Mline(0), Mcondition(condition)
{ if (Mreport_on_construct) { report(); } }
//! construct with message and file info
Exception::Exception(const char* message,
const char* file,
const int& line):
Mmessage(message), Mfile(file), Mline(line), Mcondition(0)
{ if (Mreport_on_construct) { report(); } }
//! construct with message and file info and condition
Exception::Exception(const char* message,
const char* file,
const int& line,
const char* condition):
Mmessage(message), Mfile(file), Mline(line), Mcondition(condition)
{ if (Mreport_on_construct) { report(); } }
//! switch on
void Exception::report_on_construct()
{
Mreport_on_construct=true;
}
//! switch off
void Exception::dont_report_on_construct()
{
Mreport_on_construct=false;
}
//! report
void Exception::report() const
{
base_report();
}
//! report
void Exception::base_report() const
{
cerr << "Exception report:" << endl;
if (Mmessage==0)
{
cerr << " No message" << endl;
}
else
{
cerr << " message: " << Mmessage << endl;
}
if (Mfile!=0)
{
cerr << " triggered in \"" << Mfile << "\" at line #" << Mline << endl;
}
if (Mcondition!=0)
{
cerr << " by condition:" << endl
<< " \"" << Mcondition << "\"" << endl;
}
}
} // namespace datwrite
/* ----- END OF error.cc ----- */
/*! \file error.h
* \brief libdatwrite error handling (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: error.h,v 1.1 2006-04-11 07:42:04 tforb Exp $
* \author Thomas Forbriger
* \date 11/04/2006
*
* libdatwrite error handling (prototypes)
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 11/04/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef DATWRITE_ERROR_H_VERSION
#define DATWRITE_ERROR_H_VERSION \
"DATWRITE_ERROR_H V1.0 "
#define DATWRITE_ERROR_H_CVSID \
"$Id: error.h,v 1.1 2006-04-11 07:42:04 tforb Exp $"
namespace datwrite {
/*! \defgroup group_error Error handling module
*/
/*! \brief Base class for exceptions
*
* This is an exception base class. It holds some information about the
* reason for throwing the exception. The information is printed to cerr
* through function report(). This function may be overloaded by a derived
* type. But its functionality is still accessible through base_report().
*
* The standard behaviour is to print out the message during object
* initialization. If you don't like this, call dont_report_on_construct().
*
* \ingroup group_error
* \sa datwrite_Xassert
* \sa datwrite_assert
* \sa datwrite_abort
*/
class Exception
{
public:
//! Creates exception with no explaning comments
Exception();
//! Creates an exception with an explanation message
Exception(const char* message);
//! Creates an exception with message and failed assertion
Exception(const char* message,
const char* condition);
//! Create with message, failed assertion, and code position
Exception(const char* message,
const char* file,
const int& line,
const char* condition);
//! Create with message and code position
Exception(const char* message,
const char* file,
const int& line);
//! Screen report
virtual void report() const;
//! Issue a screen report on construction of exception
static void report_on_construct();
//! Issue NO screen report on construction of exception
static void dont_report_on_construct();
protected:
//! Screen report
void base_report() const;
private:
//! Shall we print to cerr at construction time?
static bool Mreport_on_construct;
//! pointer to message string
const char* Mmessage;
//! pointer to file name string
const char* Mfile;
//! pointer to line number in source file
const int& Mline;
//! pointer to assertion condition text string
const char* Mcondition;
}; // class Exception
} // namespace datwrite
/*======================================================================*/
//
// preprocessor macros
// ===================
/*! \brief Check an assertion and report by throwing an exception.
*
* \ingroup group_error
* \param C assert condition
* \param M message of type char*
* \param E exception class to throw
*/
#define DATWRITE_Xassert(C,M,E) \
if (!(C)) { throw( E ( M , __FILE__, __LINE__, #C )); }
/*! \brief Check an assertion and report by throwing an exception.
*
* \ingroup group_error