Commit 680200ef authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Automatically generate wrapper for Xt_idxlist parameters.

* Also add streamWriteVarPart to public API.
parent 708a8455
......@@ -8,7 +8,7 @@ if USE_FC
noinst_PROGRAMS+=collectData2003
endif
AM_CFLAGS=-I$(top_srcdir)/src
AM_CFLAGS=-I$(top_srcdir)/src $(YAXT_CFLAGS)
AM_FCFLAGS=$(FPP_INCOPT)$(top_srcdir)/src
......
......@@ -312,7 +312,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = -I$(top_srcdir)/src
AM_CFLAGS = -I$(top_srcdir)/src $(YAXT_CFLAGS)
AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src
collectData_SOURCES = collectData.c
collectData_LDADD = $(top_builddir)/src/libcdi.la
......
......@@ -214,10 +214,11 @@ extern "C" {
#define PIO_MINIOMODEWITHSPECIALPROCS PIO_WRITER
/* parallel IO routines */
#ifndef MPI_VERSION
# define MPI_Comm int
#ifdef MPI_VERSION
# include <yaxt.h>
#endif
#ifdef MPI_VERSION
void pioEndDef ( void );
void pioEndTimestepping ( void );
void pioFinalize ( void );
......@@ -229,8 +230,10 @@ int pioInqVarDecoOff ( int, int );
void pioNamespaceSetActive ( int );
void pioWriteTimestep ( int, int, int );
#ifndef MPI_VERSION
#undef MPI_Comm
void streamWriteVarPart (int streamID, int varID, int memtype,
const void *data, int nmiss,
Xt_idxlist partDesc);
#endif
/* CDI control routines */
......
......@@ -390,6 +390,15 @@
! INTEGER )
EXTERNAL pioWriteTimestep
! streamWriteVarPart
! (INTEGER streamID,
! INTEGER varID,
! INTEGER memtype,
! CHOICE data,
! INTEGER nmiss,
! TYPE(XT_IDXLIST)partDesc)
EXTERNAL streamWriteVarPart
!
! CDI control routines
!
......
......@@ -6,6 +6,7 @@
#if USE_MPI
# include <mpi.h>
# include <yaxt.h>
#else
#define MPI_Comm int
#define MPI_Comm_f2c(c) (c)
......@@ -81,6 +82,11 @@ FCALLSCFUN2 (INT, pioInqVarDecoChunk, PIOINQVARDECOCHUNK, pioinqvardecochunk, IN
FCALLSCFUN2 (INT, pioInqVarDecoOff, PIOINQVARDECOOFF, pioinqvardecooff, INT, INT)
FCALLSCSUB1 (pioNamespaceSetActive, PIONAMESPACESETACTIVE, pionamespacesetactive, INT)
FCALLSCSUB3 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep, INT, INT, INT)
static void streamWriteVarPart_fwrap(int streamID, int varID, int memtype, const void * data, int nmiss, void * partDesc)
{
streamWriteVarPart( streamID, varID, memtype, data, nmiss, (*(Xt_idxlist *)partDesc));
}
FCALLSCSUB6 (streamWriteVarPart_fwrap, STREAMWRITEVARPART, streamwritevarpart, INT, INT, INT, PVOID, INT, PVOID)
/* CDI control routines */
......
......@@ -60,7 +60,8 @@ static void doctotxt(FILE *fp, Docu *doc, size_t ndoc)
}
enum cftype {ISVOID, ISCONSTSTRING, ISINT, ISREAL, ISDOUBLE, ISMPI_COMM,
ISINTP, ISINTV, ISINTVV, ISREALP, ISDOUBLEP, ISSTRING, ISSTRINGP,
ISXT_IDXLIST, ISCHOICE, ISINTP, ISINTV, ISINTVV, ISREALP,
ISDOUBLEP, ISSTRING, ISSTRINGP,
NUM_KNOWN_ARG_TYPES};
enum conversionType { CONV_ARG, CONV_RET };
......@@ -72,6 +73,9 @@ typedef int (*cfConversionEmitter)(FILE *outfp, const char *argName,
static int cfMPICommConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part);
static int cfXtIdxlistConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part);
struct symbol {
const char *f77name, *cfint, *cname, *parseRE;
size_t nameMatch;
......@@ -100,6 +104,11 @@ static struct symbol funArgSym[]
{ "INTEGER", "INT", "MPI_Comm",
"^"WS"*MPI_Comm"WS"+"SYMRE"?"WS"*[,\\)]", 1, 1,
cfMPICommConvert, "int" },
{ "TYPE(XT_IDXLIST)", "PVOID", "Xt_idxlist",
"^"WS"*Xt_idxlist"WS"+"SYMRE"?"WS"*[,\\)]", 1, 1,
cfXtIdxlistConvert, "void *" },
{ "CHOICE", "PVOID", "const void *",
"^"WS"*const"WS"+void"WS"*\\*"WS"*"SYMRE"?"WS"*[,\\)]", 1, 0 },
{ "INTEGER", "PINT", "int *",
"^"WS"*(const"WS"+)?int"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 0 },
{ "INTEGER", "INTV", "int[]",
......@@ -259,6 +268,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint)
fprintf(fpint, "\n");
fputs("#if USE_MPI\n"
"# include <mpi.h>\n"
"# include <yaxt.h>\n"
"#else\n"
"#define MPI_Comm int\n"
"#define MPI_Comm_f2c(c) (c)\n"
......@@ -786,7 +796,7 @@ symRegexCompile(size_t numSyms, struct symbol symList[],
/* emit conversion code for MPI_Comm argument */
static int cfMPICommConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part)
size_t argNameLen, enum conversionType part)
{
int retval = 0;
switch (part)
......@@ -802,6 +812,24 @@ static int cfMPICommConvert(FILE *outfp, const char *argName,
return retval;
}
/* emit conversion code for Xt_idxlist argument */
static int cfXtIdxlistConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part)
{
int retval = 0;
switch (part)
{
case CONV_ARG:
retval
= fprintf(outfp, "(*(Xt_idxlist *)%.*s)", (int)argNameLen, argName);
break;
case CONV_RET:
abort();
break;
}
return retval;
}
/*
* Local Variables:
* c-file-style: "Java"
......
......@@ -31,8 +31,10 @@
#include <string.h>
#ifdef HAVE_YAXT
#ifdef USE_MPI
#include <yaxt.h>
#else
typedef struct Xt_idxlist_ *Xt_idxlist;
#endif
......@@ -1778,11 +1780,11 @@ void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
stream_write_var(streamID, varID, MEMTYPE_DOUBLE, data, nmiss);
}
#if defined USE_MPI && defined HAVE_YAXT
void
streamWriteVarPart(int streamID, int varID, int memtype, const void *data,
int nmiss, Xt_idxlist partDesc)
{
#if defined USE_MPI
int filetype;
stream_t *streamptr;
......@@ -1807,9 +1809,8 @@ streamWriteVarPart(int streamID, int varID, int memtype, const void *data,
default:
xabort("INTERNAL ERROR");
}
}
#endif
}
/*
@Function streamWriteVarF
......
......@@ -15,6 +15,7 @@ cksum_read_SOURCES = cksum_read.c \
ensure_array_size.h ensure_array_size.c
pio_write_SOURCES = pio_write.c cksum.h cksum.c
#
AM_CFLAGS = $(YAXT_CFLAGS)
LDADD = ../src/libcdi.la -lm
INCLUDES = -I$(top_srcdir)/src
#
......
......@@ -332,6 +332,7 @@ cksum_read_SOURCES = cksum_read.c \
pio_write_SOURCES = pio_write.c cksum.h cksum.c
#
AM_CFLAGS = $(YAXT_CFLAGS)
LDADD = ../src/libcdi.la -lm
INCLUDES = -I$(top_srcdir)/src
#
......
Supports Markdown
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