2 #include <grass/rowio.h>
4 static void *my_select(ROWIO *,
int);
5 static void pageout(ROWIO *,
int);
43 for (i = 0; i < R->nrows; i++)
44 if (row == R->rcb[i].row)
45 return my_select(R, i);
50 for (i = 0; i < R->nrows; i++)
51 if (R->rcb[i].row < 0) {
55 else if (age < R->rcb[i].age) {
62 i = (*R->getrow) (R->fd, R->rcb[cur].buf, R->rcb[cur].row = row, R->len);
63 R->rcb[cur].dirty = 0;
71 return my_select(R, cur);
78 for (i = 0; i < R->nrows; i++)
82 static void pageout(ROWIO * R,
int cur)
84 if (R->rcb[cur].row < 0)
86 if (!R->rcb[cur].dirty)
88 (*R->putrow) (R->fd, R->rcb[cur].buf, R->rcb[cur].row, R->len);
89 R->rcb[cur].dirty = 0;
92 static void *my_select(ROWIO * R,
int n)
97 for (i = 0; i < R->nrows; i++)
99 R->cur = R->rcb[n].row;
100 R->buf = R->rcb[n].buf;
void rowio_flush(ROWIO *R)
void * rowio_get(ROWIO *R, int row)
read a row