blob: 2a2b8e8d6933c690f0bfc0db703eb8487ca50af5 (
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
|
include <tbset.h>
# NEXTUNIQ -- Retrieve the next unique row from a table
procedure nextuniq (tp, numptr, colptr, irow)
pointer tp # i: Table descriptor
int numptr # i: Number of column pointers
pointer colptr[ARB] # i: Array of column pointers
int irow # u: Current unique row
#--
bool fold
int jrow, krow, nrow
data fold / false /
int tbpsta(), tbrcmp()
begin
# Get number of rows in table
nrow = tbpsta (tp, TBL_NROWS)
# Loop until a row that does not match the preceding rows is found
for (jrow = irow+1; jrow <= nrow; jrow = jrow + 1) {
for (krow = 1; krow < jrow; krow = krow + 1) {
if (tbrcmp (tp, numptr, colptr, fold, jrow, krow) == 0)
break
}
if (krow == jrow)
break
}
# Set irow to the first row that does not match any preceding row
irow = jrow
end
|