Skip to content
Snippets Groups Projects
Commit ddfe21dc authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added make_cdilib_nc

parent a70ff7ff
No related branches found
No related tags found
No related merge requests found
......@@ -272,6 +272,7 @@ src/iterator_fallback.h -text
src/iterator_grib.c -text
src/iterator_grib.h -text
src/make_cdilib -text
src/make_cdilib_nc -text
src/make_fint.c -text
src/mo_cdi.f90 -text
src/model.c -text
......
#!/bin/sh
#
# combine source code into one module
# easier to compile -- no make file needed
#
# pretty generic script -- just echos, cats and greps.
#
#
srcdir=.
if [ ! -z $1 ] ; then
srcdir=$1
fi
PROG=cdilib.c
echo "combining source code into one module"
echo "output is ${PROG}"
#set -x
rm -f ${PROG}
DATE=`date +%F`
if test -f ../configure.ac ; then
CDILIBVERSION=\"`sed -n '/^AC_INIT(/s/AC_INIT *( *[^,]*,[[ ]*\([^],]*\).*/\1/ p' ../configure.ac`\"
else
echo "error: cannot find configure.ac" >&2
exit 1
fi
cat > ${PROG} << EOR
/* Automatically generated by $USER at $DATE, do not edit */
/* CDILIB_VERSION=${CDILIBVERSION} */
/* netCDF only version !!! */
#define HAVE_LIBNETCDF
#ifdef _ARCH_PWR6
#pragma options nostrict
#endif
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <float.h>
#include <math.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifndef _SX
#include <aio.h>
#endif
#include <stdbool.h>
#include <assert.h>
#if defined (HAVE_LIBGRIB_API)
# include <grib_api.h>
#endif
#if defined (HAVE_MMAP)
# include <sys/mman.h> /* mmap() is defined in this header */
#endif
#if defined (HAVE_LIBPTHREAD)
# include <pthread.h>
#endif
#if defined (HAVE_LIBSZ)
# include <szlib.h>
#endif
static void tableDefault(void) {}
EOR
files="basetime.c \
calendar.c \
cdf.c \
cdf_int.c \
cdi_cksum.c \
cdi_error.c \
cdi_int.c \
cdi_util.c \
cksum.c \
dmemory.c \
error.c \
file.c \
gaussgrid.c \
grid.c \
institution.c \
model.c \
namespace.c \
referenceCounting.c \
resource_handle.c \
serialize.c \
stream.c \
stream_write.c \
stream_read.c \
stream_cdf.c \
stream_history.c \
stream_record.c \
stream_var.c \
cdf_write.c \
cdf_read.c \
subtype.c \
table.c \
taxis.c \
timebase.c \
tsteps.c \
util.c \
varscan.c \
vlist.c \
vlist_att.c \
vlist_var.c \
zaxis.c"
car () {
echo "$1"
}
cdr () {
shift
echo "$@"
}
listIncludes () {
grep '^ *# *include *"' "$1" | sed 's/^ *# *include *"\(.*\)".*$/\1/'
}
scanlist="$files"
fileList=
until test "foo$scanlist" = "foo" ; do
curFile="$(car $scanlist)"
scanlist="$(cdr $scanlist)"
case $curFile in
(\<*\>)
fileList="$fileList $(echo "$curFile" | sed 's/<\(.*\)>/\1/')"
;;
(*)
if echo "$fileList" | grep -q '\<'"$curFile"'\>' ; then
true #Nothing to do, we have already scanned this header.
else
#Prepend the includes of the current header to the scanlist so that we will scan them in the order that the preprocessor would.
scanlist="$(listIncludes "$curFile") <$curFile> $scanlist"
fi
;;
esac
done
echo file list:
echo $fileList
for file in $fileList ; do
if [ "$file" = "config.h" -o "$file" = "cgribex.h" -o "$file" = "gribapi.h" -o "$file" = "table.h" ] ; then
echo "skipped file: $file"
else
cat $srcdir/$file | grep -v '^ *# *include *"' >> ${PROG}
fi
done
cpp -P -DVERSION="${CDILIBVERSION}" -DCDI_H_ \
$srcdir/version.c >>${PROG}
exit
......@@ -144,6 +144,7 @@ int cdiGetFiletype(const char *filename, int *byteorder)
if ( CDI_Debug ) Message("found IEG file = %s", filename);
}
#endif
#if defined (HAVE_LIBCGRIBEX)
else if ( gribCheckSeek(fileID, &recpos, &version) == 0 )
{
if ( version <= 1 )
......@@ -157,6 +158,7 @@ int cdiGetFiletype(const char *filename, int *byteorder)
if ( CDI_Debug ) Message("found seeked GRIB2 file = %s", filename);
}
}
#endif
fileClose(fileID);
......@@ -1576,10 +1578,14 @@ cdiStreamSetupVlist_(stream_t *streamptr, int vlistID)
}
break;
#endif
#ifdef HAVE_LIBGRIB
case FILETYPE_GRB:
case FILETYPE_GRB2:
gribContainersNew(streamptr);
break;
#endif
default:
;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment