diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /pkg/utilities/nttools/tproject/nextuniq.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/utilities/nttools/tproject/nextuniq.x')
-rw-r--r-- | pkg/utilities/nttools/tproject/nextuniq.x | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/tproject/nextuniq.x b/pkg/utilities/nttools/tproject/nextuniq.x new file mode 100644 index 00000000..2a2b8e8d --- /dev/null +++ b/pkg/utilities/nttools/tproject/nextuniq.x @@ -0,0 +1,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 |