24 #include <grass/segment.h>
27 static int check(
const SEGMENT *,
int,
int,
char *);
52 if (!check(SEG, row, col,
"segment_get"))
59 memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
90 if (!check(SEG, row, col,
"segment_put"))
97 SEG->scb[i].dirty = 1;
99 memcpy(&SEG->scb[i].buf[index], buf, SEG->len);
105 static int check(
const SEGMENT * SEG,
int row,
int col,
char *me)
107 int r = row >= 0 && row < SEG->nrows;
108 int c = col >= 0 && col < SEG->ncols;
113 fprintf(stderr,
"%s(SEG=%lx,fd=%d,row=%d,col=%d) ",
114 me, (
unsigned long int)SEG, SEG->fd, row, col);
116 fprintf(stderr,
"bad row ");
117 if (row >= SEG->nrows)
118 fprintf(stderr,
"(max %d) ", SEG->nrows - 1);
121 fprintf(stderr,
"bad col ");
122 if (col >= SEG->ncols)
123 fprintf(stderr,
"(max %d) ", SEG->ncols - 1);
125 fprintf(stderr,
"\n");
int segment_put(SEGMENT *SEG, const void *buf, int row, int col)
int segment_pagein(SEGMENT *SEG, int n)
Segment pagein.
int segment_address(const SEGMENT *SEG, int row, int col, int *n, int *index)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int segment_get(SEGMENT *SEG, void *buf, int row, int col)
Get value from segment file.