Commit 66e8500a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdi_error: change return type to char*

parent 425ecc09
......@@ -4,6 +4,7 @@
* rename *New functions to *Create
* stream_ieg: multiply pressure levels with 100 (report: Holger Goettel)
* gridPrint: GME support
* cdi_error: change return type to char*
* add dummy functions gridDestroy, zaxisDestroy, taxisDestroy
* Version 1.0.0 released
......
......@@ -96,11 +96,11 @@ extern "C" {
/* CDI control routines */
const char *cdiStringError(int cdiErrno);
char *cdiStringError(int cdiErrno);
void cdiDebug(int debug);
const char *cdiLibraryVersion(void);
char *cdiLibraryVersion(void);
void cdiPrintVersion(void);
void cdiDefMissval(double missval);
......
......@@ -234,6 +234,14 @@
! INTEGER tsID)
EXTERNAL streamInqTimestep
CHARACTER*80 streamFilename
! (INTEGER streamID)
EXTERNAL streamFilename
CHARACTER*80 streamFilesuffix
! (INTEGER filetype)
EXTERNAL streamFilesuffix
INTEGER streamNtsteps
! (INTEGER streamID)
EXTERNAL streamNtsteps
......@@ -718,6 +726,10 @@
! CHARACTER*(*) gridname)
EXTERNAL gridName
CHARACTER*80 gridNamePtr
! (INTEGER gridtype)
EXTERNAL gridNamePtr
! gridCompress
! (INTEGER gridID)
EXTERNAL gridCompress
......@@ -1297,6 +1309,10 @@
! (INTEGER taxisID)
EXTERNAL taxisInqNumavg
CHARACTER*80 tunitNamePtr
! (INTEGER tunitID)
EXTERNAL tunitNamePtr
!
! Institut routines
!
......@@ -1325,6 +1341,14 @@
! (INTEGER instID)
EXTERNAL institutInqSubcenter
CHARACTER*80 institutInqNamePtr
! (INTEGER instID)
EXTERNAL institutInqNamePtr
CHARACTER*80 institutInqLongnamePtr
! (INTEGER instID)
EXTERNAL institutInqLongnamePtr
!
! Model routines
!
......@@ -1348,6 +1372,10 @@
! (INTEGER modelID)
EXTERNAL modelInqGribID
CHARACTER*80 modelInqNamePtr
! (INTEGER modelID)
EXTERNAL modelInqNamePtr
!
! Table routines
!
......@@ -1371,6 +1399,10 @@
! CHARACTER*(*) tablename)
EXTERNAL tableDef
CHARACTER*80 tableInqNamePtr
! (INTEGER tableID)
EXTERNAL tableInqNamePtr
! tableDefEntry
! (INTEGER tableID,
! INTEGER code,
......@@ -1428,6 +1460,21 @@
! CHARACTER*(*) units)
EXTERNAL tableInqParUnits
CHARACTER*80 tableInqParNamePtr
! (INTEGER tableID,
! INTEGER parID)
EXTERNAL tableInqParNamePtr
CHARACTER*80 tableInqParLongnamePtr
! (INTEGER tableID,
! INTEGER parID)
EXTERNAL tableInqParLongnamePtr
CHARACTER*80 tableInqParUnitsPtr
! (INTEGER tableID,
! INTEGER parID)
EXTERNAL tableInqParUnitsPtr
!
! History routines
!
......
......@@ -64,6 +64,8 @@ FCALLSCSUB2 (streamDefByteorder, STREAMDEFBYTEORDER, streamdefbyteorder, INT, IN
FCALLSCFUN1 (INT, streamInqByteorder, STREAMINQBYTEORDER, streaminqbyteorder, INT)
FCALLSCFUN2 (INT, streamDefTimestep, STREAMDEFTIMESTEP, streamdeftimestep, INT, INT)
FCALLSCFUN2 (INT, streamInqTimestep, STREAMINQTIMESTEP, streaminqtimestep, INT, INT)
FCALLSCFUN1 (STRING, streamFilename, STREAMFILENAME, streamfilename, INT)
FCALLSCFUN1 (STRING, streamFilesuffix, STREAMFILESUFFIX, streamfilesuffix, INT)
FCALLSCFUN1 (INT, streamNtsteps, STREAMNTSTEPS, streamntsteps, INT)
/* STREAM var I/O routines */
......@@ -166,6 +168,7 @@ FCALLSCFUN3 (INT, vlistFindLevel, VLISTFINDLEVEL, vlistfindlevel, INT, INT, INT)
/* GRID routines */
FCALLSCSUB2 (gridName, GRIDNAME, gridname, INT, PSTRING)
FCALLSCFUN1 (STRING, gridNamePtr, GRIDNAMEPTR, gridnameptr, INT)
FCALLSCSUB1 (gridCompress, GRIDCOMPRESS, gridcompress, INT)
FCALLSCSUB2 (gridDefMask, GRIDDEFMASK, griddefmask, INT, PINT)
FCALLSCFUN2 (INT, gridInqMask, GRIDINQMASK, gridinqmask, INT, PINT)
......@@ -298,6 +301,7 @@ FCALLSCFUN1 (INT, taxisInqRtime, TAXISINQRTIME, taxisinqrtime, INT)
FCALLSCFUN1 (INT, taxisInqCalendar, TAXISINQCALENDAR, taxisinqcalendar, INT)
FCALLSCFUN1 (INT, taxisInqTunit, TAXISINQTUNIT, taxisinqtunit, INT)
FCALLSCFUN1 (INT, taxisInqNumavg, TAXISINQNUMAVG, taxisinqnumavg, INT)
FCALLSCFUN1 (STRING, tunitNamePtr, TUNITNAMEPTR, tunitnameptr, INT)
/* Institut routines */
......@@ -306,6 +310,8 @@ FCALLSCFUN4 (INT, institutInq, INSTITUTINQ, institutinq, INT, INT, STRING, STRIN
FCALLSCFUN0 (INT, institutInqNumber, INSTITUTINQNUMBER, institutinqnumber)
FCALLSCFUN1 (INT, institutInqCenter, INSTITUTINQCENTER, institutinqcenter, INT)
FCALLSCFUN1 (INT, institutInqSubcenter, INSTITUTINQSUBCENTER, institutinqsubcenter, INT)
FCALLSCFUN1 (STRING, institutInqNamePtr, INSTITUTINQNAMEPTR, institutinqnameptr, INT)
FCALLSCFUN1 (STRING, institutInqLongnamePtr, INSTITUTINQLONGNAMEPTR, institutinqlongnameptr, INT)
/* Model routines */
......@@ -313,6 +319,7 @@ FCALLSCFUN3 (INT, modelDef, MODELDEF, modeldef, INT, INT, STRING)
FCALLSCFUN3 (INT, modelInq, MODELINQ, modelinq, INT, INT, PSTRING)
FCALLSCFUN1 (INT, modelInqInstitut, MODELINQINSTITUT, modelinqinstitut, INT)
FCALLSCFUN1 (INT, modelInqGribID, MODELINQGRIBID, modelinqgribid, INT)
FCALLSCFUN1 (STRING, modelInqNamePtr, MODELINQNAMEPTR, modelinqnameptr, INT)
/* Table routines */
......@@ -320,6 +327,7 @@ FCALLSCSUB2 (tableWriteC, TABLEWRITEC, tablewritec, STRING, INT)
FCALLSCSUB2 (tableWrite, TABLEWRITE, tablewrite, STRING, INT)
FCALLSCFUN1 (INT, tableRead, TABLEREAD, tableread, STRING)
FCALLSCFUN3 (INT, tableDef, TABLEDEF, tabledef, INT, INT, STRING)
FCALLSCFUN1 (STRING, tableInqNamePtr, TABLEINQNAMEPTR, tableinqnameptr, INT)
FCALLSCSUB5 (tableDefEntry, TABLEDEFENTRY, tabledefentry, INT, INT, STRING, STRING, STRING)
FCALLSCFUN3 (INT, tableInq, TABLEINQ, tableinq, INT, INT, STRING)
FCALLSCFUN0 (INT, tableInqNumber, TABLEINQNUMBER, tableinqnumber)
......@@ -330,6 +338,9 @@ FCALLSCFUN3 (INT, tableInqParCode, TABLEINQPARCODE, tableinqparcode, INT, PSTRIN
FCALLSCFUN3 (INT, tableInqParName, TABLEINQPARNAME, tableinqparname, INT, INT, PSTRING)
FCALLSCFUN3 (INT, tableInqParLongname, TABLEINQPARLONGNAME, tableinqparlongname, INT, INT, PSTRING)
FCALLSCFUN3 (INT, tableInqParUnits, TABLEINQPARUNITS, tableinqparunits, INT, INT, PSTRING)
FCALLSCFUN2 (STRING, tableInqParNamePtr, TABLEINQPARNAMEPTR, tableinqparnameptr, INT, INT)
FCALLSCFUN2 (STRING, tableInqParLongnamePtr, TABLEINQPARLONGNAMEPTR, tableinqparlongnameptr, INT, INT)
FCALLSCFUN2 (STRING, tableInqParUnitsPtr, TABLEINQPARUNITSPTR, tableinqparunitsptr, INT, INT)
/* History routines */
......
......@@ -7,22 +7,22 @@
#include "cdi.h"
static char UnknownError[] = "Unknown Error";
static char _EUFTYPE[] = "Unsupported file type";
static char _ELIBNAVAIL[] = "Unsupported file type (library not available)";
static char _EUFSTRUCT[] = "Unsupported file structure";
const char *cdiStringError(int cdiErrno)
char *cdiStringError(int cdiErrno)
{
switch (cdiErrno) {
case CDI_ESYSTEM:
{
const char *cp = (const char *) strerror(errno);
char *cp = (char *) strerror(errno);
if ( cp == NULL ) break;
return cp;
}
case CDI_EUFTYPE:
return "Unsupported file type";
case CDI_ELIBNAVAIL:
return "Unsupported file type (library not available)";
case CDI_EUFSTRUCT:
return "Unsupported file structure";
case CDI_EUFTYPE: return _EUFTYPE;
case CDI_ELIBNAVAIL: return _ELIBNAVAIL;
case CDI_EUFSTRUCT: return _EUFSTRUCT;
}
return UnknownError;
......
......@@ -74,7 +74,7 @@ void fortran_interface(char *fname, char *fnameinc, char *fnameint)
enum {ISVOID, ISSTRING, ISSTRINGP, ISINT, ISINTP, ISREAL, ISDOUBLE, ISDOUBLEP, ISCONSTSTRING};
char *f77name[] = {"", "CHARACTER*(*)", "CHARACTER*(*)", "INTEGER", "INTEGER", "REAL", "DOUBLEPRECISION", "DOUBLEPRECISION", "CHARACTER*80"};
char *cfint[] = {"", "STRING", "PSTRING", "INT", "PINT", "FLOAT", "DOUBLE", "PDOUBLE", "STRING"};
char *cname[] = {"void", "char *", "char *", "int", "int *", "float", "double", "double *", "const char *"};
char *cname[] = {"void", "char *", "char *", "int", "int *", "float", "double", "double *", "char *"};
char funcname[128];
char *funcargname[20];
int funcargtype[20];
......@@ -132,6 +132,7 @@ void fortran_interface(char *fname, char *fnameinc, char *fnameint)
funcargc = 0;
if ( strncmp(line, "int", 3) == 0 ||
strncmp(line, "void", 4) == 0 ||
strncmp(line, "char", 4) == 0 ||
strncmp(line, "const", 5) == 0 ||
strncmp(line, "double", 6) == 0 )
{
......@@ -166,6 +167,11 @@ void fortran_interface(char *fname, char *fnameinc, char *fnameint)
functype = ISDOUBLE;
pline += 6;
}
else if ( strncmp(line, "char*", 5) == 0 )
{
functype = ISCONSTSTRING;
pline += 5;
}
else if ( strncmp(line, "constchar*", 10) == 0 )
{
functype = ISCONSTSTRING;
......
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