Commit c02b2f69 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Merge branch 'develop' of git.mpimet.mpg.de:cdo into develop

parents fb4717c4 04ee03f5
# Makefile.in generated by automake 1.14 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -14,7 +14,17 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
......@@ -78,19 +88,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(top_srcdir)/config/mkinstalldirs $(srcdir)/cdo.spec.in \
$(srcdir)/cdo.settings.in AUTHORS COPYING ChangeLog INSTALL \
NEWS README config/ar-lib config/compile config/config.guess \
config/config.sub config/depcomp config/install-sh \
config/missing config/mkinstalldirs config/ltmain.sh \
$(top_srcdir)/config/ar-lib $(top_srcdir)/config/compile \
$(top_srcdir)/config/config.guess \
$(top_srcdir)/config/config.sub \
$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
$(top_srcdir)/config/missing \
$(top_srcdir)/config/tap-driver.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
......@@ -101,6 +98,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
......@@ -163,6 +162,18 @@ ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/cdo.settings.in \
$(srcdir)/cdo.spec.in $(top_srcdir)/config/ar-lib \
$(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
$(top_srcdir)/config/config.sub \
$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
$(top_srcdir)/config/missing \
$(top_srcdir)/config/mkinstalldirs \
$(top_srcdir)/config/tap-driver.sh AUTHORS COPYING ChangeLog \
INSTALL NEWS README config/ar-lib config/compile \
config/config.guess config/config.sub config/depcomp \
config/install-sh config/ltmain.sh config/missing \
config/mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
......@@ -407,7 +418,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
......@@ -611,7 +621,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
......@@ -627,17 +637,17 @@ dist-xz: distdir
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
......@@ -655,7 +665,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
......@@ -665,22 +675,23 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
......@@ -857,6 +868,8 @@ uninstall-am:
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
......
......@@ -162,6 +162,7 @@ libcdo_la_SOURCES = \
uthash.h \
util.cc \
util.h \
varlist.h \
zaxis_print.cc \
zaxis.cc
libcdo_la_SOURCES += \
......
# Makefile.in generated by automake 1.14 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
 
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -16,7 +16,17 @@
 
 
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
......@@ -84,9 +94,6 @@ bin_PROGRAMS = cdo$(EXEEXT)
noinst_PROGRAMS = cdotest$(EXEEXT)
@ENABLE_ALL_STATIC_TRUE@am__append_2 = -all-static
subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/config.h.in $(top_srcdir)/config/mkinstalldirs \
$(top_srcdir)/config/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
......@@ -97,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
......@@ -355,6 +363,9 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/config/depcomp \
$(top_srcdir)/config/mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
......@@ -569,8 +580,8 @@ libcdo_la_SOURCES = array.h array.cc cdo_int.h compare.h \
remap_bicubic_scrip.cc remap_bilinear_scrip.cc stdnametable.cc \
stdnametable.h specspace.cc specspace.h statistic.cc \
statistic.h table.cc text.cc text.h timebase.h timer.cc \
userlog.cc uthash.h util.cc util.h zaxis_print.cc zaxis.cc \
json/jsmn.h json/jsmn.c kdtreelib/kdtree.h \
userlog.cc uthash.h util.cc util.h varlist.h zaxis_print.cc \
zaxis.cc json/jsmn.h json/jsmn.c kdtreelib/kdtree.h \
kdtreelib/kdtree_cartesian.cc kdtreelib/kdtree_common.cc \
kdtreelib/kdtree_spherical.cc kdtreelib/qsort.cc \
kdtreelib/pmergesort.cc kdtreelib/pqueue.cc kdtreelib/pqueue.h \
......@@ -669,7 +680,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
......@@ -5037,6 +5047,8 @@ uninstall-am: uninstall-binPROGRAMS
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-binPROGRAMS
 
.PRECIOUS: Makefile
#
clean-local: clean-local-dirs
.PHONY: clean-local-dirs
......
......@@ -29,44 +29,10 @@
#include <pthread.h>
#include "pthread_debug.h"
#include "pstream.h"
#endif
typedef struct {
bool check_datarange;
int gridsize;
int datatype;
double missval;
double addoffset;
double scalefactor;
} varlist_t;
typedef struct {
int self;
int mode;
int fileID;
int vlistID;
int tsID;
int filetype;
int tsID0;
int mfiles;
int nfiles;
int varID; /* next varID defined with streamDefVar */
bool ispipe;
bool isopen;
char *name;
char **mfnames;
varlist_t *varlist;
#if defined(HAVE_LIBPTHREAD)
void *argument;
struct pipe_s *pipe;
pthread_t rthreadID; /* read thread ID */
pthread_t wthreadID; /* write thread ID */
#endif
} pstream_t;
#if defined(HAVE_LIBPTHREAD)
struct pipe_s {
......
......@@ -40,6 +40,7 @@
#include "util.h"
#include "pstream_int.h"
#include "dmemory.h"
#include "pthread.h"
#if defined(HAVE_LIBPTHREAD)
pthread_mutex_t processMutex = PTHREAD_MUTEX_INITIALIZER;
......@@ -385,29 +386,6 @@ const char *processOperator(void)
return Process[processID].xoperator;
}
static
char *getOperatorArg(const char *xoperator)
{
char *operatorArg = NULL;
if ( xoperator )
{
char *commapos = (char *)strchr(xoperator, ',');
if ( commapos )
{
size_t len = strlen(commapos+1);
if ( len )
{
operatorArg = (char*) Malloc(len+1);
strcpy(operatorArg, commapos+1);
}
}
}
return operatorArg;
}
static int skipInputStreams(int argc, char *argv[], int globArgc, int nstreams);
static
......@@ -1000,3 +978,36 @@ int cdoStreamNumber()
return operatorStreamNumber(Process[processID].operatorName);
}
void print_process(int p_process_id)
{
#if defined(HAVE_LIBPTHREAD)
std::cout << " threadID : " << Process[p_process_id].threadID << std::endl;
std::cout << " l_threadID : " << Process[p_process_id].l_threadID << std::endl;
#endif
std::cout << " nchild : " << Process[p_process_id].nchild << std::endl;
std::cout << " nInStream : " << Process[p_process_id].nInStream << std::endl;
std::cout << " nOutStream : " << Process[p_process_id].nOutStream << std::endl;
for(int i = 0; i < Process[p_process_id].nInStream; i++){
std::cout << " " << Process[p_process_id].inputStreams[i] << std::endl;
}
for(int i = 0; i < Process[p_process_id].nOutStream; i++){
std::cout << " " << Process[p_process_id].outputStreams[i] << std::endl;
}
std::cout << " s_utime : " << Process[p_process_id].s_utime << std::endl;
std::cout << " s_stime : " << Process[p_process_id].s_stime << std::endl;
std::cout << " a_utime : " << Process[p_process_id].a_utime << std::endl;
std::cout << " a_stime : " << Process[p_process_id].a_stime << std::endl;
std::cout << " cputime : " << Process[p_process_id].cputime << std::endl;
std::cout << " nvals : " << Process[p_process_id].nvals << std::endl;
std::cout << " nvars : " << Process[p_process_id].nvars << std::endl;
std::cout << " ntimesteps : " << Process[p_process_id].ntimesteps << std::endl;
std::cout << " streamCnt : " << Process[p_process_id].streamCnt << std::endl;
std::cout << " streamNames : " << Process[p_process_id].streamNames << std::endl;
std::cout << " xoperator : " << Process[p_process_id].xoperator << std::endl;
std::cout << " operatorName : " << Process[p_process_id].operatorName << std::endl;
std::cout << " operatorArg : " << Process[p_process_id].operatorArg << std::endl;
std::cout << " oargc : " << Process[p_process_id].oargc << std::endl;
std::cout << " noper : " << Process[p_process_id].noper << std::endl;
}
......@@ -104,4 +104,5 @@ const char *processInqOpername(void);
const char *processInqOpername2(int processID);
const char *processInqPrompt(void);
void print_process(int p_process_id);
#endif /* _PROCESS_H */
......@@ -290,12 +290,12 @@ static void createPipeName(char *pipename, int pnlen){
snprintf(pipename, pnlen, "(pipe%d.%d)", processSelf() + 1, processInqChildNum() + 1);
}
static pthread_t pCreateReadThread(char *newarg, argument_t *argument, const char *operatorName){
pthread_t pCreateReadThread(argument_t *argument){
pthread_attr_t attr;
int status = pthread_attr_init(&attr);
if ( status ) SysError("pthread_attr_init failed for '%s'", newarg+1);
if ( status ) SysError("pthread_attr_init failed for '%s'", argument->operatorName);
status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
if ( status ) SysError("pthread_attr_setdetachstate failed for '%s'", newarg+1);
if ( status ) SysError("pthread_attr_setdetachstate failed for '%s'", argument->operatorName);
/*
param.sched_priority = 0;
status = pthread_attr_setschedparam(&attr, &param);
......@@ -320,11 +320,11 @@ static pthread_t pCreateReadThread(char *newarg, argument_t *argument, const cha
}
pthread_t thrID;
int rval = pthread_create(&thrID, &attr, operatorModule(operatorName), argument);
int rval = pthread_create(&thrID, &attr, operatorModule(argument->operatorName.c_str()), argument);
if ( rval != 0 )
{
errno = rval;
SysError("pthread_create failed for '%s'", newarg+1);
SysError("pthread_create failed for '%s'", argument->operatorName);
}
return thrID;
}
......@@ -339,9 +339,10 @@ void pstreamOpenReadPipe(const argument_t *argument, pstream_t *pstreamptr)
char *pipename = (char*) Malloc(pnlen);
// struct sched_param param;
argument_t *newargument = (argument_t*) Malloc(sizeof(argument_t));
argument_t *newargument = new argument_t();
newargument->argc = argument->argc + 1;
newargument->argv = (char **) Malloc(newargument->argc*sizeof(char *));
newargument->operatorName = "";
memcpy(newargument->argv, argument->argv, argument->argc*sizeof(char *));
char *operatorArg = argument->argv[0];
......@@ -356,6 +357,7 @@ void pstreamOpenReadPipe(const argument_t *argument, pstream_t *pstreamptr)
newargument->argv[argument->argc] = pipename;
newargument->args = newarg;
newargument->operatorName = std::string(operatorName,strlen(operatorName));
/*
printf("pstreamOpenRead: new args >%s<\n", newargument->args);
for ( int i = 0; i < newargument->argc; ++i )
......@@ -370,7 +372,7 @@ void pstreamOpenReadPipe(const argument_t *argument, pstream_t *pstreamptr)
if ( ! cdoSilentMode ){
cdoPrint("Started child process \"%s\".", newarg+1);
}
pCreateReadThread(newarg, newargument, operatorName);
pCreateReadThread(newargument);
/* Free(operatorName); */
processAddInputStream(pstreamID);
/* pipeInqInfo(pstreamID); */
......@@ -887,7 +889,7 @@ void pstreamClose(int pstreamID)
argument_t *argument = (argument_t *) (pstreamptr->argument);
if ( argument->argv ) Free(argument->argv);
if ( argument->args ) Free(argument->args);
Free(argument);
delete(argument);
}
vlistDestroy(pstreamptr->vlistID);
pthread_mutex_unlock(pipe->mutex);
......
......@@ -19,9 +19,34 @@
#define PSTREAM_H
#include "pstream_write.h"
#include "varlist.h"
#include <sys/types.h> /* off_t */
typedef struct {
int self;
int mode;
int fileID;
int vlistID;
int tsID;
int filetype;
int tsID0;
int mfiles;
int nfiles;
int varID; /* next varID defined with streamDefVar */
bool ispipe;
bool isopen;
char *name;
char **mfnames;
varlist_t *varlist;
#if defined(HAVE_LIBPTHREAD)
void *argument;
struct pipe_s *pipe;
pthread_t rthreadID; /* read thread ID */
pthread_t wthreadID; /* write thread ID */
#endif
} pstream_t;
int pstreamOpenRead(const argument_t *argument);
int pstreamOpenAppend(const argument_t *argument);
void pstreamClose(int pstreamID);
......
......@@ -22,5 +22,6 @@
void pstreamDebug(int debug);
int pstreamIsPipe(int streamID);
pthread_t pCreateReadThread(argument_t *argument);
#endif /* _PSTREAM_INT_H */
......@@ -116,8 +116,6 @@ const char *cdoExpName = NULL;
int timer_read, timer_write;
const char *cdoComment(void)
{
static char comment[256];
......@@ -245,6 +243,28 @@ const char *getOperatorName(const char *operatorArg)
return operatorName;
}
char *getOperatorArg(const char *xoperator)
{
char *operatorArg = NULL;
if ( xoperator )
{
char *commapos = (char *)strchr(xoperator, ',');
if ( commapos )
{
size_t len = strlen(commapos+1);
if ( len )
{
operatorArg = (char*) Malloc(len+1);
strcpy(operatorArg, commapos+1);
}
}
}
return operatorArg;
}
argument_t *file_argument_new(const char *filename)
{
......@@ -923,3 +943,17 @@ void cdo_check_round(void)
}
}
}
void print_argument(argument_t * p_argument)
{
std::cout << "argv with " << p_argument->argc << " arguments:" << std::endl;
for(int i = 0; i < p_argument->argc; i++)
{
std::cout << p_argument->argv[i] << " ";
}
std::cout << std::endl;
std::cout << "OperatorName: "<< p_argument->operatorName << std::endl;
std::cout << "operatorArguments: " << p_argument->operatorArguments << std::endl;
}
......@@ -113,10 +113,12 @@ extern const char *CDO_Version;
typedef struct {
int process_id;
int argc;
int argl;
char **argv;
char *args;
std::string operatorName;
char * operatorArguments;
} argument_t;
argument_t *file_argument_new(const char *filename);
......@@ -126,8 +128,9 @@ void argument_free(argument_t *argument);
void argument_fill(argument_t *argument, int argc, char *argv[]);
char *getProgname(char *string);
char *getOperator(const char *argument);
char *GetOperator(const char *argument);
const char *getOperatorName(const char *xoperator);
char *getOperatorArg(const char *xoperator);
const char *cdoComment(void);
argument_t makeArgument(int argc, char *argv[]);
......@@ -235,4 +238,5 @@ int wildcardmatch(const char *w, const char *s);
void cdo_check_round(void);
void print_argument(argument_t *argument);
#endif /* _UTIL_H */
#ifndef VARLIST_H
#define VARLIST_H
typedef struct {
bool check_datarange;
int gridsize;
int datatype;
double missval;
double addoffset;
double scalefactor;
} varlist_t;
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment