Commit 5bca49f0 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

merged trunk changes

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/branches/libdatrwxx.su
SVN Revision: 3442
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5432c422
......@@ -106,7 +106,8 @@ $(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)
# comment stripping
# -----------------
$(call CHECKVARS,REMCMMNT EMPTYPRINT)
EMPTYPRINT=0
$(call CHECKVARS,TF_REMCMMNT EMPTYPRINT)
# awk rule assumes that the first non-comment line starts with '#'
# and that the first (copyright) comment end with pattern "^ */"
......@@ -114,7 +115,7 @@ $(call CHECKVARS,REMCMMNT EMPTYPRINT)
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;} \
$(TF_REMCMMNT) $< | awk 'BEGIN {hot=0;} \
/^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print ""; } next; } \
/^#/ { hot=1; } { if (hot) print; }' >> $@
......@@ -183,6 +184,9 @@ PWD=$(shell env pwd)
doxydoc.xxx: doxydoc.cfg
sed 's,<OUTPUTDIRECTORY>,$(DOXYWWWPATH),g;s,<STRIPFROMPATH>,$(PWD),g' \
$< > $@
# create commented version of doxygen configuration
doxycomm.xxx: doxydoc.cfg
/bin/cp -vf $< $@; doxygen -u $@
$(DOXYWWWPATH)/html/index.html: doxydoc.xxx $(DOXYSRC)
mkdir -vp $(DOXYWWWPATH)
......
......@@ -266,6 +266,9 @@ PWD=$(shell env pwd)
doxydoc.xxx: doxydoc.cfg
sed 's,<OUTPUTDIRECTORY>,$(DOXYWWWPATH),g;s,<STRIPFROMPATH>,$(PWD),g' \
$< > $@
# create commented version of doxygen configuration
doxycomm.xxx: doxydoc.cfg
/bin/cp -vf $< $@; doxygen -u $@
$(DOXYWWWPATH)/html/index.html: doxydoc.xxx $(DOXYSRC)
mkdir -vp $(DOXYWWWPATH)
......
This diff is collapsed.
......@@ -12,9 +12,35 @@
# ============================================================================
#
all:
all: install-include libfapidxx.a doxydoc
flist: Makefile
# check mandatory environment variable settings
# ---------------------------------------------
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))
$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)
INCINSTALLPATH=$(LOCINCLUDEDIR)/fapidxx
LIBINSTALLPATH=$(LOCLIBDIR)
HEADERS=$(wildcard *.h)
CCSRC=$(wildcard *.cc)
FSRC=$(wildcard *.f)
SRC=$(CCSRC)
README=README
FLAGS += $(MYFLAGS)
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
CFLAGS += $(FLAGS)
CXXFLAGS+=-Wall $(FLAGS)
LDFLAGS+=-L$(LOCLIBDIR)
CPPFLAGS+=-I$(LOCINCLUDEDIR) $(FLAGS)
#----------------------------------------------------------------------
flist: Makefile $(HEADERS) $(README) $(SRC) doxydoc.cfg $(FSRC)
echo $^ | tr ' ' '\n' | sort > $@
.PHONY: edit
......@@ -23,7 +49,133 @@ edit: flist; vim $<
.PHONY: clean
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist
-/bin/rm -vf flist *.o fapidtest
#======================================================================
# dependencies
# ------------
#
# The compiler is used to create dependency files, which are included below.
%.d: %.cc
$(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
%.d: %.c
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
-include $(patsubst %.cc,%.d,$(SRCFILES))
#======================================================================
# header files
# ------------
#
# Since we extensively document the class structures within the header files,
# these should be stripped for the production version (otherwise the compiler
# has to scan all comments on each compile). Stripping is done by the rule
# below and is controlled by the variables REMCMMNT and EMPTYPRINT (see
# above).
# comment stripping
# -----------------
EMPTYPRINT=0
$(call CHECKVARS,TF_REMCMMNT EMPTYPRINT)
# awk rule assumes that the first non-comment line starts with '#'
# and that the first (copyright) comment end with pattern "^ */"
%.h.strip: %.h
awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\
/^#/ { hot=0; } \
{ if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@
$(TF_REMCMMNT) $< | awk 'BEGIN {hot=0;} \
/^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print ""; } next; } \
/^#/ { hot=1; } { if (hot) print; }' >> $@
#----------------------------------------------------------------------
.PRECIOUS: %.h.strip
$(call CHECKVAR,INCINSTALLPATH)
$(INCINSTALLPATH)/%.h: %.h.strip
mkdir -vp $(dir $@)
-rm -fv $@
/bin/cp -vpd $< $@
# install header files
# INSTHEADER contains full qualified paths to library header files
# like /home/thof/include/aff/series.h
# usually then INCINSTALLPATH=/home/thof/include/aff
INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(HEADERS))
.PHONY: install-include
install-include: $(INSTHEADER)
#======================================================================
# create the binary library
# -------------------------
LIBOBS=$(patsubst %.cc,%.o,$(SRC))
# INSTHEADER contains full qualified paths to library header files
# like /home/thof/include/aff/series.h
libfapidxx.a: $(INSTHEADER) $(LIBOBS)
ar rcv $@ $(LIBOBS)
ranlib $@
/bin/mv -vf $@ $(LIBINSTALLPATH)
#======================================================================
# documentation part
# ------------------
#
# targets commonly used:
# ----------------------
#
# make doxyclean removes all documentation
# make doxydoc creates doxygen documentation in the DOXYWWWPATH
# make doxyview creates doxygen documentation and launches netscape to
# browse in the documentation
# make doxyconf edit the doxygen configuration file
#
# If you launch "make doxydoc" the documentation will be written to
# DOXYWWWPATH (see below). This is meant to export the documentation through
# your homepage. The doxyfull directory is just a symbolic link to this
# directory.
#
$(call CHECKVARS,TF_WWWBASEDIR TF_BROWSER)
DOXYWWWPATH=$(TF_WWWBASEDIR)/libfapidxx
.PHONY: doxyclean doxyview doxydoc doxyconf
doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH)
DOXYSRC=$(README) $(HEADERS) $(SRC)
# create doxygen intermediate configuration
PWD=$(shell env pwd)
doxydoc.xxx: doxydoc.cfg
sed 's,<OUTPUTDIRECTORY>,$(DOXYWWWPATH),g;s,<STRIPFROMPATH>,$(PWD),g' \
$< > $@
# create commented version of doxygen configuration
doxycomm.xxx: doxydoc.cfg
/bin/cp -vf $< $@; doxygen -u $@
$(DOXYWWWPATH)/html/index.html: doxydoc.xxx $(DOXYSRC)
mkdir -vp $(DOXYWWWPATH)
doxygen $<
doxydoc: $(DOXYWWWPATH)/html/index.html
doxyview: $(DOXYWWWPATH)/html/index.html
$(TF_BROWSER) file:$< &
#======================================================================
# test code
fapidtest: fapidtest.o libfapidxx.a
$(FC) -o $@ $< -lfapidxx -ltf -L$(LOCLIBDIR) -lstdc++
# ----- END OF Makefile -----
/*! \file README
* \brief documentation for fapi (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 17/11/2010
*
* documentation for fapi
*
* Copyright (c) 2010 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 17/11/2010 V1.0 Thomas Forbriger
*
* ============================================================================
*/
/*! \mainpage
The aim of this library is to provide Fortran 77 code written to be linked
against libsff.a with the full functionality in libdatreadxx.a and
libdatwritexx.a
Issues covered by this documentation:
\li \ref page_interlanguage_programming
My TODO:
refract requires only three functions:
\verbatim
sub/refract_readdata.o: In function `readdata_':
refract_readdata.f:(.text+0x43a): undefined reference to `sff_ropens__'
refract_readdata.f:(.text+0x68f): undefined reference to `sff_rtracei__'
sub/refract_skipdata.o: In function `skipdata_':
refract_skipdata.f:(.text+0x30): undefined reference to `sff_skipdata__'
collect2: ld returned 1 exit status
make: *** [refractx] Error 1
\endverbatim
We additionally have to provide an sff_close function
*/
/*======================================================================*/
/*! \page page_interlanguage_programming Interlanguage programming
In the case of this library Fortran programs will call C++ functions.
A simple example is given here.
\section sec_pip_code The code
The C++ header file \c cxxfunc.h contains:
\code
#include <string>
namespace fapidxx {
int cxxfunction(const std::string& s);
} // namespace fapidxx
\endcode
The corresponding definition of the function is provided in
\c cxxfunc.cc:
\code
#include <cxxfunc.h>
namespace fapidxx {
int cxxfunction(const std::string& s)
{
int retval=s.size();
return(retval);
} // int cxxfunction(const std::string& s)
} // namespace fapidxx
\endcode
The Fortran interface function is declared in \c cxxiface.h:
\code
extern "C" int interfacesub_(float *value);
\endcode
The body of the function is defined in \c cxxiface.cc:
\code
#include <cxxfunc.h>
#include <cxxiface.h>
int interfacesub_(float *value)
{
int retval=0;
std::string chars="hi there 12345678";
*value=int(fapidxx::cxxfunction(chars));
return(retval);
} // int interfacesub_(float *value)
\endcode
In the Fortran main program \c fprog.f this function is called:
\code
program fapidtest
real a
call interfacesub(a)
print *,a
stop
end
\endcode
\section sec_pip_compiling Compiling and linking the code
Compiling the library:
\verbatim
P> g++ -c -o cxxfunc.o cxxfunc.cc
P> g++ -c -o cxxiface.o cxxiface.cc
P> ar rc libiface.a cxxfunc.o cxxiface.o
P> gfortran -ff2c -Wall -c -o fprog.o fprog.f
P> gfortran -o fprog fprog.o -liface ­lstdc++
\endverbatim
Calling \c fprog will produce the output:
\verbatim
P> fprog
17.000000
\endverbatim
*/
/* ----- END OF README ----- */
# Doxyfile 1.6.3
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Fortran SFF API to data I/O streams in C++"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = <OUTPUTDIRECTORY>
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = <STRIPFROMPATH>
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = YES
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = YES
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = YES
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT =
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.cc *.f \
*.h \
README
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# 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_FOOTER_DESCRIPTION= NO
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_TIMESTAMP = YES
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE =
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = ALL
USE_INLINE_TREES = NO
TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# 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 =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
DOT_FONTNAME = FreeSans
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
/*! \file error.cc
* \brief exceptions and error handling macros (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 27/11/2002
*
* exceptions and error handling macros (implementation)
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* ----
* 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
* - 18/11/2010 V1.0 Thomas Forbriger
* copied from libtfxx
*
* ============================================================================
*/
#define FAPIDXX_ERROR_CC_VERSION \
"FAPIDXX_ERROR_CC V1.0"
#define FAPIDXX_ERROR_CC_CVSID \
"$Id$"
#include <iostream>
#include <fapidxx/error.h>
using std::cerr;
using std::endl;