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