aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/display/imdwcsver.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/images/tv/display/imdwcsver.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/images/tv/display/imdwcsver.x')
-rw-r--r--pkg/images/tv/display/imdwcsver.x65
1 files changed, 65 insertions, 0 deletions
diff --git a/pkg/images/tv/display/imdwcsver.x b/pkg/images/tv/display/imdwcsver.x
new file mode 100644
index 00000000..f8fd9a08
--- /dev/null
+++ b/pkg/images/tv/display/imdwcsver.x
@@ -0,0 +1,65 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include "iis.h"
+include "zdisplay.h"
+
+# IMD_WCSVER -- Query the server for the WCS version supported. A zero
+# will be returned for the "old" wcs format used, otherwise the server
+# will return a version identifier.
+
+int procedure imd_wcsver ()
+
+pointer ds
+int chan, status, frame, ip
+char wcstext[SZ_OLD_WCSTEXT]
+
+int strncmp(), ctoi(), iisflu()
+pointer imd_mapframe1()
+bool envgetb()
+
+include "iis.com"
+
+begin
+ iis_valid = NO # initialize
+
+ # Check the environment for a flag to disable the new WCS info.
+ if (envgetb ("disable_wcs_maps")) {
+ iis_version = 0
+ return (iis_version)
+ }
+
+ # Open a temporary connection to the server if needed.
+ ds = NULL
+ if (iisnopen == 0)
+ ds = imd_mapframe1 (1, READ_ONLY, NO, NO)
+
+ # Send a WCS query with the X and Y register set. This tells a
+ # knowledgeable server to reply with a WCS version string,
+ # otherwise it is a no-op and we get the normal WCS response
+ # indicating the old format.
+
+ frame = 1
+ chan = iisflu (FRTOCHAN(frame))
+ call aclrc (wcstext, SZ_OLD_WCSTEXT)
+ call iishdr (IREAD+PACKED, SZ_OLD_WCSTEXT, WCS, 1, 1, chan, 0)
+ call iisio (wcstext, SZ_OLD_WCSTEXT, status)
+ if (status > 0)
+ call strupk (wcstext, wcstext, SZ_OLD_WCSTEXT)
+ else {
+ iis_version = 0
+ call imunmap (ds)
+ return (iis_version)
+ }
+
+ # Decode the version from the WCS text.
+ if (strncmp (wcstext, "version=", 8) == 0) {
+ ip = 9
+ status = ctoi (wcstext, ip, iis_version)
+ } else
+ iis_version = 0
+
+
+ if (ds != NULL)
+ call imunmap (ds)
+ return (iis_version)
+end