aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/atools/taincr.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/utilities/nttools/atools/taincr.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/utilities/nttools/atools/taincr.x')
-rw-r--r--pkg/utilities/nttools/atools/taincr.x55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/atools/taincr.x b/pkg/utilities/nttools/atools/taincr.x
new file mode 100644
index 00000000..7d297e23
--- /dev/null
+++ b/pkg/utilities/nttools/atools/taincr.x
@@ -0,0 +1,55 @@
+# This file contains taex_incr and taex_disaster, which are used by
+# both tainsert and taextract.
+#
+# Phil Hodge, 7-Mar-1996 Extracted from taextract.x.
+# Phil Hodge, 29-Jul-1997 In taex_disaster, get table name before closing
+# the table; rename delete to delete_flag to avoid
+# confusion with the delete subroutine.
+
+# taex_incr -- increment variables
+
+# On input, ncopy is the number of elements that were copied in
+# the previous step. We decrement nremain and increment first by
+# this amount. Then we determine the appropriate value of ncopy
+# for the next step and update last.
+
+procedure taex_incr (nremain, ncopy, first, last, bufsize)
+
+int nremain # io: number of elements remaining to be copied
+int ncopy # io: number of elements copied/to copy next
+int first # io: first element (or row number)
+int last # io: last element (or row number)
+int bufsize # i: maximum number to copy in one step
+
+begin
+ nremain = nremain - ncopy
+ first = first + ncopy
+ ncopy = min (nremain, bufsize)
+ last = first + ncopy - 1
+end
+
+# taex_disaster -- clean up and call error
+
+procedure taex_disaster (itp, otp, delete_flag, message)
+
+pointer itp, otp # io: pointers to table struct
+int delete_flag # i: YES if we should delete the output table
+char message[ARB] # i: error message
+#--
+pointer sp
+pointer outtable # scratch for name of output table
+
+begin
+ call tbtclo (itp)
+ if (delete_flag == YES) {
+ call smark (sp)
+ call salloc (outtable, SZ_FNAME, TY_CHAR)
+ call tbtnam (otp, Memc[outtable], SZ_FNAME)
+ call tbtclo (otp)
+ call tbtdel (Memc[outtable])
+ call sfree (sp)
+ } else {
+ call tbtclo (otp)
+ }
+ call error (1, message)
+end