Commit 1cf053d9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

rewrote the ISO_C_BINDING interface generator [patch 14/14 from Nathanael]

parent 5daea376
......@@ -141,7 +141,7 @@ void version(void)
static
void usage(void)
{
char *name;
const char *name;
int id;
fprintf(stderr, "usage : %s [Option] [ifile] [ofile]\n", Progname);
......
......@@ -11,7 +11,7 @@ PROGRAM CDIREADF2003
DOUBLE PRECISION, ALLOCATABLE :: field(:,:)
CHARACTER(kind=c_char), POINTER, DIMENSION(:) :: &
msg, cdi_version
CHARACTER(kind=c_char), DIMENSION(cdi_max_name + 1) :: &
CHARACTER(kind=c_char, LEN = cdi_max_name + 1) :: &
name, longname, units
INTEGER :: name_c_len, longname_c_len, units_c_len
......
......@@ -40,7 +40,8 @@ class CdiTaxis {
int ntsteps, unit;
int rdate, rtime, vdate, vtime;
int type, calendar, hasBounds;
char name[CHARSIZE], *unitname;
char name[CHARSIZE];
const char *unitname;
};
class CdiZaxis {
......
This diff is collapsed.
......@@ -225,7 +225,7 @@ extern "C" {
/* Structs that are used to return data to the user */
typedef struct CdiParam { int discipline, category, number; } CdiParam;
typedef struct CdiParam { int discipline; int category; int number; } CdiParam;
/* Opaque types */
......@@ -331,8 +331,8 @@ int streamInqTimestep(int streamID, int tsID);
/* PIO: query currently set timestep id */
int streamInqCurTimestepID(int streamID);
char *streamFilename(int streamID);
char *streamFilesuffix(int filetype);
const char* streamFilename(int streamID);
const char* streamFilesuffix(int filetype);
off_t streamNvals(int streamID);
int streamInqNvars ( int streamID );
......@@ -355,8 +355,7 @@ void streamWriteVarSliceF(int streamID, int varID, int levelID, const float *
void streamReadVarSlice(int streamID, int varID, int levelID, double *data_vec, int *nmiss);
void streamReadVarSliceF(int streamID, int varID, int levelID, float *data_vec, int *nmiss);
void streamWriteVarChunk(int streamID, int varID, const int rect[][2],
const double *data_vec, int nmiss);
void streamWriteVarChunk(int streamID, int varID, const int rect[3][2], const double *data_vec, int nmiss);
/* STREAM record I/O routines */
......@@ -555,7 +554,7 @@ void vlistDefVarName(int vlistID, int varID, const char *name);
void vlistInqVarName(int vlistID, int varID, char *name);
/* vlistCopyVarName: Safe and convenient version of vlistInqVarName */
char* vlistCopyVarName(int vlistId, int varId);
char* vlistCopyVarName(int vlistId, int varId);
/* vlistDefVarStdname: Define the standard name of a Variable */
void vlistDefVarStdname(int vlistID, int varID, const char *stdname);
......@@ -858,7 +857,7 @@ void gridDefYbounds(int gridID, const double *ybounds_vec);
/* gridInqYbounds: Get the bounds of a Y-axis */
int gridInqYbounds(int gridID, double *ybounds_vec);
void gridDefRowlon(int gridID, int nrowlon, const int rowlon_vec[]);
void gridDefRowlon(int gridID, int nrowlon, const int* rowlon_vec);
void gridInqRowlon(int gridID, int *rowlon_vec);
void gridChangeType(int gridID, int gridtype);
......@@ -1046,7 +1045,7 @@ int taxisInqType(int taxisID);
int taxisInqNumavg(int taxisID);
char *tunitNamePtr(int tunitID);
const char* tunitNamePtr(int tunitID);
/* Institut routines */
......@@ -1057,7 +1056,7 @@ int institutInqNumber(void);
int institutInqCenter(int instID);
int institutInqSubcenter(int instID);
const char *institutInqNamePtr(int instID);
char *institutInqLongnamePtr(int instID);
const char* institutInqLongnamePtr(int instID);
/* Model routines */
......@@ -1075,7 +1074,7 @@ void tableWrite(const char *filename, int tableID);
int tableRead(const char *tablefile);
int tableDef(int modelID, int tablenum, const char *tablename);
char *tableInqNamePtr(int tableID);
const char* tableInqNamePtr(int tableID);
void tableDefEntry(int tableID, int code, const char *name, const char *longname, const char *units);
int tableInq(int modelID, int tablenum, const char *tablename);
......
......@@ -238,7 +238,7 @@ const char *institutInqNamePtr(int instID)
}
char *institutInqLongnamePtr(int instID)
const char *institutInqLongnamePtr(int instID)
{
institute_t * instituteptr = NULL;
......
......@@ -308,10 +308,10 @@ int streamInqByteorder(int streamID)
}
char *streamFilesuffix(int filetype)
const char *streamFilesuffix(int filetype)
{
// static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc", ".nc4", ".nc4", ".srv", ".ext", ".ieg"};
static char *fileSuffix[] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"};
static const char *fileSuffix[] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"};
int size = (int) (sizeof(fileSuffix)/sizeof(char *));
if ( filetype > 0 && filetype < size )
......@@ -321,7 +321,7 @@ char *streamFilesuffix(int filetype)
}
char *streamFilename(int streamID)
const char *streamFilename(int streamID)
{
stream_t *streamptr = stream_to_pointer(streamID);
......
......@@ -8041,7 +8041,6 @@ void cdfEndDef(stream_t *streamptr)
static void cdfDefInstitut(stream_t *streamptr)
{
int fileID, instID;
char *longname;
size_t len;
int vlistID;
......@@ -8051,7 +8050,7 @@ static void cdfDefInstitut(stream_t *streamptr)
if ( instID != UNDEFID )
{
longname = institutInqLongnamePtr(instID);
const char *longname = institutInqLongnamePtr(instID);
if ( longname )
{
len = strlen(longname);
......
......@@ -590,9 +590,9 @@ static void partabCheckID(int item)
Error("item %d name undefined!", item);
}
char *tableInqNamePtr(int tableID)
const char *tableInqNamePtr(int tableID)
{
char *tablename = NULL;
const char *tablename = NULL;
if ( CDI_Debug )
Message("tableID = %d", tableID);
......
......@@ -24,7 +24,7 @@ static int DefaultTimeType = TAXIS_ABSOLUTE;
static int DefaultTimeUnit = TUNIT_HOUR;
char *Timeunits[] = {
const char *Timeunits[] = {
"undefined",
"seconds",
"minutes",
......@@ -105,10 +105,10 @@ dup_refcount_string(char *p)
static int TAXIS_Debug = 0; /* If set to 1, debugging */
char *tunitNamePtr(int unitID)
const char *tunitNamePtr(int unitID)
{
char *name;
int size = sizeof(Timeunits)/sizeof(char *);
const char *name;
int size = sizeof(Timeunits)/sizeof(*Timeunits);
if ( unitID > 0 && unitID < size )
name = Timeunits[unitID];
......
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