From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- pkg/utilities/nttools/gtedit/gtdodel.x | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pkg/utilities/nttools/gtedit/gtdodel.x (limited to 'pkg/utilities/nttools/gtedit/gtdodel.x') diff --git a/pkg/utilities/nttools/gtedit/gtdodel.x b/pkg/utilities/nttools/gtedit/gtdodel.x new file mode 100644 index 00000000..7292048c --- /dev/null +++ b/pkg/utilities/nttools/gtedit/gtdodel.x @@ -0,0 +1,41 @@ +include + +# GT_DODEL -- Actually delete the rows marked for deletion + +procedure gt_dodel (tp, tpr, deleted, npix) + +pointer tp +pointer tpr +int deleted[ARB] # io: Array of deleted flags +int npix # io: # of rows in table + +int i, j, k + +int tbpsta() + +begin + if (tpr != NULL) { + # Append to whatever is already in the table + k = tbpsta (tpr, TBL_NROWS) + do i = 1, npix { + if (deleted[i] == YES) { + k = k + 1 + call tbrcpy (tp, tpr, i, k) + } + } + } + + for (j = npix; j> 0; j = j - 1) { + if (deleted[j] == YES) { + i = j + while (deleted[i] == YES) { + i = i - 1 + if (i < 1) + break + } + i = i + 1 + call tbrdel (tp, i, j) + j = i - 1 + } + } +end -- cgit