Commit 4d0991d3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

namespace.c: added workaround for SX compiler

parent 813a0cf4
......@@ -35,6 +35,28 @@ static int activeNamespace = 0;
#define CDI_NETCDF_SWITCHES
#endif
#if defined (SX)
static const union namespaceSwitchValue defaultSwitches[NUM_NAMESPACE_SWITCH] = {
{ .func = (void (*)()) cdiAbortC_serial },
{ .func = (void (*)()) cdiWarning },
{ .func = (void (*)()) serializeGetSizeInCore },
{ .func = (void (*)()) serializePackInCore },
{ .func = (void (*)()) serializeUnpackInCore },
{ .func = (void (*)()) fileOpen_serial },
{ .func = (void (*)()) fileWrite },
{ .func = (void (*)()) fileClose_serial },
{ .func = (void (*)()) cdiStreamOpenDefaultDelegate },
{ .func = (void (*)()) cdiStreamDefVlist_ },
{ .func = (void (*)()) cdiStreamWriteVar_ },
{ .func = (void (*)()) cdiStreamwriteVarChunk_ },
{ .func = (void (*)()) 0 },
{ .func = (void (*)()) 0 },
{ .func = (void (*)()) cdiStreamCloseDefaultDelegate },
{ .func = (void (*)()) cdiStreamDefTimestep_ },
{ .func = (void (*)()) cdiStreamSync_ },
CDI_NETCDF_SWITCHES
};
#else
#define defaultSwitches { \
{ .func = (void (*)()) cdiAbortC_serial }, \
{ .func = (void (*)()) cdiWarning }, \
......@@ -55,6 +77,7 @@ static int activeNamespace = 0;
{ .func = (void (*)()) cdiStreamSync_ }, \
CDI_NETCDF_SWITCHES \
}
#endif
struct namespace
{
......@@ -62,7 +85,30 @@ struct namespace
union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH];
} initialNamespace = {
.resStage = STAGE_DEFINITION,
#if defined (SX)
.switches = {
{ .func = (void (*)()) cdiAbortC_serial },
{ .func = (void (*)()) cdiWarning },
{ .func = (void (*)()) serializeGetSizeInCore },
{ .func = (void (*)()) serializePackInCore },
{ .func = (void (*)()) serializeUnpackInCore },
{ .func = (void (*)()) fileOpen_serial },
{ .func = (void (*)()) fileWrite },
{ .func = (void (*)()) fileClose_serial },
{ .func = (void (*)()) cdiStreamOpenDefaultDelegate },
{ .func = (void (*)()) cdiStreamDefVlist_ },
{ .func = (void (*)()) cdiStreamWriteVar_ },
{ .func = (void (*)()) cdiStreamwriteVarChunk_ },
{ .func = (void (*)()) 0 },
{ .func = (void (*)()) 0 },
{ .func = (void (*)()) cdiStreamCloseDefaultDelegate },
{ .func = (void (*)()) cdiStreamDefTimestep_ },
{ .func = (void (*)()) cdiStreamSync_ },
CDI_NETCDF_SWITCHES
}
#else
.switches = defaultSwitches
#endif
};
struct namespace *namespaces = &initialNamespace;
......@@ -179,9 +225,14 @@ namespaceNew()
xassert(newNamespaceID >= 0 && newNamespaceID < NUM_NAMESPACES);
++nNamespaces;
namespaces[newNamespaceID].resStage = STAGE_DEFINITION;
#if defined (SX)
memcpy(namespaces[newNamespaceID].switches, defaultSwitches,
sizeof (namespaces[newNamespaceID].switches));
#else
memcpy(namespaces[newNamespaceID].switches,
(union namespaceSwitchValue[NUM_NAMESPACE_SWITCH])defaultSwitches,
sizeof (namespaces[newNamespaceID].switches));
#endif
reshListCreate(newNamespaceID);
NAMESPACE_UNLOCK();
return newNamespaceID;
......
......@@ -5,8 +5,6 @@
#ifndef SERIALIZE_H
#define SERIALIZE_H
//#include "cdi.h"
/*
* Generic interfaces for (de-)marshalling
*/
......
......@@ -37,7 +37,9 @@ double cdiEncodeTimeval(int date, int time, taxis_t *taxis);
void timeval2vtime(double timevalue, taxis_t *taxis, int *vdate, int *vtime);
double vtime2timeval(int vdate, int vtime, taxis_t *taxis);
#if !defined (SX)
extern resOps taxisOps;
#endif
int
taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
......
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