#include #include #include #include "thing.h" /* These bindings are appropriate for Intel fortran 4.5 */ #ifdef WIN32 #define LIST_THING LIST_THING #define GETNAMEOF_THING GETNAMEOF_THING #define SYNCHALLCREATED_THING SYNCHALLCREATED_THING #define START_THING START_THING #define ERROR_THING ERROR_THING #define GETID_THING GETID_THING #define GETNODECOUNT_THING GETNODECOUNT_THING #define STOP_THING STOP_THING /*#define WAITFORWORKER_THING WAITFORWORKER_THING*/ #define WAITFORWORK_THING WAITFORWORK_THING #define WAITFORWORKDONE_THING WAITFORWORKDONE_THING #define ASSIGNWORK_THING ASSIGNWORK_THING #define GETWORK_THING GETWORK_THING #define WORKDONE_THING WORKDONE_THING #define CREATE_THING CREATE_THING #define DESTROY_THING DESTROY_THING #define READ_THING READ_THING #define WRITE_THING WRITE_THING #define WAIT_THING WAIT_THING #define GETIOSTATISTICS_THING GETIOSTATISTICS_THING #define GETMILLISEC GETMILLISEC #else /* linux */ #define LIST_THING list_thing_ #define GETNAMEOF_THING getnameof_thing_ #define SYNCHALLCREATED_THING synchallcreated_thing_ #define START_THING start_thing_ #define ERROR_THING error_thing_ #define GETID_THING getid_thing_ #define GETNODECOUNT_THING getnodecount_thing_ #define STOP_THING stop_thing_ /*#define WAITFORWORKER_THING waitforworker_thing_*/ #define WAITFORWORK_THING waitforwork_thing_ #define WAITFORWORKDONE_THING waitforworkdone_thing_ #define ASSIGNWORK_THING assignwork_thing_ #define GETWORK_THING getwork_thing_ #define WORKDONE_THING workdone_thing_ #define CREATE_THING create_thing_ #define DESTROY_THING destroy_thing_ #define READ_THING read_thing_ #define WRITE_THING write_thing_ #define WAIT_THING wait_thing_ #define GETIOSTATISTICS_THING getiostatistics_thing_ #define GETMILLISEC getmillisec_ #endif /* Character type arguments will be passed as fixed length, * with the length of each passed as extra int arguments */ #define CARG(str,len) assert(len<=THING_NAME_LEN); \ strncpy( carg, str, len ); \ carg[len--]= 0; \ while(len>0 && carg[len]==' ') carg[len--]= 0; /*---------------------------------------------------------------- */ int START_THING( char *rootDir, int *sharedFileSystem, int len ) { int argc=1; char *argv[1]= { "thing" }; char carg[THING_NAME_LEN]; CARG(rootDir,len); return start_thing( carg, *sharedFileSystem, &argc, (char***)&argv ); } #if 0 void ERROR_THING( char *string, thing_t *status, int len ) { char carg[THING_NAME_LEN]; CARG(string,len); error_thing( carg, status ); } #endif void LIST_THING() { list_thing();} int GETNAMEOF_THING( int *thingnumber, char *name, int *home, int len ) { int iok; iok= getnameof_thing( *thingnumber, name, home ); return iok; } void SYNCHALLCREATED_THING() { synchAllCreated_thing();} int GETID_THING() { return getId_thing(); } int GETNODECOUNT_THING() { return getNodeCount_thing(); } int STOP_THING() { return stop_thing(); } #if 0 int WAITFORWORKER_THING( workID_thing_t *task, int *sizeofwork, int *completed, int *timeout ) { return waitForWorker_thing( task, *sizeofwork, completed, *timeout ); } #endif int WAITFORWORK_THING( workID_thing_t *task, int *sizeofwork, int *timeout ) { return waitForWork_thing( task, *sizeofwork, *timeout ); } int WAITFORWORKDONE_THING( workID_thing_t *task, int *sizeofwork, int *timeout ) { return waitForWorkDone_thing( task, *sizeofwork, *timeout ); } int ASSIGNWORK_THING( int *node, workID_thing_t *task, int *sizeoftask ) { return assignWork_thing( *node, task, *sizeoftask ); } int GETWORK_THING( int *node, workID_thing_t *task, int *sizeoftask ) { return getWork_thing( *node, task, *sizeoftask ); } int WORKDONE_THING( int *node, workID_thing_t *task, int *sizeoftask ) { return workDone_thing( *node, task, *sizeoftask ); } int CREATE_THING( char *newname, int *attributes, unsigned *maxsize, int len ) { char carg[THING_NAME_LEN]; CARG(newname,len); return create_thing( carg, *attributes, *maxsize ); } int DESTROY_THING( char *newname, int len ) { char carg[THING_NAME_LEN]; CARG(newname,len); return destroy_thing( carg ); } int READ_THING( char *source, unsigned long *offset, void *localAddr, unsigned *nbytes, thing_t *status, int len ) { char carg[THING_NAME_LEN]; CARG( source,len ); return read_thing( carg, *offset, localAddr, *nbytes, status ); } /* This is a little weird in that the pointer for status is an integer. * beware: 64bit pointer bug */ int WRITE_THING( char *source, unsigned long *offset, void *localAddr, unsigned *nbytes, thing_t *status, int len ) { char carg[THING_NAME_LEN]; CARG( source,len ); return write_thing( carg, *offset, localAddr, *nbytes, status ); } int WAIT_THING( thing_t *status, int *waitflag ) { return wait_thing( status, *waitflag ); } void GETIOSTATISTICS_THING( thing_t *status, float *elapsedio, int *nbytes, int *iremote ) { getIOstatistics_thing( status, elapsedio, nbytes, iremote ); return; } void CLEARWAIT_THING( thing_t *status ) { clearWait_thing( status ); return; } int GETMILLISEC() { return getMillisec(); }