1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <cstring> 4 #include <string> 5 #include <sstream> 6 #include "phIO.h" 7 #include "phComm.h" 8 #include "phio_base.h" 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 void phio_readheader( 15 phio_fp f, 16 const char keyphrase[], 17 void* valueArray, 18 int* nItems, 19 const char datatype[], 20 const char iotype[] ) { 21 f->ops->readheader(f->file, keyphrase, valueArray, 22 nItems, datatype, iotype); 23 } 24 void phio_writeheader( 25 phio_fp f, 26 const char keyphrase[], 27 const void* valueArray, 28 const int* nItems, 29 const int* ndataItems, 30 const char datatype[], 31 const char iotype[] ) { 32 f->ops->writeheader(f->file, keyphrase, valueArray, 33 nItems, ndataItems, datatype, iotype); 34 } 35 void phio_readdatablock( 36 phio_fp f, 37 const char keyphrase[], 38 void* valueArray, 39 int* nItems, 40 const char datatype[], 41 const char iotype[] ) { 42 f->ops->readdatablock(f->file, keyphrase, valueArray, 43 nItems, datatype, iotype); 44 } 45 void phio_writedatablock( 46 phio_fp f, 47 const char keyphrase[], 48 const void* valueArray, 49 const int* nItems, 50 const char datatype[], 51 const char iotype[]) { 52 f->ops->writedatablock(f->file, keyphrase, valueArray, 53 nItems, datatype, iotype); 54 } 55 56 void phio_constructName( 57 phio_fp f, 58 const char inName[], 59 char* outName) { 60 f->ops->constructname(inName, outName); 61 } 62 63 void phio_openfile( 64 const char filename[], 65 phio_fp f) { 66 f->ops->openfile(filename, f); 67 } 68 69 void phio_closefile(phio_fp f) { 70 f->ops->closefile(f); 71 } 72 73 void phio_appendInt(char* dest, int v) { 74 std::stringstream ss; 75 ss << dest << v << '.'; 76 std::string s = ss.str(); 77 strcpy(dest, s.c_str()); 78 } 79 80 #ifdef __cplusplus 81 } 82 #endif 83