xref: /phasta/phSolver/common/streamio.cc (revision 08d2ac07b0519855627ebfd43221a09a84cee7bb)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "streamio.h"
4 #include "phio_stream.h"
5 #include "phio_posix.h"
6 #include "phio_base.h"
7 
8 static struct phio_ops stream_ops = {
9   stream_openfile_write,
10   stream_closefile,
11   posix_readheader,
12   posix_writeheader,
13   posix_readdatablock,
14   posix_writedatablock,
15   stream_constructname
16 };
17 
18 void streamio_setup(phio_fp*, GRStream grs) {
19   *f = (phio_fp) malloc(sizeof(struct streamio_file));
20   stream_fp sf = (stream_fp) *f;
21   f->ops = &stream_ops;
22   f->file = (int*) malloc(sizeof(int*));
23   f->mode = mode;
24   sf->grs = grs;
25 }
26 
27 void streamio_setup(phio_fp*, RStream rs) {
28   *f = (phio_fp) malloc(sizeof(struct streamio_file));
29   stream_fp sf = (stream_fp) *f;
30   f->ops = &stream_ops;
31   f->file = (int*) malloc(sizeof(int*));
32   f->mode = mode;
33   sf->rs = rs;
34 }
35