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

Added ruby and python interfaces

parent a07d3801
2009-11-17 Ralf Mueller <Ralf.Mueller@zmaw.de>
* Added ruby and python interfaces
2009-11-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2009-11-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdi.h: added '_vec' to all int and double vector arguments * cdi.h: added '_vec' to all int and double vector arguments
......
...@@ -732,6 +732,8 @@ WITH_RUBY_FALSE ...@@ -732,6 +732,8 @@ WITH_RUBY_FALSE
PYTHON PYTHON
WITH_PYTHON_TRUE WITH_PYTHON_TRUE
WITH_PYTHON_FALSE WITH_PYTHON_FALSE
CREATE_INTERFACES_TRUE
CREATE_INTERFACES_FALSE
LIBOBJS LIBOBJS
LTLIBOBJS' LTLIBOBJS'
ac_subst_files='' ac_subst_files=''
...@@ -7781,6 +7783,15 @@ else ...@@ -7781,6 +7783,15 @@ else
WITH_PYTHON_FALSE= WITH_PYTHON_FALSE=
fi fi
# ----------------------------------------------------------------------
if test "x$use_ruby" = "xYes" -o "x$use_python" = "xYes"; then
CREATE_INTERFACES_TRUE=
CREATE_INTERFACES_FALSE='#'
else
CREATE_INTERFACES_TRUE='#'
CREATE_INTERFACES_FALSE=
fi
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Compile interface with internal EXTRA library # Compile interface with internal EXTRA library
# #
...@@ -8688,6 +8699,13 @@ echo "$as_me: error: conditional \"WITH_PYTHON\" was never defined. ...@@ -8688,6 +8699,13 @@ echo "$as_me: error: conditional \"WITH_PYTHON\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;} Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; } { (exit 1); exit 1; }; }
fi fi
if test -z "${CREATE_INTERFACES_TRUE}" && test -z "${CREATE_INTERFACES_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CREATE_INTERFACES\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"CREATE_INTERFACES\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
: ${CONFIG_STATUS=./config.status} : ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files ac_clean_files_save=$ac_clean_files
...@@ -9384,11 +9402,13 @@ WITH_RUBY_FALSE!$WITH_RUBY_FALSE$ac_delim ...@@ -9384,11 +9402,13 @@ WITH_RUBY_FALSE!$WITH_RUBY_FALSE$ac_delim
PYTHON!$PYTHON$ac_delim PYTHON!$PYTHON$ac_delim
WITH_PYTHON_TRUE!$WITH_PYTHON_TRUE$ac_delim WITH_PYTHON_TRUE!$WITH_PYTHON_TRUE$ac_delim
WITH_PYTHON_FALSE!$WITH_PYTHON_FALSE$ac_delim WITH_PYTHON_FALSE!$WITH_PYTHON_FALSE$ac_delim
CREATE_INTERFACES_TRUE!$CREATE_INTERFACES_TRUE$ac_delim
CREATE_INTERFACES_FALSE!$CREATE_INTERFACES_FALSE$ac_delim
LIBOBJS!$LIBOBJS$ac_delim LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 23; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 25; then
break break
elif $ac_last_try; then elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
......
...@@ -293,6 +293,8 @@ else ...@@ -293,6 +293,8 @@ else
fi fi
AM_CONDITIONAL(WITH_PYTHON, [test "x$use_python" = "xYes"]) AM_CONDITIONAL(WITH_PYTHON, [test "x$use_python" = "xYes"])
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
AM_CONDITIONAL(CREATE_INTERFACES, [test "x$use_ruby" = "xYes" -o "x$use_python" = "xYes"])
# ----------------------------------------------------------------------
# Compile interface with internal EXTRA library # Compile interface with internal EXTRA library
# #
AC_ARG_WITH([extra], AC_ARG_WITH([extra],
......
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
SWIGCDILIB = cdilib.i SWIGCDILIB = cdilib.i
SWIGCDIOBJ = cdiobj.i SWIGCDIOBJ = cdiobj.i
BINDINGS = BINDINGS =
if CREATE_INTERFACES
BINDINGS += help
endif
# #
bin_PROGRAMS = bin_PROGRAMS =
# #
noinst_PROGRAMS = noinst_PROGRAMS =
if WITH_RUBY if CREATE_INTERFACES
noinst_PROGRAMS += CdiInfo noinst_PROGRAMS += CdiInfo
endif endif
# #
...@@ -17,10 +20,6 @@ CdiInfo_LDADD = ../src/cdilib.o $(LDFLAGS) $(LIBS) ...@@ -17,10 +20,6 @@ CdiInfo_LDADD = ../src/cdilib.o $(LDFLAGS) $(LIBS)
# #
if WITH_RUBY if WITH_RUBY
BINDINGS += rubyObj BINDINGS += rubyObj
if WITH_PYTHON
else
BINDINGS += help
endif
# Ruby ==================================================== # Ruby ====================================================
rubyLibMakefile: rubyLibMakefile:
cd ruby; CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I../../src" ruby extconfLib.rb cd ruby; CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I../../src" ruby extconfLib.rb
...@@ -55,7 +54,7 @@ rubyObjInstall: rubyObj ...@@ -55,7 +54,7 @@ rubyObjInstall: rubyObj
endif endif
# ========================================================= # =========================================================
if WITH_PYTHON if WITH_PYTHON
BINDINGS += pythonObj help BINDINGS += pythonObj
# Python ================================================== # Python ==================================================
pythonLibWrapper: cdilib.i pythonLibWrapper: cdilib.i
if WITH_SWIG if WITH_SWIG
......
...@@ -33,14 +33,14 @@ POST_UNINSTALL = : ...@@ -33,14 +33,14 @@ POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
target_triplet = @target@ target_triplet = @target@
@CREATE_INTERFACES_TRUE@am__append_1 = help
bin_PROGRAMS = bin_PROGRAMS =
noinst_PROGRAMS = $(am__EXEEXT_1) noinst_PROGRAMS = $(am__EXEEXT_1)
@WITH_RUBY_TRUE@am__append_1 = CdiInfo @CREATE_INTERFACES_TRUE@am__append_2 = CdiInfo
# #
@WITH_RUBY_TRUE@am__append_2 = rubyObj @WITH_RUBY_TRUE@am__append_3 = rubyObj
@WITH_PYTHON_FALSE@@WITH_RUBY_TRUE@am__append_3 = help
# ========================================================= # =========================================================
@WITH_PYTHON_TRUE@am__append_4 = pythonObj help @WITH_PYTHON_TRUE@am__append_4 = pythonObj
subdir = interfaces subdir = interfaces
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
...@@ -53,7 +53,7 @@ CONFIG_HEADER = $(top_builddir)/src/config.h ...@@ -53,7 +53,7 @@ CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
@WITH_RUBY_TRUE@am__EXEEXT_1 = CdiInfo$(EXEEXT) @CREATE_INTERFACES_TRUE@am__EXEEXT_1 = CdiInfo$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_CdiInfo_OBJECTS = CdiInfo.$(OBJEXT) cdi.$(OBJEXT) am_CdiInfo_OBJECTS = CdiInfo.$(OBJEXT) cdi.$(OBJEXT)
CdiInfo_OBJECTS = $(am_CdiInfo_OBJECTS) CdiInfo_OBJECTS = $(am_CdiInfo_OBJECTS)
...@@ -191,7 +191,7 @@ top_srcdir = @top_srcdir@ ...@@ -191,7 +191,7 @@ top_srcdir = @top_srcdir@
# #
SWIGCDILIB = cdilib.i SWIGCDILIB = cdilib.i
SWIGCDIOBJ = cdiobj.i SWIGCDIOBJ = cdiobj.i
BINDINGS = $(am__append_2) $(am__append_3) $(am__append_4) BINDINGS = $(am__append_1) $(am__append_3) $(am__append_4)
# #
CdiInfo_SOURCES = CdiInfo.cpp cdi.cpp CdiInfo_SOURCES = CdiInfo.cpp cdi.cpp
# #
......
...@@ -2537,7 +2537,7 @@ int cdfDefVar(int streamID, int varID) ...@@ -2537,7 +2537,7 @@ int cdfDefVar(int streamID, int varID)
int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID, tid = UNDEFID; int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID, tid = UNDEFID;
size_t xsize = 0, ysize = 0; size_t xsize = 0, ysize = 0;
int code, gridID, zaxisID; int code, gridID, zaxisID;
char varname[9]; char varname[256];
char *name = NULL; char *name = NULL;
char *longname = NULL; char *longname = NULL;
char *stdname = NULL; char *stdname = NULL;
...@@ -2615,7 +2615,39 @@ int cdfDefVar(int streamID, int varID) ...@@ -2615,7 +2615,39 @@ int cdfDefVar(int streamID, int varID)
if ( name == NULL ) name = tableInqParNamePtr(tableID, code); if ( name == NULL ) name = tableInqParNamePtr(tableID, code);
if ( longname == NULL ) longname = tableInqParLongnamePtr(tableID, code); if ( longname == NULL ) longname = tableInqParLongnamePtr(tableID, code);
if ( units == NULL ) units = tableInqParUnitsPtr(tableID, code); if ( units == NULL ) units = tableInqParUnitsPtr(tableID, code);
if ( name == NULL ) if ( name )
{
int checkname;
int iz;
int status;
sprintf(varname, "%s", name);
checkname = TRUE;
iz = 0;
while ( checkname )
{
if ( iz ) sprintf(varname, "%s_%d", name, iz+1);
status = nc_inq_varid(fileID, varname, &ncvarid);
if ( status != NC_NOERR )
{
checkname = FALSE;
}
if ( checkname ) iz++;
if ( iz > 99 )
Error(func, "Double entry of variable name '%s'!", name);
}
if ( strcmp(name, varname) != 0 )
Warning(func, "Changed double entry of variable name '%s' to '%s'!", name, varname);
name = varname;
}
else
{ {
int checkname; int checkname;
int iz; int iz;
......
...@@ -745,6 +745,7 @@ void gribapiScanTimestep1(int streamID) ...@@ -745,6 +745,7 @@ void gribapiScanTimestep1(int streamID)
GRIB_CHECK(grib_get_long(gh, "parameterNumber", &lpar), 0); GRIB_CHECK(grib_get_long(gh, "parameterNumber", &lpar), 0);
rcode = (int) lpar; rcode = (int) lpar;
status = grib_get_long(gh, "typeOfFirstFixedSurface", &lpar); status = grib_get_long(gh, "typeOfFirstFixedSurface", &lpar);
if ( status == 0 ) if ( status == 0 )
{ {
......
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