aboutsummaryrefslogtreecommitdiff
path: root/sys/qpoe/qpexgetfil.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 /sys/qpoe/qpexgetfil.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/qpoe/qpexgetfil.x')
-rw-r--r--sys/qpoe/qpexgetfil.x50
1 files changed, 50 insertions, 0 deletions
diff --git a/sys/qpoe/qpexgetfil.x b/sys/qpoe/qpexgetfil.x
new file mode 100644
index 00000000..3f1d2816
--- /dev/null
+++ b/sys/qpoe/qpexgetfil.x
@@ -0,0 +1,50 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "qpex.h"
+
+# QPEX_GETFILTER -- Return the currently active filter as a text string,
+# i.e., as a series of "attribute = expr" terms. The number of chars
+# output is returned as the function value.
+
+int procedure qpex_getfilter (ex, outstr, maxch)
+
+pointer ex #I QPEX descriptor
+char outstr[maxch] #O receives the filter string
+int maxch #I max chars out
+
+pointer et
+int op, otop
+int gstrcpy()
+
+begin
+ op = 1
+ otop = maxch + 1
+ for (et=EX_ETHEAD(ex); et != NULL; et=ET_NEXT(et)) {
+ if (ET_DELETED(et) == YES)
+ next
+
+ # Add term delimiter if not first term.
+ if (op > 1) {
+ outstr[op] = ','; op = min(otop, op + 1)
+ outstr[op] = ' '; op = min(otop, op + 1)
+ }
+
+ # Attribute name.
+ op = min (otop,
+ op + gstrcpy (Memc[ET_ATNAME(et)], outstr[op], otop-op))
+ outstr[op] = ' '; op = min(otop, op + 1)
+
+ # Assignment operator ("=" or "+=").
+ op = min (otop,
+ op + gstrcpy (Memc[ET_ASSIGNOP(et)], outstr[op], otop-op))
+ outstr[op] = ' '; op = min(otop, op + 1)
+
+ # The expression text (may be very large).
+ op = min (otop,
+ op + gstrcpy (Memc[ET_EXPRTEXT(et)], outstr[op], otop-op))
+ }
+ outstr[op] = EOS
+
+ return (op - 1)
+end