aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/xtgids.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/xtools/xtgids.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/xtools/xtgids.x')
-rw-r--r--pkg/xtools/xtgids.x39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkg/xtools/xtgids.x b/pkg/xtools/xtgids.x
new file mode 100644
index 00000000..ea56c36c
--- /dev/null
+++ b/pkg/xtools/xtgids.x
@@ -0,0 +1,39 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <ctotok.h>
+
+# XT_GIDS -- Get identifier tokens from a string and match with a dictionary.
+#
+# The input string is scanned for identifier tokens (see definition of
+# identifier token in ctotok) and each token is checked against the
+# dictionary string. An array of YES/NO values for each dictionary entry,
+# up to a maximum of maxids, is returned.
+
+procedure xt_gids (str, dicstr, ids, maxids)
+
+char str[ARB] # Input string
+char dicstr[ARB] # Dictionary string
+int ids[maxids] # Identifier indices in dictionary
+int maxids # Maximum number of identifiers
+
+int i, ip, token
+char tokstr[SZ_LINE]
+
+int ctotok(), strdic()
+
+begin
+ call amovki (NO, ids, maxids)
+
+ ip = 1
+ repeat {
+ token = ctotok (str, ip, tokstr, SZ_LINE)
+ switch (token) {
+ case TOK_EOS:
+ return
+ case TOK_IDENTIFIER:
+ i = strdic (tokstr, tokstr, SZ_LINE, dicstr)
+ if ((i > 0) && (i <= maxids))
+ ids[i] = YES
+ }
+ }
+end