blob: 3f8d6bfb0e8f60354a87940e9f06d067fe03466a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
include "../lib/mctable.h"
$for (csilrdxp)
# MCT_SGET - Get value sequentally (generic)
int procedure mct_sget$t (table, value)
pointer table # table descriptor
PIXEL value # data value (output)
int row, col # next row, and column
PIXEL mct_get$t()
begin
# Check pointer and magic number.
if (table == NULL)
call error (0, "mct_sget: Null table pointer")
if (MCT_MAGIC (table) != MAGIC)
call error (0, "mct_sget: Bad magic number")
# Check table type.
if (MCT_TYPE (table) != TY_PIXEL)
call error (0, "mct_sget: Wrong table type")
# Get next position.
row = max (MCT_NGROWS (table), 1)
col = MCT_NGCOLS (table) + 1
# Test if it's necessary to go to the next row.
if (col > MCT_MAXCOL (table)) {
col = 1
row = row + 1
}
# Get value and return status.
iferr (value = mct_get$t (table, row, col))
return (EOF)
else
return (OK)
end
$endfor
|