aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/catquery/doc
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/catquery/doc
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/xtools/catquery/doc')
-rw-r--r--pkg/xtools/catquery/doc/README322
-rw-r--r--pkg/xtools/catquery/doc/catalogs.hlp233
-rw-r--r--pkg/xtools/catquery/doc/catquery.hd56
-rw-r--r--pkg/xtools/catquery/doc/catquery.hlp322
-rw-r--r--pkg/xtools/catquery/doc/catquery.men28
-rw-r--r--pkg/xtools/catquery/doc/ccsystems.hlp134
-rw-r--r--pkg/xtools/catquery/doc/cqfimquery.hlp39
-rw-r--r--pkg/xtools/catquery/doc/cqfinfo.hlp85
-rw-r--r--pkg/xtools/catquery/doc/cqfinfon.hlp79
-rw-r--r--pkg/xtools/catquery/doc/cqfquery.hlp78
-rw-r--r--pkg/xtools/catquery/doc/cqget.hlp130
-rw-r--r--pkg/xtools/catquery/doc/cqgnrecord.hlp61
-rw-r--r--pkg/xtools/catquery/doc/cqgqpar.hlp72
-rw-r--r--pkg/xtools/catquery/doc/cqgqparn.hlp73
-rw-r--r--pkg/xtools/catquery/doc/cqgrecord.hlp46
-rw-r--r--pkg/xtools/catquery/doc/cqgvalc.hlp42
-rw-r--r--pkg/xtools/catquery/doc/cqgvald.hlp40
-rw-r--r--pkg/xtools/catquery/doc/cqgvali.hlp40
-rw-r--r--pkg/xtools/catquery/doc/cqgvall.hlp40
-rw-r--r--pkg/xtools/catquery/doc/cqgvalr.hlp40
-rw-r--r--pkg/xtools/catquery/doc/cqgvals.hlp41
-rw-r--r--pkg/xtools/catquery/doc/cqhinfo.hlp39
-rw-r--r--pkg/xtools/catquery/doc/cqhinfon.hlp47
-rw-r--r--pkg/xtools/catquery/doc/cqimclose.hlp24
-rw-r--r--pkg/xtools/catquery/doc/cqimquery.hlp44
-rw-r--r--pkg/xtools/catquery/doc/cqistati.hlp49
-rw-r--r--pkg/xtools/catquery/doc/cqistats.hlp56
-rw-r--r--pkg/xtools/catquery/doc/cqistatt.hlp55
-rw-r--r--pkg/xtools/catquery/doc/cqkinfo.hlp65
-rw-r--r--pkg/xtools/catquery/doc/cqkinfon.hlp73
-rw-r--r--pkg/xtools/catquery/doc/cqlocate.hlp35
-rw-r--r--pkg/xtools/catquery/doc/cqlocaten.hlp47
-rw-r--r--pkg/xtools/catquery/doc/cqmap.hlp33
-rw-r--r--pkg/xtools/catquery/doc/cqnqpars.hlp32
-rw-r--r--pkg/xtools/catquery/doc/cqquery.hlp35
-rw-r--r--pkg/xtools/catquery/doc/cqrclose.hlp24
-rw-r--r--pkg/xtools/catquery/doc/cqrstati.hlp53
-rw-r--r--pkg/xtools/catquery/doc/cqrstats.hlp54
-rw-r--r--pkg/xtools/catquery/doc/cqrstatt.hlp56
-rw-r--r--pkg/xtools/catquery/doc/cqsetcat.hlp35
-rw-r--r--pkg/xtools/catquery/doc/cqsetcatn.hlp35
-rw-r--r--pkg/xtools/catquery/doc/cqsqpar.hlp39
-rw-r--r--pkg/xtools/catquery/doc/cqsqparn.hlp39
-rw-r--r--pkg/xtools/catquery/doc/cqstati.hlp61
-rw-r--r--pkg/xtools/catquery/doc/cqstats.hlp48
-rw-r--r--pkg/xtools/catquery/doc/cqstatt.hlp45
-rw-r--r--pkg/xtools/catquery/doc/cqunmap.hlp26
-rw-r--r--pkg/xtools/catquery/doc/cqwinfo.hlp65
-rw-r--r--pkg/xtools/catquery/doc/cqwinfon.hlp75
-rw-r--r--pkg/xtools/catquery/doc/surveys.hlp197
50 files changed, 3487 insertions, 0 deletions
diff --git a/pkg/xtools/catquery/doc/README b/pkg/xtools/catquery/doc/README
new file mode 100644
index 00000000..f17920ab
--- /dev/null
+++ b/pkg/xtools/catquery/doc/README
@@ -0,0 +1,322 @@
+ CATQUERY: The Catalog and Survey Access Routines
+
+1. Introduction
+
+ The catquery package provides a set of routines for local and remote
+catalog and image survey server access. The supported catalogs and image
+surveys are described in records stored in a catalog and image survey
+configuration file respectively. The catalog and image survey records
+specify the network address, the query format, and the output format for
+each supported catalog or image display server. More detailed information
+about catalogs and image survey access and configuration files can be
+found by typing "help catalogs" and "help surveys".
+
+ The results of each catalog query are stored in memory in an IRAF spool
+file. Calling programs can access the catalog results sequentially or randomly
+by record number. Individual fields in each record can be decoded into
+floating point, integer, or string values.
+
+The results of each image survey query are written to an image file on disk,
+currently a fits image file. IRAF image i/o routines can be used to access
+the image. There must be enough space availale on the disk to receive the
+image.
+
+
+2. The Interface Routines
+
+The package prefix is cq. The interface routines are listed below.
+
+ cq = cq_map (file, mode)
+ ival = cq_stati (cq, param)
+ cq_stats (cq, param, str, maxch)
+ nlines = cq_statt (cq, param, text, maxch)
+
+ catno = cq_locate (cq, name)
+ catno = cq_locaten (cq, catno, catname, maxch)
+ catno = cq_setcat (cq, name)
+ catno = cq_setcatn (cq, catno)
+
+ [ird]val = cq_fget[ird] (cq, name)
+ nelems = cq_fga[ird] (cq, name, array[ird], max_nelems)
+ cq_fgstr (cq, name, str, maxch)
+ cq_fgwrd (cq, name, wrd, maxch)
+ nlines = cq_fgtext (cq, name, text, maxch)
+ stat = cq_scan (cq)
+
+ nqpars = cq_nqpars (cq)
+ qparno = cq_gqpar (cq, name, qpname, max_qpname, qpvalue,
+ max_qpvalue, qpunits, max_qpunits, qpformat,
+ max_qpformat)
+ qparno = cq_gqparn (cq, qparno, qpname, max_qpname, qpvalue,
+ max_qpvalue, qpunits, max_qpunits, qpformat, max_qpformat)
+ qparno = cq_sqpar (cq, name, valuestr)
+ qparno = cq_sqparn (cq, qparno, valuestr)
+
+ res = cq_query (cq)
+ res = cq_fquery (cq, catfile, cathdr)
+ ival = cq_rstati (res, param)
+ cq_rstats (res, param, str, maxch)
+ nlines = cq_rstatt (res, param, text, maxch)
+ hparno = cq_hinfo (res, name, hpvalue, max_hpvalue)
+ hparno = cq_hinfon (res, hparno, hpname, max_hpname, hpvalue,
+ max_hpvalue)
+ nchars = cq_grecord (res, buffer, maxch, recno)
+ nchars = cq_gnrecord (res, buffer, maxch, nextrec)
+ fieldno = cq_finfo (res, name, foffset, fsize, ftype, funits,
+ max_funits, formats, max_formats)
+ fieldno = cq_finfon (res, fieldno, fname, max_fname, foffset, fsize,
+ ftype, funits, max_funits, formats, max_formats)
+ cq_rclose (res)
+ nchars = cq_gval[silrd] (res, name, [silrd]val)
+ nchars = cq_gvalc (res, name, str, maxch)
+
+ imres = cq_imquery (cq, imname)
+ imres = cq_fimquery (cq, imname)
+ ival = cq_istati (imres, param)
+ cq_istats (imres, param, str, maxch)
+ nlines = cq_istatt (imres, param, text, maxch)
+ wparno = cq_winfo (imres, name, wkname, max_wkname, wvalue,
+ max_wvalue, wtype, wunits, max_wunits)
+ wparno = cq_winfon (imres, wparno, wpname, max_wpnane, wkname,
+ max_wkname, wvalue, max_wvalue, wtype, wunits, max_wunits)
+ kparno = cq_kinfo (imres, name, skname, max_skname, svalue,
+ max_svalue, stype, sunits, max_sunits)
+ kparno = cq_kinfon (imres, kparno, spname, max_spname, skname,
+ max_skname, svalue, max_svalue, stype, sunits, max_sunits)
+ cq_imclose (imres)
+
+ cq_unmap (cq)
+
+
+3. Notes
+
+ An "include <pkg/cq.h>" statement must appear in the calling program to
+make the catquery pacakge parameter definitions visible to the calling program.
+
+ A "-lxtools" must be included in the calling program link line to link in
+the catquery routines.
+
+ The catalog and image surveys configuration files are mapped and unmapped
+with the routines cq_map and cq_unmap.
+
+ Before making a query the calling program must set the current catalog
+or image survey with the cq_setcat or cq_setcatn routines, and format
+and set the query parameters with the cq_gqpar, cq_gqparn, and cq_sqparn
+routines.
+
+ Remote and locate catalog queries are made with the cq_query routine.
+The routines cq_rstat[ist] are used to retrieve the catalog results parameters.
+Header parameter values and field descriptions can be retrieved with
+the cq_hinfo / cq_hinfon and cq_finfo / cq_finfon routines respectively.
+Catalog records can be accessed sequentially or randomly with the cq_gnrecord
+and cq_grecord routines. The cq_gval[csilrd] routines can be used to decode
+the record fields into floating point, integer, or string values. The
+cq_fquery routine is used to make a catalog file emulate the results of a
+catalog query. Cq_rclose frees the catalog results descriptor.
+
+ Remote and locate image survey queries are made with the cq_imquery routine.
+The routines cq_istat[ist] are used to retrieve the survey results parameters.
+The standard wcs and image parameter descriptions can be retrieved with the
+the cq_winfo / cq_winfon and cq_kinfo / cq_kinfon routines respectively. The
+cq_fimquery routine is used to make an existing image emulate the results of
+an image survey query. Cq_imclose frees the survey results descriptor.
+
+4. Examples
+
+Example 1: Query a catalog and dump the results to a catalog file.
+
+ include <cq.h>
+
+ ....
+
+ ra = clgetd ("ra")
+ dec = clgetd ("dec")
+ width = clgetd ("width")
+
+ ....
+
+ # Open the catalog configuration file.
+ cq = cq_map ("astromz$lib/catdb.dat", READ_ONLY)
+ if (cq == NULL)
+ ...
+
+ # Set the catalog.
+ catno = cq_setcat (cq, "noao@usno2")
+ if (catno == 0)
+ ...
+
+ # Set the query parameters. Assume the input input units match the
+ # the expected units. The input size is a width so divide by two
+ # if the query expects a radius.
+ nqpars = cq_nqpars (cq)
+ do i = 1, nqpars {
+ parno = cq_gqparn (cq, i, qpname, CQ_SZ_QPNAME, qpvalue,
+ CQ_SZ_QPVALUE, qpunits, CQ_SZ_QPUNITS, qpformats
+ CQ_SZ_QPFORMATS)
+ if (parno != i)
+ next
+ if (streq (qpname, "ra")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (ra)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "dec")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (dec)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "radius")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width / 2.0d0)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "width")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "xwidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "ywidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ }
+ }
+
+ # Make the query.
+ res = cq_query (cq)
+ if (res == NULL)
+ ...
+
+ # Write the results to a file.
+ recptr = 0
+ while (cq_gnrecord (res, buffer, SZ_LINE, rectpr) != EOF) {
+ call fprintf (outfd, "%s")
+ call pargstr (buffer)
+ }
+
+ # Close the query.
+ call cq_rclose (res)
+
+ # Close the database.
+ call cq_unmap (cq)
+
+
+Example 2: Repeat the previous example but only output records for
+ which magnitude values <= 16.0.
+
+ include <cq.h>
+
+ ...
+
+ res = cq_query (cq)
+ if (res == NULL)
+ ...
+
+ nrec = cq_rstati (res, CQNRECS)
+ do i = 1, nrecs {
+ nchars = cq_gvalr (res, i, "mag1", mag)
+ if (nchars <= 0)
+ next
+ if (mag > 16.0)
+ next
+ nchars = cq_grecord (res, buffer, SZ_LINE, i)
+ if (nchars <= 0)
+ next
+ call fprintf (outfd, "%s")
+ call pargstr (buffer)
+ }
+
+ call cq_rclose (res)
+
+ ...
+
+
+Example 3: Make an image survey query and dump the results to a fits file.
+
+ include <cq.h>
+
+ ....
+
+ ra = clgetd ("ra")
+ dec = clgetd ("dec")
+ width = clgetd ("width")
+
+ ....
+
+ # Open the catalog configuration file.
+ cq = cq_map ("astromz$lib/imdb.dat", READ_ONLY)
+ if (cq == NULL)
+ ...
+
+ # Set the catalog.
+ catno = cq_setcat (cq, "dss1@cadc")
+ if (catno == 0)
+ ...
+
+ # Set the query parameters. Assume the input input units match the
+ # the expected units.
+ nqpars = cq_nqpars (cq)
+ do i = 1, nqpars {
+ parno = cq_gqparn (cq, i, qpname, CQ_SZ_QPNAME, qpvalue, CQ_SZ_QPVALUE,
+ qpunits, CQ_SZ_QPUNITS, qpformats, CQ_SZ_QPFORMATS)
+ if (parno != i)
+ next
+ if (streq (qpname, "ra")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (ra)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "dec")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (dec)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "width")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "xwidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "ywidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ }
+ }
+
+ # Make the query.
+ imres = cq_imquery (cq, "outimage.fits")
+ if (imres == NULL)
+ ...
+
+ # Free the results structure
+ call cq_imclose (imres)
+
+ # Unmap the database
+ call cq_unmap (cq)
+
+
+
+Example 4: Repeat the previous example but convert the dss wcs to a fits wcs.
+At_mkdss is a routine which converts a dss wcs to a fits wcs
+
+ ...
+
+ # Make the query.
+ imres = cq_imquery (cq, "outimage.fits")
+ if (imres == NULL)
+ ...
+
+ wcstype = cq_istati (imres, CQWCS)
+ if (wcstype == CQWDSS) {
+ im = immap ("outimage.fits", READ_WRITE, 0)
+ stat = at_mkdss (im, true, false)
+ if (stat == ERR)
+ ...
+ call imunmap (im)
+ }
+
+ # Free the results structure
+ call cq_imclose (imres)
+
+ ...
diff --git a/pkg/xtools/catquery/doc/catalogs.hlp b/pkg/xtools/catquery/doc/catalogs.hlp
new file mode 100644
index 00000000..4109f810
--- /dev/null
+++ b/pkg/xtools/catquery/doc/catalogs.hlp
@@ -0,0 +1,233 @@
+.help catalogs Mar00 astromz
+.ih
+NAME
+catalogs -- describe the catalog configuration file
+.ih
+USAGE
+help catalogs
+.ih
+CATALOGS
+
+A catalog is a large set of tabular data records from which smaller
+tabular data sets can be extracted by issuing a catalog server query. Catalogs
+may be installed locally or accessed remotely. Installing a catalog involves
+creating a record in the catalog configuration file which specifies the
+catalog network address, the catalog query format, and the catalog query
+output format. In the following sections the configuration file is
+described in the context of accessing astrometric catalogs.
+
+.ih
+THE CATALOG CONFIGURATION FILE
+
+A record in the catalog configuration file specifies the network address,
+the query format, and the output format of each supported catalog server.
+Catalog server records names have the form "catalog@site",
+e.g. "usno2@noao". Adding support for a new catalog server or responding
+to changes in the behavior of an already supported server requires either adding
+a new record to the configuration file or changing an existing record in
+the configuration file. It does not require changing the catalog
+access code.
+
+The catalog server network address tells the catalog access code where
+and how to connect to the network. Each network address has the syntax
+"domain:port:address:flags" e.g. "inet:80:www.noao.edu:text".
+
+The query format specifies the form of the query server string, and the
+names, default values, units, and format of the query parameters. A set of
+query parameter names are reserved for accessing astrometric catalogs
+including "ra", "dec", "radius", "hwidth", "width", "rawidth", "decwidth",
+rahwidth, and dechwidth. The names of these parameters are not part of the
+catalog access API. Other types of catalogs may have different reserved
+query parameter names. The user replaces the default query values with user
+query parameter values before making the query.
+
+The server query output format specifies the form of the expected server output:
+including the data stream type, the record size, and the name, location,
+size, data type, units and format of each field in the record. A set of
+standard field names is reserved for accessing the output of astrometric
+catalog servers including "id", "ra", "dec", and "mag[1-n]". These standard
+field names are not part of the catalog access API. Other catalog
+types may have a different set of standard field names in the future.
+
+.ih
+SAMPLE CATALOG RECORD
+
+The following two examples illustrate typical catalog configuration file
+records. Note that both records can be used to access the same catalog
+data. The first example accesses the catalog as simple text, the latter
+as blocked text.
+
+.nf
+Example 1: Accessing the catalog as simple text.
+
+begin susno2@noao
+address inet:80:www.noao.edu:text
+query GET /cgi-bin/usno/usnoextract?search=yes&ra=%-s&dec=%-s&width=%-s HTTP/1.0
+\n\n
+nquery 4
+ ra 00:00:00.00 hours %0.2h
+ dec 00:00:00.0 degrees %0.1h
+ radius 5.0 minutes %0.1f
+ qsystem J2000.0 INDEF %s
+type stext
+ hskip 10
+ tskip 6
+ recsize 0
+ triml 0
+ trimr 4
+nheader 1
+ csystem J2000.0
+nfields 4
+ ra 1 0 d hours %12.3h
+ dec 2 0 d degrees %12.2h
+ mag1 3 0 r INDEF %4.1f
+ mag2 4 0 r INDEF %4.1f
+.fi
+
+.nf
+Example 2: Accessing the catalog as blocked text.
+
+begin busno2@noao
+address inet:80:www.noao.edu:text
+query GET /cgi-bin/usno/usnoextract?search=yes&ra=%-s&dec=%-s&width=%-s HTTP/1.0
+\n\n
+nquery 4
+ ra 00:00:00.00 hours %0.2h
+ dec 00:00:00.0 degrees %0.1h
+ radius 5.0 minutes %0.1f
+ qsystem J2000.0 INDEF %s
+type btext
+ hskip 10
+ tskip 6
+ recsize 44
+ triml 0
+ trimr 4
+nheader 1
+ csystem J2000.0
+nfields 4
+ ra 1 13 d hours %12.3h
+ dec 14 14 d degrees %12.2h
+ mag1 28 6 r INDEF %4.1f
+ mag2 34 6 r INDEF %4.1f
+.fi
+
+The beginning of a new catalog record is indicated by a line of the form
+\fI"begin catname"\fR where catname is a unique name of the form
+\fI"catalog@site"\fR. If there is more than one record with the same
+name, the last record is the one that is read. The same catalog server
+may be accessed in more than one way by creating multiple records.
+For example if the catalog server supports an optional magnitude selection
+feature, then in one record this feature can be enabled and in another it
+can be disabled.
+
+The \fIaddress\fR, \fIquery\fR and \fInquery\fR keywords are required and
+define the network address, query command, format and query parameters for
+the catalog.
+
+The \fIaddress\fR keyword "domain", "port", and "flags" fields are almost
+always "inet", "80", and "text" respectively, so in most cases the only
+address keyword field that has to be filled in is the address
+field "www.noao.edu" in this case.
+
+The \fIquery\fR keyword defines the query command whose form is server
+dependent. The query parameter values are encoded via the %-s formatting
+strings. The calling program must encode the user query parameter values
+into a set a strings which then replace the -%s format statement in the
+query string.
+
+The number of query parameters is defined by the \fInquery\fR keyword. The
+number of query parameters must be greater than or equal to the number of "-%s"
+strings in the query keyword value. The name, default value, units,
+and format of each query parameter are listed below the nquery keyword,
+one query parameter description per line. The query parameters should
+be defined in the catalog configuration file in the same order that they
+appear in the query keyword value. Alert readers will notice that in
+the examples above the number of query parameters is 4 but there are only
+3 "%-s" strings in the query keyword value. In these examples the qsystem
+query parameter, which defines the coordinate system of the ra and dec query
+parameter values is fixed at J2000. For some servers this parameter may
+be a true query parameter, i.e. the server may accept coordinates in
+B1950 or J2000 or some other coordinate system.
+
+For astrometric catalogs the reserved query parameter names "ra", "dec", and
+"qysystem" should be used to define the extraction region center and its
+coordinate system, and one or more of "radius", "width", "xwidth", and
+"ywidth" should be used to define the extraction region size. The units
+of "ra" should be "hours", "degrees", or "radians", the units of dec
+should be "degrees" or "radians", and units of the size query parameter
+should be "degrees" or "minutes". The qsystem parameter value may be
+any one of the supported celestial coordinate systems. The most common
+qsystem values are "icrs", "J2000", or "B1950". The query parameter
+formats are used to convert numerical values supplied by the calling
+program to string values that can be passed to the query string.
+It should be emphasized that the reserved query parameter names and units
+are conventions that are adopted to simplify writing the configuration
+file and astrometric applications. They are not part of the catalog
+access API itself.
+
+The \fItype\fR keyword defines the form of the query output. The current options
+are "stext" for simple text and "btext" for blocked text. Simple text
+contains newline delimited records with whitespace delimited fields.
+Blocked text contains newline delimited records and fixed position and size
+fields. If the type keyword is missing "stext" is assumed.
+
+The \fIrecsize\fR keyword is the length of the record in characters including
+the newline character. If the record size is variable recsize should be set
+t0 0. If undefined the recsize keyword defaults to 0 for variable record
+size.
+
+The \fIhskip\fR, \fItskip\fR, \fIltrim\fR, and \fItrim\fR define the number
+of leading and trailing records in the query output to sky, and the
+number of leading and trailing characters in each record to trim, i.e.
+replace with blanks. If absent these keywords default to zero.
+
+The \fInheader\fR keyword defines the number of header keywords. Header
+keyword values are global quantities which apply to the catalog server
+output as a whole. There may be 0 or many header keywords.
+
+For most astrometry catalog the most important and often only header keyword
+is \fIcsystem\fR which defines the coordinate system of the query output
+coordinates, i.e. if csystem is "J2000" then the coordinates of objects
+extracted from the catalog are in "J2000".
+
+The \fInfields\fR keyword defines the number of fields in the query output
+records. The name, offset, size, datatype, units, and format of each field
+follow, one field description per line. For simple text files the offset
+is field or column number and the size is 0 meaning undefined. For blocked
+text files the offset is the 1-indexed position of the first character (which
+may be blank) in the field and size is the field size in characters where
+the field size includes trailing blanks. Using a blocked text description may
+be required for dealing with fields containing embedded blanks. The type
+defines the preferred data type of a field. In the examples above the ra and
+dec are assigned double precision data types. This means that for precision
+reasons the calling program should but is not required to read these
+quantities into double precision variables. The units information is
+used to perform any required coordinate conversions, and the format information
+is used in cases where the calling program must decode a field, perform
+some numerical operation on it, and reencode it with the original precision.
+
+For astrometric catalogs the reserved standard field names "id", "ra", "dec",
+"mag#" etc should be used to define the standard field names. The current
+standard field name list is \fIid\fR, \fIra\fR, \fIdec\fR, \fRera\fR,
+\fIedec\fR, \fIpmra\fR, \fIpmdec\fR, \fIepmra\fR, \fIepmdec\fR,
+\fIcatsystem\fR, \fIequinox\fR, \fIepoch\fR, \fIpx\fR, \fIrv\fR, \fIepx\fR,
+\fIerv\fR, \fImag\fR, \fIcolor\fR, \fIemag\fR, \fIecolor\fR, \fIxp\fR,
+\fIyp\fR, \fIxc\fR, \fIyc\fR, \fIexc\fR, \fIeyc\fR, \fIimag\fR, and \fIeimag\fR.
+At a minimum an astrometric catalog must contain the "ra" and "dec" fields.
+The units of the ra field must be "hours", "degrees", or "radians"
+and the units of the "dec" field must be "degrees" or "radians". The
+other standard fields are optional and define quantities like: proper
+motions in ra and dec, the coordinate system, equinox, and epoch
+of observation, parallax, radial velocity, magnitude and color information,
+and predicted image pixel coordinates. The definitions and default units
+for all these quantities are defined more fully in the help for the
+astrometry package. It should be emphasized that the reserved field names
+and units names are conventions that are adopted to simplify writing the
+configuration file and astrometric applications. They are not part of
+the catalog access API itself.
+
+
+.ih
+SEE ALSO
+surveys
+.endhelp
diff --git a/pkg/xtools/catquery/doc/catquery.hd b/pkg/xtools/catquery/doc/catquery.hd
new file mode 100644
index 00000000..1ae79114
--- /dev/null
+++ b/pkg/xtools/catquery/doc/catquery.hd
@@ -0,0 +1,56 @@
+# Help directory for the CATQUERY library
+
+$doc = "./"
+$source = "../"
+
+cqmap hlp=doc$cqmap.hlp, src=source$cqmap.x
+cqstati hlp=doc$cqstati.hlp, src=source$cqstat.x
+cqstats hlp=doc$cqstats.hlp, src=source$cqstat.x
+cqstatt hlp=doc$cqstatt.hlp, src=source$cqstat.x
+cqlocate hlp=doc$cqlocate.hlp, src=source$cqlocate.x
+cqlocaten hlp=doc$cqlocaten.hlp, src=source$cqlocate.x
+cqsetcat hlp=doc$cqsetcat.hlp, src=source$cqsetcat.x
+cqsetcatn hlp=doc$cqsetcatn.hlp, src=source$cqsetcat.x
+cqget hlp=doc$cqget.hlp, src=source$cqget.x
+
+cqnqpars hlp=doc$cqnqpars.hlp, src=source$cqnqpars.x
+cqgqpar hlp=doc$cqgqpar.hlp, src=source$cqgqpar.x
+cqgqparn hlp=doc$cqgqparn.hlp, src=source$cqgqpar.x
+cqsqpar hlp=doc$cqsqpar.hlp, src=source$cqsqpar.x
+cqsqparn hlp=doc$cqsqparn.hlp, src=source$cqsqpar.x
+
+cqquery hlp=doc$cqquery.hlp, src=source$cqquery.x
+cqfquery hlp=doc$cqfquery.hlp, src=source$cqquery.x
+cqrstati hlp=doc$cqrstati.hlp, src=source$cqrstat.x
+cqrstats hlp=doc$cqrstats.hlp, src=source$cqrstat.x
+cqrstatt hlp=doc$cqrstatt.hlp, src=source$cqrstat.x
+cqhinfo hlp=doc$cqhinfo.hlp, src=source$cqrinfo.x
+cqhinfon hlp=doc$cqhinfon.hlp, src=source$cqrinfo.x
+cqfinfo hlp=doc$cqfinfo.hlp, src=source$cqrinfo.x
+cqfinfon hlp=doc$cqfinfon.hlp, src=source$cqrinfo.x
+cqgrecord hlp=doc$cqgrecord.hlp, src=source$cqrecords.x
+cqgnrecord hlp=doc$cqgnrecord.hlp, src=source$cqrecords.x
+cqgvalc hlp=doc$cqgvalc.hlp, src=source$cqgfields.x
+cqgvals hlp=doc$cqgvals.hlp, src=source$cqgfields.x
+cqgvali hlp=doc$cqgvali.hlp, src=source$cqgfields.x
+cqgvall hlp=doc$cqgvall.hlp, src=source$cqgfields.x
+cqgvalr hlp=doc$cqgvalr.hlp, src=source$cqgfields.x
+cqgvald hlp=doc$cqgvald.hlp, src=source$cqgfields.x
+cqrclose hlp=doc$cqrclose.hlp, src=source$cqquery.x
+
+cqimquery hlp=doc$cqimquery.hlp, src=source$cqimquery.x
+cqfimquery hlp=doc$cqfimquery.hlp, src=source$cqimquery.x
+cqistati hlp=doc$cqistati.hlp, src=source$cqistat.x
+cqistats hlp=doc$cqistats.hlp, src=source$cqistat.x
+cqistatt hlp=doc$cqistatt.hlp, src=source$cqistat.x
+cqwinfo hlp=doc$cqwinfo.hlp, src=source$cqiminfo.x
+cqwinfon hlp=doc$cqwinfon.hlp, src=source$cqiminfo.x
+cqkinfo hlp=doc$cqkinfo.hlp, src=source$cqiminfo.x
+cqkinfon hlp=doc$cqkinfon.hlp, src=source$cqiminfo.x
+cqimclose hlp=doc$cqimclose.hlp, src=source$cqimquery.x
+
+cqunmap hlp=doc$cqunmap.hlp, src=source$cqmap.x
+
+ccsystems hlp=doc$ccsystems.hlp
+catalogs hlp=doc$catalogs.hlp
+surveys hlp=doc$surveys.hlp
diff --git a/pkg/xtools/catquery/doc/catquery.hlp b/pkg/xtools/catquery/doc/catquery.hlp
new file mode 100644
index 00000000..3521c62c
--- /dev/null
+++ b/pkg/xtools/catquery/doc/catquery.hlp
@@ -0,0 +1,322 @@
+.help catquery Aug01 xtools
+.ih
+NAME
+catquery -- catalog access package
+.ih
+SYNOPSIS
+
+.nf
+ cq = cq_map (file, mode)
+ ival = cq_stati (cq, param)
+ cq_stats (cq, param, str, maxch)
+ nlines = cq_statt (cq, param, text, maxch)
+
+ catno = cq_locate (cq, name)
+ catno = cq_locaten (cq, catno, catname, maxch)
+ catno = cq_setcat (cq, name)
+ catno = cq_setcatn (cq, catno)
+
+ [ird]val = cq_fget[ird] (cq, name)
+ nelems = cq_fga[ird] (cq, name, array[ird], max_nelems)
+ cq_fgstr (cq, name, str, maxch)
+ cq_fgwrd (cq, name, wrd, maxch)
+ nlines = cq_fgtext (cq, name, text, maxch)
+ stat = cq_scan (cq)
+
+ nqpars = cq_nqpars (cq)
+ qparno = cq_gqpar (cq, name, qpname, max_qpname, qpvalue,
+ max_qpvalue, qpunits, max_qpunits, qpformat,
+ max_qpformat)
+ qparno = cq_gqparn (cq, qparno, qpname, max_qpname, qpvalue,
+ max_qpvalue, qpunits, max_qpunits, qpformat, max_qpformat)
+ qparno = cq_sqpar (cq, name, valuestr)
+ qparno = cq_sqparn (cq, qparno, valuestr)
+
+ res = cq_query (cq)
+ res = cq_fquery (cq, catfile, cathdr)
+ ival = cq_rstati (res, param)
+ cq_rstats (res, param, str, maxch)
+ nlines = cq_rstatt (res, param, text, maxch)
+ hparno = cq_hinfo (res, name, hpvalue, max_hpvalue)
+ hparno = cq_hinfon (res, hparno, hpname, max_hpname, hpvalue,
+ max_hpvalue)
+ nchars = cq_grecord (res, buffer, maxch, recno)
+ nchars = cq_gnrecord (res, buffer, maxch, nextrec)
+ fieldno = cq_finfo (res, name, foffset, fsize, ftype, funits,
+ max_funits, formats, max_formats)
+ fieldno = cq_finfon (res, fieldno, fname, max_fname, foffset, fsize,
+ ftype, funits, max_funits, formats, max_formats)
+ cq_rclose (res)
+ nchars = cq_gval[silrd] (res, name, [silrd]val)
+ nchars = cq_gvalc (res, name, str, maxch)
+
+ imres = cq_imquery (cq, imname)
+ imres = cq_fimquery (cq, imname)
+ ival = cq_istati (imres, param)
+ cq_istats (imres, param, str, maxch)
+ nlines = cq_istatt (imres, param, text, maxch)
+ wparno = cq_winfo (imres, name, wkname, max_wkname, wvalue,
+ max_wvalue, wtype, wunits, max_wunits)
+ wparno = cq_winfon (imres, wparno, wpname, max_wpnane, wkname,
+ max_wkname, wvalue, max_wvalue, wtype, wunits, max_wunits)
+ kparno = cq_kinfo (imres, name, skname, max_skname, svalue,
+ max_svalue, stype, sunits, max_sunits)
+ kparno = cq_kinfon (imres, kparno, spname, max_spname, skname,
+ max_skname, svalue, max_svalue, stype, sunits, max_sunits)
+ cq_imclose (imres)
+
+ cq_unmap (cq)
+.fi
+.ih
+DESCRIPTION
+The catquery package provides a set of routines for local and remote
+catalog and image survey server access. The supported catalogs and image
+surveys are described in records stored in a catalog and image survey
+configuration file respectively. The catalog and image survey records
+specify the network address, the query format, and the output format for
+each supported catalog or image display server. More detailed information
+about catalogs and image survey access and configuration files can be
+found by typing "help catalogs" and "help surveys".
+
+The results of each catalog query are stored in memory in an IRAF spool file.
+Calling programs can access the catalog results sequentially or randomly
+by record number. Individual fields in each record can be decoded into
+floating point, integer, or string values.
+
+The results of each image survey query are written to an image file on disk,
+currently a fits image file. IRAF image i/o routines can be used to access
+the image. There must be enough space availale on the disk to receive the
+image.
+
+.ih
+NOTES
+
+The catquery package definitions file is cq.h.
+
+The catalog and image surveys configuration files are mapped and unmapped
+with the routines cq_map and cq_unmap.
+
+Before making a query the calling program must set the current catalog
+or image survey with the cq_setcat or cq_setcatn routines, and format
+and set the query parameters with the cq_gqpar, cq_gqparn, and cq_sqparn
+routines.
+
+Remote and locate catalog queries are made with the cq_query routine.
+The routines cq_rstat[ist] are used to retrieve the catalog results parameters.
+Header parameter values and field descriptions can be retrieved with
+the cq_hinfo, cq_hinfon, cq_finfo, and cq_finfon routines. Catalog records
+can be accessed sequentially or randomly with the cq_gnrecord and
+cq_grecord routines. The cq_gval[csilrd] routines can be used to decode
+the record fields into floating point, integer, or string values.
+The cq_fquery routine is used to make a catalog file emulate
+the results of a catalog query. Cq_rclose frees the catalog results descriptor.
+
+Remote and locate image survey queries are made with the cq_imquery routine.
+The routines cq_istat[ist] are used to retrieve the survey results parameters.
+The standard wcs and image parameter descriptions can be retrieved with the
+the cq_winfo, cq_winfon, cq_kinfo, and cq_kinfon routines. The cq_fimquery
+routine is used to make an existing image emulate the results of an image
+survey query. Cq_imclose frees the survey results descriptor.
+
+.ih
+EXAMPLES
+.nf
+Example 1: Query a catalog and dump the results to a catalog file.
+
+ include <cq.h>
+
+ ....
+
+ ra = clgetd ("ra")
+ dec = clgetd ("dec")
+ width = clgetd ("width")
+
+ ....
+
+ # Open the catalog configuration file.
+ cq = cq_map ("astromz$lib/catdb.dat", READ_ONLY)
+ if (cq == NULL)
+ ...
+
+ # Set the catalog.
+ catno = cq_setcat (cq, "noao@usno2")
+ if (catno == 0)
+ ...
+
+ # Set the query parameters. Assume the input units match the
+ # the expected units. The input size is a width so divide by two
+ # if the query expects a radius.
+ nqpars = cq_nqpars (cq)
+ do i = 1, nqpars {
+ parno = cq_gqparn (cq, i, qpname, CQ_SZ_QPNAME, qpvalue,
+ CQ_SZ_QPVALUE, qpunits, CQ_SZ_QPUNITS, qpformats
+ CQ_SZ_QPFORMATS)
+ if (parno != i)
+ next
+ if (streq (qpname, "ra")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (ra)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "dec")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (dec)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "radius")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width / 2.0d0)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "width")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "xwidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "ywidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ }
+ }
+
+ # Make the query.
+ res = cq_query (cq)
+ if (res == NULL)
+ ...
+
+ # Write the results to a file.
+ recptr = 0
+ while (cq_gnrecord (res, buffer, SZ_LINE, rectpr) != EOF) {
+ call fprintf (outfd, "%s")
+ call pargstr (buffer)
+ }
+
+ # Close the query.
+ call cq_rclose (res)
+
+ # Close the database.
+ call cq_unmap (cq)
+
+
+Example 2: Repeat the previous example but only output records for
+ which magnitude values <= 16.0.
+
+ include <cq.h>
+
+ ...
+
+ res = cq_query (cq)
+ if (res == NULL)
+ ...
+
+ nrec = cq_rstati (res, CQNRECS)
+ do i = 1, nrecs {
+ nchars = cq_gvalr (res, i, "mag1", mag)
+ if (nchars <= 0)
+ next
+ if (mag > 16.0)
+ next
+ nchars = cq_grecord (res, buffer, SZ_LINE, i)
+ if (nchars <= 0)
+ next
+ call fprintf (outfd, "%s")
+ call pargstr (buffer)
+ }
+
+ call cq_rclose (res)
+
+ ...
+
+
+Example 3: Make an image survey query and dump the results to a fits file.
+
+ include <cq.h>
+
+ ....
+
+ ra = clgetd ("ra")
+ dec = clgetd ("dec")
+ width = clgetd ("width")
+
+ ....
+
+ # Open the catalog configuration file.
+ cq = cq_map ("astromz$lib/imdb.dat", READ_ONLY)
+ if (cq == NULL)
+ ...
+
+ # Set the catalog.
+ catno = cq_setcat (cq, "dss1@cadc")
+ if (catno == 0)
+ ...
+
+ # Set the query parameters. Assume the input units match the
+ # the expected units.
+ nqpars = cq_nqpars (cq)
+ do i = 1, nqpars {
+ parno = cq_gqparn (cq, i, qpname, CQ_SZ_QPNAME, qpvalue, CQ_SZ_QPVALUE,
+ qpunits, CQ_SZ_QPUNITS, qpformats, CQ_SZ_QPFORMATS)
+ if (parno != i)
+ next
+ if (streq (qpname, "ra")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (ra)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "dec")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (dec)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "width")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "xwidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ } else if (streq (qpname, "ywidth")) {
+ call sprintf (qpvalue, CQ_SZ_QPVALUE, qpformats)
+ call pargd (width)
+ parno = cq_sqpars (cq, qpname, qpvalue)
+ }
+ }
+
+ # Make the query.
+ imres = cq_imquery (cq, "outimage.fits")
+ if (imres == NULL)
+ ...
+
+ # Free the results structure
+ call cq_imclose (imres)
+
+ # Unmap the database
+ call cq_unmap (cq)
+
+
+
+Example 4: Repeat the previous example but convert the dss wcs to a fits wcs.
+ At_mkdss is a routine which converts a dss wcs to a fits wcs
+
+ ...
+
+ # Make the query.
+ imres = cq_imquery (cq, "outimage.fits")
+ if (imres == NULL)
+ ...
+
+ wcstype = cq_istati (imres, CQWCS)
+ if (wcstype == CQWDSS) {
+ im = immap ("outimage.fits", READ_WRITE, 0)
+ stat = at_mkdss (im, true, false)
+ if (stat == ERR)
+ ...
+ call imunmap (im)
+ }
+
+ # Free the results structure
+ call cq_imclose (imres)
+
+ ...
+.fi
+.endhelp
diff --git a/pkg/xtools/catquery/doc/catquery.men b/pkg/xtools/catquery/doc/catquery.men
new file mode 100644
index 00000000..ace43e7c
--- /dev/null
+++ b/pkg/xtools/catquery/doc/catquery.men
@@ -0,0 +1,28 @@
+ cqmap - Map the catalog / survey configuration file
+ cqstat[ist] - Get an integer, string, or text catalog / survey parameter
+ cqlocate[n] - Locate a catalog / survey by name or number
+ cqsetcat[n] - Set the current catalog / survey by name or number
+ cqget - Read catalog / survey configuration file keywords directly
+
+ cqnqpars - Get the number of query parameters
+ cqgqpar[n] - Get query parameter info by name or number
+ cqsqpar[n] - Set query parameter value by name or number
+
+ cqquery - Query a catalog and return the results
+ cqfquery - Query a catalog file and return the results
+ cqrstat[ist] - Get catalog results integer, string, or text parameter
+ cqhinfo[n] - Get catalog results header value by name or number
+ cqgrecord - Get catalog results record
+ cqgnrecord - Get next catalog results record
+ cqfinfo[n] - Get catalog results field info by name or number
+cqgval[csilrd] - Get field value from record
+ cqrclose - Close the catalog results
+
+ cqimquery - Query an image survey and return the results
+ cqfimquery - Query an image file and return the results
+ cqistat[ist] - Get survey results integer, string, or text parameter
+ cqwinfo[n] - Get survey results wcs parameter info by name or number
+ cqkinfo[n] - Get survey results image parameter info by name or number
+ cqimclose - Close the survey results
+
+ cqunmap - Unmap the configuration file
diff --git a/pkg/xtools/catquery/doc/ccsystems.hlp b/pkg/xtools/catquery/doc/ccsystems.hlp
new file mode 100644
index 00000000..3c1235a6
--- /dev/null
+++ b/pkg/xtools/catquery/doc/ccsystems.hlp
@@ -0,0 +1,134 @@
+.help ccsystems Mar00 catquery
+.ih
+NAME
+ccsystems -- list and describe the supported sky coordinate systems
+.ih
+USAGE
+help ccsystems
+
+.ih
+SKY COORDINATE SYSTEMS
+
+The sky package supports the equatorial ("fk4", "fk4-noe", "fk5", "icrs"),
+ecliptic, galactic, and supergalactic celestial coordinate systems. In most
+cases and unless otherwise noted users can input their coordinates in
+any one of these systems as long as they specify the coordinate system
+correctly.
+
+Considerable flexibility is permitted in how the coordinate systems are
+specified, e.g. J2000.0, j2000.0, 2000.0, fk5, fk5 J2000, and fk5 2000.0
+all specify the mean place post-IAU 1976 or FK5 system. Missing equinox and
+epoch fields assume reasonable defaults. In most cases the
+systems of most interest to users are "icrs", "j2000", and "b1950"
+which stand for the ICRS J2000.0, FK5 J2000.0 and FK4 B1950.0 celestial
+coordinate systems respectively. The full set of options are listed below:
+
+.ls equinox [epoch]
+The equatorial mean place post-IAU 1976 (FK5) system if equinox is a
+Julian epoch, e.g. J2000.0 or 2000.0, or the equatorial mean place
+pre-IAU 1976 system (FK4) if equinox is a Besselian epoch, e.g. B1950.0
+or 1950.0. Julian equinoxes are prefixed by a J or j, Besselian equinoxes
+by a B or b. Equinoxes without the J / j or B / b prefix are treated as
+Besselian epochs if they are < 1984.0, Julian epochs if they are >= 1984.0.
+Epoch is the epoch of the observation and may be a Julian
+epoch, a Besselian epoch, or a Julian date. Julian epochs
+are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to the epoch type of
+equinox if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date. If undefined epoch defaults to equinox.
+.le
+.ls icrs [equinox] [epoch]
+The International Celestial Reference System where equinox is
+a Julian or Besselian epoch e.g. J2000.0 or B1980.0.
+Equinoxes without the J / j or B / b prefix are treated as Julian epochs.
+The default value of equinox is J2000.0.
+Epoch is a Besselian epoch, a Julian epoch, or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Julian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date. If undefined epoch defaults to equinox.
+.le
+.ls fk5 [equinox] [epoch]
+The equatorial mean place post-IAU 1976 (FK5) system where equinox is
+a Julian or Besselian epoch e.g. J2000.0 or B1980.0.
+Equinoxes without the J / j or B / b prefix are treated as Julian epochs.
+The default value of equinox is J2000.0.
+Epoch is a Besselian epoch, a Julian epoch, or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Julian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date. If undefined epoch defaults to equinox.
+.le
+.ls fk4 [equinox] [epoch]
+The equatorial mean place pre-IAU 1976 (FK4) system where equinox is a
+Besselian or Julian epoch e.g. B1950.0 or J2000.0,
+and epoch is the Besselian epoch, the Julian epoch, or the Julian date of the
+observation.
+Equinoxes without the J / j or B / b prefix are treated
+as Besselian epochs. The default value of equinox is B1950.0. Epoch
+is a Besselian epoch, a Julian epoch, or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Besselian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date. If undefined epoch defaults to equinox.
+.le
+.ls noefk4 [equinox] [epoch]
+The equatorial mean place pre-IAU 1976 (FK4) system but without the E-terms
+where equinox is a Besselian or Julian epoch e.g. B1950.0 or J2000.0,
+and epoch is the Besselian epoch, the Julian epoch, or the Julian date of the
+observation.
+Equinoxes without the J / j or B / b prefix are treated
+as Besselian epochs. The default value of equinox is B1950.0.
+Epoch is a Besselian epoch, a Julian epoch, or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Besselian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian day. If undefined epoch defaults to equinox.
+.le
+.ls apparent epoch
+The equatorial geocentric apparent place post-IAU 1976 system where
+epoch is the epoch of observation.
+Epoch is a Besselian epoch, a Julian epoch or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Besselian
+epochs if the epoch value < 1984.0, Julian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date.
+.le
+.ls ecliptic epoch
+The ecliptic coordinate system where epoch is the epoch of observation.
+Epoch is a Besselian epoch, a Julian epoch, or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Besselian epochs
+if the epoch values < 1984.0, Julian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian day.
+.le
+.ls galactic [epoch]
+The IAU 1958 galactic coordinate system.
+Epoch is a Besselian epoch, a Julian epoch or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Besselian
+epochs if the epoch value < 1984.0, Julian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date. The default value of epoch is B1950.0.
+.le
+.ls supergalactic [epoch]
+The deVaucouleurs supergalactic coordinate system.
+Epoch is a Besselian epoch, a Julian epoch or a Julian date.
+Julian epochs are prefixed by a J or j, Besselian epochs by a B or b.
+Epochs without the J / j or B / b prefix default to Besselian
+epochs if the epoch value < 1984.0, Julian epochs
+if the epoch value <= 3000.0, otherwise epoch is interpreted as
+a Julian date. The default value of epoch is B1950.0.
+.le
+
+Fields enclosed in [] are optional with the defaults as described. The epoch
+field for the "icrs" , "fk5", "galactic", and "supergalactic" coordinate
+systems is only used if the input coordinates are in the equatorial fk4,
+noefk4, fk5, or icrs systems and proper motions are used to transform from
+coordinate system to another.
+
+.ih
+SEE ALSO
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqfimquery.hlp b/pkg/xtools/catquery/doc/cqfimquery.hlp
new file mode 100644
index 00000000..d344c7ee
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqfimquery.hlp
@@ -0,0 +1,39 @@
+.help cqfimquery Mar00 "Catquery Package"
+.ih
+NAME
+cqfimquery -- return the results of an image file query
+.ih
+SYNOPSIS
+
+imres = cq_fimquery (cq, imname)
+
+.nf
+pointer cq # the configuration file descriptor
+char imname # the input image file name
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls imname
+The file name of the image being queried.
+.le
+.ih
+DESCRIPTION
+Cq_fimquery queries an existing image and returns a results descriptor.
+Cq_fimquery is a pointer procedure which returns the results descriptor
+as its function value. NULL is returned if an error occurs in the query
+or the image does not exist.
+
+Cq_fimquery is used to make an image emulate the results of an image
+survey query.
+.ih
+NOTES
+Cq_setcat with the image survey name set to the reserved record name
+"imname@noao" must be called before any image survey query is made.
+
+.ih
+SEE ALSO
+cqimquery, cqimclose
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqfinfo.hlp b/pkg/xtools/catquery/doc/cqfinfo.hlp
new file mode 100644
index 00000000..b3bce18a
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqfinfo.hlp
@@ -0,0 +1,85 @@
+.help cqfinfo Mar00 "Catquery Package"
+.ih
+NAME
+cqfinfo -- get the requested description by name
+.ih
+SYNOPSIS
+
+fieldno = cq_finfo (res, name, fname, max_fname, foffset, fsize, ftype, funits,
+ max_funits, format, max_format)
+
+.nf
+pointer res # the results descriptor
+char name # the input field name
+char fname # the returned field name
+int max_fname # the maximum size of the field name
+int foffset # the returned field offset
+int fsize # the returned field size
+int ftype # the returned field type
+char funits # the returned field units
+int max_funits # the maximum size of the field units
+char format # the returned field format
+int max_format # the maximum size of the field format
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls name
+The name of the requested field.
+.le
+.ls fname
+The returned field name.
+.le
+.ls max_fname
+The maximum size of the returned field name.
+.le
+.ls foffset
+The returned field offset. Foffset is the field or column number if the
+results are in simple text format, or the one-indexed field offset in chars
+if the results are in blocked text format.
+.le
+.ls fsize
+The returned field size. Fsize is zero if the results are in simple text format,
+the field width in characters if the results are in blocked file format.
+.le
+.ls ftype
+The returned field data type. The options are TY_DOUBLE, TY_REAL, TY_LONG,
+TY_INT, TY_SHORT, and TY_CHAR.
+.le
+.ls funits
+The returned field units.
+.le
+.ls max_funits
+The maximum size of the returned field units.
+.le
+.ls format
+The returned field format.
+.le
+.ls max_format
+The maximum size of the returned field format.
+.le
+.ih
+DESCRIPTION
+Cq_finfo returns the name, offset, size, data type, units, and format of
+the requested field. Cq_finfo is an integer function which returns
+the field number of the requested field as its function value.
+
+.ih
+NOTES
+
+Related routines of interest are:
+
+.nf
+fieldno = cq_fnumber (res, fname)
+foffset = cq_foffset (res, fname)
+ fsize = cq_fsize (res, fname)
+ ftype = cq_ftype (res, fname)
+ call cq_funits (res, fname, units, max_units)
+ call cq_ffmts (res, fname, format, max_format)
+.fi
+.ih
+SEE ALSO
+cqfinfon
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqfinfon.hlp b/pkg/xtools/catquery/doc/cqfinfon.hlp
new file mode 100644
index 00000000..62f07dfd
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqfinfon.hlp
@@ -0,0 +1,79 @@
+.help cqfinfon Mar00 "Catquery Package"
+.ih
+NAME
+cqfinfon -- get the catalog results field description by number
+.ih
+SYNOPSIS
+
+fieldno = cq_finfon (res, fieldno, fname, max_fname, foffset, fsize, ftype,
+ funits, max_funits, format, max_format)
+
+.nf
+pointer res # the results descriptor
+int fieldno # the sequence number of the field to be returned
+char fname # the returned field name
+int max_fname # the maximum size of the returned field name
+int foffset # the field offset
+int fsize # the field size
+int ftype # the field data type
+char funits # the field units
+int max_funits # the maximum size of the returned field units
+char format # the field format
+int max_format # the maximum size of the returned field format
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls fieldno
+The sequence number of the field for which information is to be returned.
+.le
+.ls fname
+The returned field name.
+.le
+.ls max_fname
+The maximum size of the returned field name.
+.le
+.ls foffset
+The field offset. Foffset is the field or column number if the
+results are in simple text format, or the one-indexed field offset in chars
+if the results are in blocked text format.
+.le
+.ls fsize
+The field size. Fsize is zero if the results are in simple text file format,
+the field width in characters if results are in blocked file format.
+.le
+.ls ftype
+The field data type. The options are TY_DOUBLE, TY_REAL, TY_LONG, TY_INT,
+TY_SHORT, and TY_CHAR.
+.le
+.ls units
+The returned field units string.
+.le
+.ls max_units
+The maximum size of the returned field units string.
+.le
+.ls format
+The returned field format string.
+.le
+.ls max_format
+The maximum size of the returned field format string.
+.le
+.ih
+DESCRIPTION
+Cq_finfon returns the name, offset, size, data type, units, and format of
+the requested field. Cq_finfon is an integer function which returns
+the field number of the requested field as its function value.
+
+.ih
+NOTES
+Related routines of interest are:
+
+.nf
+call cq_fname (res, fieldno, name, max_name)
+.fi
+.ih
+SEE ALSO
+cqfinfo
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqfquery.hlp b/pkg/xtools/catquery/doc/cqfquery.hlp
new file mode 100644
index 00000000..32f2d5b0
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqfquery.hlp
@@ -0,0 +1,78 @@
+.help cqfquery Mar00 "Catquery Package"
+.ih
+NAME
+cqfquery -- query a catalog file and return the results
+.ih
+SYNOPSIS
+
+res = cq_fquery (cq, catfile, hdrtxt)
+
+.nf
+pointer cq # the configuration file descriptor
+char catfile # the catalog file name
+char hdrtext # the catalog file header text
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls catfile
+The catalog file name.
+.le
+.ls hdrtext
+Text describing the format of the catalog file.
+.le
+.ih
+DESCRIPTION
+Cq_fquery is a pointer function which returns the results descriptor as its
+function value. NULL is returned if an error occurs in the catalog file query.
+
+Cq_fquery is used to make a catalog file emulate the results of
+a catalog query. The calling program must supply the catalog format
+description. A sample catalog file and catalog description are shown below.
+.ih
+NOTES
+Cq_setcat with the catalog name set to the reserved record name "filename@noao"
+must be called before any catalog file query is made.
+
+A sample catalog file is shown below.
+
+.nf
+ 00:00:01.443 -0:06:57.52 13.5 15.2
+ 00:00:01.574 -0:05:33.26 16.1 18.0
+ 00:00:01.904 -0:09:48.51 18.2 19.6
+ 00:00:02.529 -0:04:21.53 13.4 14.4
+ 00:00:04.154 -0:01:56.32 17.1 18.3
+ 00:00:04.438 -0:05:00.03 11.4 13.5
+ 00:00:04.697 -0:03:24.59 16.9 17.7
+ 00:00:05.989 -0:02:46.36 15.1 17.6
+ 00:00:07.118 -0:09:03.53 19.1 19.8
+ 00:00:07.260 -0:06:47.95 17.0 17.7
+ 00:00:07.314 -0:00:22.35 15.3 16.8
+.fi
+
+The accompanying catalog file header is shown below.
+
+.nf
+type stext
+nheader 1
+ csystem J2000
+nfields 4
+ ra 1 0 d hours %12.3h
+ dec 2 0 d degrees %12.2h
+ mag1 3 0 r INDEF %4.1f
+ mag2 4 0 r INDEF %4.1f
+.fi
+
+The catalog header specifies the type of file, "stext" for simple text in
+this example, the number of header parameters, the number of fields in each
+record, and the individual field descriptions.
+
+More information about the catalog header shown here can be found by typing
+"help catalogs".
+
+.ih
+SEE ALSO
+cqquery, cqrclose
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqget.hlp b/pkg/xtools/catquery/doc/cqget.hlp
new file mode 100644
index 00000000..0229cdc1
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqget.hlp
@@ -0,0 +1,130 @@
+.help cqget Mar00 "Catquery Package"
+.ih
+NAME
+cqget -- read configuration file keywords directly
+.ih
+SYNOPSIS
+
+.nf
+ [ird]val = cq_fget[ird](cq, fname)
+ nelems = cq_fga[ird](cq, fname, [ird]array, max_nelems)
+ call cq_fgwrd (cq, fname, wrd, maxch)
+ call cq_fgstr (cq, fname, str, maxch)
+ nlines = cq_fgtext (cq, fname, text, maxch)
+ stat = cq_scan (cq)
+
+pointer cq # the configuration file descriptor
+char fname # the field or keyword to be located
+int iarray # the returned integer array
+int rarray # the returned real array
+int darray # the returned double array
+int max_nelems # the maximum size of the returned array
+char wrd # the keyword word value to be read
+char str # the keyword string value to be read
+char text # the keyword text value to be read
+int maxch # the maximum size of the word, string, text value
+.fi
+.ih
+SYNOPSIS
+.ls cq
+The configuration file descriptor.
+.le
+.ls fname
+The name of the field or keyword to be read.
+.le
+.ls [ird]array
+The integer, real, or double array returned by a call to cq_fga[ird].
+.le
+.ls max_nelems
+The maximum number of elements in the array returned by a call to
+cq_fga[ird].
+.le
+.ls wrd, str, text
+The word, string, or text value returned by a call to cq_fgwrd, cq_fgstr, or
+cq_fgtext.
+.le
+.ls maxch
+The maximum number of characters in the word, string, or text returned
+by cq_fgwrd, cq_fgstr, cq_fgtext.
+.le
+.ih
+DESCRIPTION
+
+Cq_fgval[ird] is an integer, real, or double function which returns the
+integer, real, or double value of the requested field or keyword as its
+function value.
+
+Cq_fga[ird] returns an integer, real, or double array for the requested
+field. Cq_fga[ird] is an integer function which returns the number of elements
+in the retrieved array as its function value.
+
+Cq_fg[wrd/str/text] returns the next word, the entire string, or the
+number of lines in the requested keyword. Cq_fgtext is an integer function
+which returns the number of lines in the returned text as its functions
+value.
+
+.ih
+NOTES
+The cqget routines are used to read keywords or fields in the current catalog
+or survey directly. The routines cq_setcat or cq_setcatn must be called before
+the cqget routines can be used.
+
+The cqget routines must be error checked to avoid task termination.
+.ih
+EXAMPLES
+
+Sample catalog configuration file record.
+
+.nf
+begin usno2@noao
+address inet:80:www.noao.edu:text
+query GET /cgi-bin/usno/usnoextract?search=yes&ra=%-s&dec=%-s&width=%-s HTTP/1.0
+\n\n
+nquery 4
+ ra 00:00:00.00 hours %0.2h
+ dec 00:00:00.0 degrees %0.1h
+ radius 5.0 minutes %0.1f
+ qsystem J2000.0 INDEF %s
+type stext
+ hskip 10
+ tskip 6
+ recsize 44
+ triml 0
+ trimr 4
+nheader 1
+ csystem J2000.0
+nfields 4
+ ra 1 0 d hours %12.3h
+ dec 2 0 d degrees %12.2h
+ mag1 3 0 r INDEF %4.1f
+ mag2 4 0 r INDEF %4.1f
+.fi
+
+Example 1: To fetch the query field which includes embedded blanks use cq_fgstr.
+
+.nf
+call cq_fgstr (cq, "query", buffer, SZ_LINE)
+.fi
+
+Example 2: To fetch the type field use cq_fgwrd.
+
+.nf
+call cq_fgwrd (cq, "type", buffer, SZ_LINE)
+.fi
+
+Example 3: To determine the number of query parameters.
+
+.nf
+nquery = cq_fgeti (cq, "nquery")
+.fi
+
+Example4: To return a text array which follows a numerically valued parameter.
+
+.nf
+nquery = cq_fgeti (cq, "nquery")
+nlines = cq_fgtext (cq, "nquery", buffer, nquery * SZ_LINE)
+.fi
+
+.ih
+SEE ALSO
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgnrecord.hlp b/pkg/xtools/catquery/doc/cqgnrecord.hlp
new file mode 100644
index 00000000..6fd9ab53
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgnrecord.hlp
@@ -0,0 +1,61 @@
+.help cqgnrecord Mar00 "Catquery Package"
+.ih
+NAME
+cqgnrecord -- get the next record from the catalog results
+.ih
+SYNOPSIS
+
+stat = cq_gnrecord (res, buf, maxch, nextrec)
+
+.nf
+pointer res # the results descriptor
+char buf # the output record buffer
+int maxch # the maximum size of the output record buffer
+int recno # the next available record number
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls buf
+The buffer containing the returned record.
+.le
+.ls maxch
+The maximum size of the output buffer.
+.le
+.ls recptr
+The next available record number. Recptr is updated after each call.
+.le
+.ih
+DESCRIPTION
+Cq_gnrecord returns the requested record. Cq_grecord is an integer function
+which returns BOF, the number of characters in the record, or EOF as
+its function value.
+
+.ih
+NOTES
+In most cases allocating a buffer size that is SZ_LINE chars long
+will be adequate to hold the output record. If the integer results parameter
+CQRECSIZE is defined, i.e. non-zero, then an output buffer CQRECSIZE chars
+long can be allocated.
+
+.ih
+EXAMPLES
+
+pointer cq_query()
+int cq_gnrecord()
+
+...
+
+res = cq_query (cq)
+recno = 0
+while (cq_gnrecord (res, record, SZ_LINE, recno) != EOF) {
+ call printf ("%s")
+ call pargstr (record)
+}
+call cq_rclose (res)
+.ih
+SEE ALSO
+cqgrecord
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgqpar.hlp b/pkg/xtools/catquery/doc/cqgqpar.hlp
new file mode 100644
index 00000000..72b14809
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgqpar.hlp
@@ -0,0 +1,72 @@
+.help cqgqpar Mar00 "Catquery Package"
+.ih
+NAME
+cqgqpar -- get a query parameter description by name
+.ih
+SYNOPSIS
+
+parno = cq_gqpar (cq, pname, qpname, max_qpname, qpvalue, max_qpvalue, qpunits,
+ max_qpunits, qpformat, max_qpformat)
+
+.nf
+pointer cq # the configuration file descriptor
+char pname # the name of the requested query parameter
+char qpname # the returned query parameter name
+int max_qpname # the maximum size of the returned parameter name
+char qpvalue # the returned query parameter value
+int max_qpvalue # the maximum size of the returned parameter value
+char qpunits # the returned query parameter units
+int max_qpunits # the maximum size of the returned parameter units
+char qpformat # the returned query parameter format
+int max_qpformat # the maximum size of the returned parameter format
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls pname
+The name of the requested query parameter.
+.le
+.ls qpname
+The returned query parameter name.
+.le
+.ls max_qpname
+The maximum size of the returned query parameter name.
+.le
+.ls qpvalue
+The returned query parameter value.
+.le
+.ls max_qpvalue
+The maximum size of the returned query parameter value.
+.le
+.ls qpunits
+The returned query parameter units.
+.le
+.ls max_qpunits
+The maximum size of the returned query parameter units.
+.le
+.ls qpformat
+The returned query parameter format.
+.le
+.ls max_qpformat
+The maximum size of the returned query parameter format.
+.le
+.ih
+DESCRIPTION
+Cq_gqpar returns the name, value, units, and format of the requested query
+parameter. Cq_gpar is an integer function which returns the sequence number
+of the query parameter as its function value. Zero is returned if the requested
+query parameter is not found.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before a query parameter
+request can be made.
+
+The defined constants CQ_SZ_QPNAME, CQ_SZ_QPVALUE, CQ_SZ_QPUNITS, and
+CQ_SZ_QPFMTS in the cq.h file can be used to assign values to the
+max_qpname, max_qpvalue, max_qpunits, and max_qpformat paramters.
+.ih
+SEE ALSO
+cqnqpars, cqgqparn, cqsqpar, cqsqparn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgqparn.hlp b/pkg/xtools/catquery/doc/cqgqparn.hlp
new file mode 100644
index 00000000..10155fe7
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgqparn.hlp
@@ -0,0 +1,73 @@
+.help cqgqparn Mar00 "Catquery Package"
+.ih
+NAME
+cqgqparn -- get the query parameter description by sequence number
+.ih
+SYNOPSIS
+
+parno = cq_gqparn (cq, parno, qpname, max_qpname, qpvalue, max_qpvalue, qpunits,
+ max_qpunits, qpformat, max_qpformat)
+
+.nf
+pointer cq # the configuration file descriptor
+int parno # the query parameter sequence number
+char qpname # the returned query parameter name
+int max_qpname # the maximum size of the returned parameter name
+char qpvalue # the returned query parameter value
+int max_qpvalue # the maximum size of the returned parameter value
+char qpunits # the returned query parameter units
+int max_qpunits # the maximum size of the returned parameter units
+char qpformat # the returned query parameter format
+int max_qpformat # the maximum size of the returned parameter format
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls parno
+The query parameter sequence number.
+.le
+.ls qpname
+The returned query parameter name.
+.le
+.ls max_qpname
+The maximum size of the returned query parameter name.
+.le
+.ls qpvalue
+The returned query parameter value.
+.le
+.ls max_qpvalue
+The maximum size of the returned query parameter value.
+.le
+.ls qpunits
+The returned query parameter units.
+.le
+.ls max_qpunits
+The maximum size of the returned query parameter units.
+.le
+.ls qpformat
+The returned query parameter format.
+.le
+.ls max_qpformat
+The maximum size of the returned query parameter format.
+.le
+.ih
+DESCRIPTION
+Cq_gqparn returns the name, value, units, and format of the requested query
+parameter by number. Cq_gparn is an integer function which returns the
+sequence number of the query parameter as its function value. Zero is
+returned if the requested query parameter is not found.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before a query parameter
+request can be made.
+
+The defined constants CQ_SZ_QPNAME, CQ_SZ_QPVALUE, CQ_SZ_QPUNITS, and
+CQ_SZ_QPFMTS in the cq.h file can be used to assign values to the
+max_qpname, max_qpvalue, max_qpunits, and max_qpformat paramters.
+
+.ih
+SEE ALSO
+cqnqpars, cqgqpar, cqsqpar, cqsqparn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgrecord.hlp b/pkg/xtools/catquery/doc/cqgrecord.hlp
new file mode 100644
index 00000000..732f43f5
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgrecord.hlp
@@ -0,0 +1,46 @@
+.help cqgrecord Mar00 "Catquery Package"
+.ih
+NAME
+cqgrecord -- get a record from the catalog results
+.ih
+SYNOPSIS
+
+stat = cq_grecord (res, buf, maxch, recno)
+
+.nf
+pointer res # the results descriptor
+char buf # the output buffer
+int maxch # the maximum size of the output buffer
+int recno # the record to be fetched
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls buf
+The buffer containing the returned record.
+.le
+.ls maxch
+The maximum size of the output buffer.
+.le
+.ls recptr
+The sequence number of the record to be fetched. Recptr should be set to
+to initialize sequential reading of all the catalog results.
+.le
+.ih
+DESCRIPTION
+Cq_grecord returns the requested record. Cq_grecord is an integer function
+which returns BOF, the number of characters in the record, or EOF as
+its function value.
+.ih
+NOTES
+In most cases allocating a buffer size that is SZ_LINE chars long
+will be adequate to hold the output record. If the integer results parameter
+CQRECSIZE is defined, i.e. non-zero, then an output buffer CQRECSIZE chars
+long can be allocated.
+
+.ih
+SEE ALSO
+cqgnrecord
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgvalc.hlp b/pkg/xtools/catquery/doc/cqgvalc.hlp
new file mode 100644
index 00000000..a6313556
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgvalc.hlp
@@ -0,0 +1,42 @@
+.help cqgvalc Mar00 "Catquery Package"
+.ih
+NAME
+cqgvalc -- get a catalog results field as a string value
+.ih
+SYNOPSIS
+nchars = cq_gvalc (res, recno, fname, str, maxch)
+
+.nf
+pointer res # the results descriptor
+int recno # the record number
+char fname # the field name
+char str # the returned string value
+int maxch # the maximum size of the returned string value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls recno
+The record number.
+.le
+.ls fname
+The field name.
+.le
+.ls str
+Array containing returned string value.
+.le
+.ls maxch
+The maximum size in characters of the returned string value.
+.le
+.ih
+DESCRIPTION
+Cq_gvalc returns the requested field value as a string. Cq_gvalc is an
+integer function which returns the number of decoded characters as its
+function value. Zero is returned if the field could not be decoded.
+
+.ih
+SEE ALSO
+cqgval[silrd]
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgvald.hlp b/pkg/xtools/catquery/doc/cqgvald.hlp
new file mode 100644
index 00000000..245371cb
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgvald.hlp
@@ -0,0 +1,40 @@
+.help cqgvald Mar00 "Catquery Package"
+.ih
+NAME
+cqgvald -- get a catalog results field as a double precision value
+.ih
+SYNOPSIS
+
+nchars = cq_gvald (res, recno, fname, dval)
+
+.nf
+pointer res # the results descriptor
+int recno # the record number
+char fname # the field name
+double dval # the returned field value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls recno
+The record number.
+.le
+.ls fname
+The field name.
+.le
+.ls dval
+The returned double precision value.
+.le
+.ih
+DESCRIPTION
+Cq_gvald returns the requested field as a double precision value.
+Cq_gvald is an integer function which returns the number of characters
+that were successfully decoded as its function value. Zero is returned
+if the requested field could not be decoded.
+
+.ih
+SEE ALSO
+cqgval[csilr]
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgvali.hlp b/pkg/xtools/catquery/doc/cqgvali.hlp
new file mode 100644
index 00000000..8d5d3606
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgvali.hlp
@@ -0,0 +1,40 @@
+.help cqgvali Mar00 "Catquery Package"
+.ih
+NAME
+cqgvali -- get a catalog results field as an integer
+.ih
+SYNOPSIS
+
+nchars = cq_gvali (res, recno, fname, ival)
+
+.nf
+pointer res # the results descriptor
+int recno # the record number
+char fname # the field name
+int ival # the returned field value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls recno
+The record number.
+.le
+.ls fname
+The field name.
+.le
+.ls ival
+The returned integer value.
+.le
+.ih
+DESCRIPTION
+Cq_gvali returns the requested field as an integer value.
+Cq_gvali is an integer function which returns the number of characters
+that were successfully decoded as its function value. Zero is returned
+if the requested field could not be decoded.
+
+.ih
+SEE ALSO
+cqgval[cslrd]
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgvall.hlp b/pkg/xtools/catquery/doc/cqgvall.hlp
new file mode 100644
index 00000000..0571850f
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgvall.hlp
@@ -0,0 +1,40 @@
+.help cqgvall Mar00 "Catquery Package"
+.ih
+NAME
+cqgvall -- get the catalog results field as a long integer value
+.ih
+SYNOPSIS
+
+nchars = cq_gvall (res, recno, fname, lval)
+
+.nf
+pointer res # the results descriptor
+int recno # the record number
+char fname # the field name
+long lval # the returned field value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls recno
+The record number.
+.le
+.ls fname
+The field name.
+.le
+.ls lval
+The returned long integer value.
+.le
+.ih
+DESCRIPTION
+Cq_gvall returns the requested field as a long integer value.
+Cq_gvall is an integer function which returns the number of characters
+that were successfully decoded as its function value. Zero is returned
+if the requested field could not be decoded.
+
+.ih
+SEE ALSO
+cqgval[csird]
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgvalr.hlp b/pkg/xtools/catquery/doc/cqgvalr.hlp
new file mode 100644
index 00000000..f7229841
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgvalr.hlp
@@ -0,0 +1,40 @@
+.help cqgvalr Mar00 "Catquery Package"
+.ih
+NAME
+cqgvalr -- get the catalog results field as a real value
+.ih
+SYNOPSIS
+
+nchars = cq_gvalr (res, recno, fname, rval)
+
+.nf
+pointer res # the results descriptor
+int recno # the record number
+char fname # the field name
+real rval # the returned field value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls recno
+The record number.
+.le
+.ls fname
+The field name.
+.le
+.ls rval
+The returned real value.
+.le
+.ih
+DESCRIPTION
+Cq_gvalr returns the requested field as a real value.
+Cq_gvalr is an integer function which returns the number of characters
+that were successfully decoded as its function value. Zero is returned
+if the requested field could not be decoded.
+
+.ih
+SEE ALSO
+cqgval[csild]
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqgvals.hlp b/pkg/xtools/catquery/doc/cqgvals.hlp
new file mode 100644
index 00000000..90f39544
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqgvals.hlp
@@ -0,0 +1,41 @@
+.help cqgvals Mar00 "Catquery Package"
+.ih
+NAME
+cqgvals -- get the catalog results field as a short integer
+.ih
+SYNOPSIS
+include <cq.h>
+
+nchars = cq_gvals (res, recno, fname, sval)
+
+.nf
+pointer res # the results descriptor
+int recno # the record number
+char fname # the field name
+short sval # the returned field value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls recno
+The record number.
+.le
+.ls fname
+The field name.
+.le
+.ls sval
+The returned short integer value.
+.le
+.ih
+DESCRIPTION
+Cq_gvals returns the requested field as a short integer value.
+Cq_gvals is an integer function which returns the number of characters
+that were successfully decoded as its function value. Zero is returned
+if the requested field could not be decoded.
+
+.ih
+SEE ALSO
+cqgval[cilrd]
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqhinfo.hlp b/pkg/xtools/catquery/doc/cqhinfo.hlp
new file mode 100644
index 00000000..62db280c
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqhinfo.hlp
@@ -0,0 +1,39 @@
+.help cqhinfo Mar00 "Catquery Package"
+.ih
+NAME
+cqhinfo -- get catalog results header parameter value by name
+.ih
+SYNOPSIS
+
+hparno = cq_hinfo (res, hname, hvalue, max_hvalue)
+
+.nf
+pointer res # the results descriptor
+char hname # the results header parameter name
+char hvalue # the returned header parameter value
+int max_hvalue # the maximum size of the header parameter value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls hname
+The name of the results header parameter for which the value is to be returned.
+.le
+.ls hvalue
+The returned results header parameter value.
+.le
+.ls max_hvalue
+The maximum size of the returned results header parameter value.
+.le
+.ih
+DESCRIPTION
+Cq_hinfo returns the value of the requested header parameter. Cq_hinfo is
+an integer function which returns the header parameter sequence number
+as its function value. Zero is returned if the header parameter
+cannot be found.
+.ih
+SEE ALSO
+cqhinfon
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqhinfon.hlp b/pkg/xtools/catquery/doc/cqhinfon.hlp
new file mode 100644
index 00000000..2654ce50
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqhinfon.hlp
@@ -0,0 +1,47 @@
+.help cqhinfon Mar00 "Catquery Package"
+.ih
+NAME
+cqhinfon -- get a catalog results header parameter value by number
+.ih
+SYNOPSIS
+
+hparno = cq_hinfon (res, hparno, hname, max_hname, hvalue, max_hvalue)
+
+.nf
+pointer res # the results descriptor
+int hparno # the results header parameter sequence number
+char hname # the returned results header parameter name
+int max_hname # the maximum size of the header parameter name
+char hvalue # the returned header parameter value
+int max_hvalue # the maximum size of the header parameter value
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls hparno
+The requested results header parameter sequence number.
+.le
+.ls hname
+The returned name of the results header parameter.
+.le
+.ls max_hname
+The maximum size of the results header parameter name.
+.le
+.ls hvalue
+The returned results header parameter value.
+.le
+.ls max_hvalue
+The maximum size of the results header parameter value.
+.le
+.ih
+DESCRIPTION
+Cq_hinfon returns the name and value of the requested results header
+parameter. Cq_hinfon is an integer function which returns the
+sequence number of the requested parameter as its function value.
+Zero is returned if the results header parameter is not found.
+.ih
+SEE ALSO
+cqhinfo
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqimclose.hlp b/pkg/xtools/catquery/doc/cqimclose.hlp
new file mode 100644
index 00000000..4c3d105b
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqimclose.hlp
@@ -0,0 +1,24 @@
+.help cqimclose Mar00 "Catquery Package"
+.ih
+NAME
+cqimclose -- free the survey results descriptor
+.ih
+SYNOPSIS
+
+call cq_imclose (imres)
+
+.nf
+pointer imres # the results descriptor
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The survey results descriptor.
+.le
+.ih
+DESCRIPTION
+Cq_imclose frees the survey results descriptor.
+.ih
+SEE ALSO
+cqimquery, cqfimquery
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqimquery.hlp b/pkg/xtools/catquery/doc/cqimquery.hlp
new file mode 100644
index 00000000..12e71506
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqimquery.hlp
@@ -0,0 +1,44 @@
+.help cqimquery Mar00 "Catquery Package"
+.ih
+NAME
+cqimquery -- query the image survey and return the results
+.ih
+SYNOPSIS
+
+imres = cq_imquery (cq, imname)
+
+.nf
+pointer cq # the configuration file descriptor
+pointer imname # the name of the output image file
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls imname
+The name of the output image file. At the output image produced by an
+image survey query must be a single FITS image. The image name
+should include the suffix ".fits" in order to make the image
+visible to IRAF image i/o.
+.le
+.ih
+DESCRIPTION
+Cq_imquery queries the image survey, creates an output image file, and
+returns the survey results descriptor. Cq_imquery is a pointer function
+which returns the survey results descriptor as its function value.
+Null is returned if an error occurs in the survey query.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before any catalog or image
+survey query can be made.
+
+Cq_nqpars and either cq_gqpar or cq_gqparn must be called to determine
+the number of query parameters and get each query parameter description.
+
+Cq_sqpar or cq_sqparn must be called to replace the default query parameter
+values with the calling program values.
+.ih
+SEE ALSO
+cqfimquery, cqimclose
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqistati.hlp b/pkg/xtools/catquery/doc/cqistati.hlp
new file mode 100644
index 00000000..beeec2c9
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqistati.hlp
@@ -0,0 +1,49 @@
+.help cqistati Mar00 "Catquery Package"
+.ih
+NAME
+cqistati -- get an image survey results integer parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+ival = cq_istati (imres, parameter)
+
+.nf
+pointer imres # the survey results descriptor
+int parameter # the parameter to be returned
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The survey results descriptor.
+.le
+.ls parameter
+The survey parameter to be returned. The currently supported survey
+parameters defined in cq.h are:
+.nf
+CQINQPARS # the number of query params used to produce results
+CQIMTYPE # the image results type, CQFITS
+CQIMRECSIZE # the image record size, 0 if undefined
+CQIMHSKIP # the number of leading bytes to skip, 0 if undefined
+CQIMHREAD # the number of leading dummy reads, 0 if undefined
+CQWCS # the image wcs status, CQ_WFITS or CQ_WDSS or CQ_WNONE
+CQNWCS # the number of wcs parameters, 0 if none defined
+CQNIMPARS # the number of image parameters, 0 if none defined
+.fi
+.le
+.ih
+DESCRIPTION
+Cq_istati returns the values of image survey results integer parameters.
+Cq_istati is an integer function which returns the value of the requested
+parameter as its function value.
+
+.ih
+NOTES
+More information about the image survey results parameters and their
+relationship to the parent image survey is available by typing
+"help surveys".
+
+.ih
+SEE ALSO
+cq_istats, cq_istatt
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqistats.hlp b/pkg/xtools/catquery/doc/cqistats.hlp
new file mode 100644
index 00000000..700717f0
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqistats.hlp
@@ -0,0 +1,56 @@
+.help cqistats Mar00 "Catquery Package"
+.ih
+NAME
+cqistats -- get an image survey results string parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+call cq_istats (imres, parameter, str, maxch)
+
+.nf
+pointer imres # the image survey results descriptor
+int parameter # the parameter to be returned
+char str # the returned string parameter value
+int maxch # the maximum size of the string parameter
+.fi
+.ih
+ARGUMENTS
+.ls res
+The image survey results descriptor.
+.le
+.ls parameter
+The image survey results parameter to be returned. The currently supported
+image survey parameters defined in cq.h are:
+
+.nf
+CQIMCATDB # the name of the parent configuration file
+CQIMCATNAME # the name of the parent image survey
+CQIMADDRESS # the network address used to produce the results
+CQIMQUERY # the query used to produce the results
+CQIMNAME # the output image name
+CQIQPNAMES # the results query parameter dictionary
+CQIQPVALUES # the results query parameter values dictionary
+CQIQPUNITS # the results query parameter units dictionary
+.fi
+.le
+.ls str
+Array containing returned string parameter value.
+.le
+.ls maxch
+The maximum size in characters of the returned string value.
+.le
+.ih
+DESCRIPTION
+Cq_istats returns the values of image survey results string parameters.
+
+.ih
+NOTES
+More information about the image survey results parameters and their
+relationship to the parent image survey is available by typing
+"help surveys".
+
+.ih
+SEE ALSO
+cq_istati, cq_istatt
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqistatt.hlp b/pkg/xtools/catquery/doc/cqistatt.hlp
new file mode 100644
index 00000000..0af9fb4a
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqistatt.hlp
@@ -0,0 +1,55 @@
+.help cqistatt Mar00 "Catquery Package"
+.ih
+NAME
+cqistatt -- get an image survey results text parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+nlines = cq_istatt (imres, parameter, text, maxch)
+
+.nf
+pointer imres # the survey results descriptor
+int parameter # the parameter to be returned
+char text # the returned text parameter value
+int maxch # the maximum size of the returned text parameter
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The results descriptor.
+.le
+.ls parameter
+The image survey parameter to be returned. The currently supported text
+image survey results text parameters defined in cq.h are:
+.nf
+CQIQPNAMES # the list of survey results query parameter names
+CQIQPVALUES # the list of survey results query parameter values
+CQIQPUNITS # the list of survey results query parameter units
+.fi
+.le
+.ls text
+String containing returned text parameter value. Text parameters differ
+from string parameters only in that they contain embedded newline
+characters.
+.le
+.ls maxch
+The maximum size in characters of the returned text value.
+.le
+.ih
+DESCRIPTION
+Cq_istatt returns the values of catalog results string parameters.
+
+The buffer size for the returned text parameters can be estimated by getting
+the value of the integer parameter CQRNQPARS, and multiplying it by the maximum
+buffer sizes CQ_SZ_QPNAME, CQ_SZ_QPVALUE, CQ_SZ_QPUNITS respectively.
+
+.ih
+NOTES
+More information about the survey results parameters and their relationship
+to the parent image survey is available by typing "help surveys".
+
+.ih
+SEE ALSO
+cq_istati, cq_istats
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqkinfo.hlp b/pkg/xtools/catquery/doc/cqkinfo.hlp
new file mode 100644
index 00000000..30d869a8
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqkinfo.hlp
@@ -0,0 +1,65 @@
+.help cqkinfo Mar00 "Catquery Package"
+.ih
+NAME
+cqkinfo -- get the results standard image parameter description by name
+.ih
+SYNOPSIS
+
+ipno = cq_kinfo (imres, pname, pkname, max_pkname, pkvalue, max_pkvalue,
+ pktype, pkunits, max_pkunits)
+
+.nf
+pointer imres # the survey results descriptor
+char pname # the image parameter name
+char pkname # the default image keyword name (INDEF if undefined)
+int max_pkname # the maximum size of the keyword name
+char pkvalue # the default parameter value (INDEF if undefined)
+int max_pkvalue # the maximum size of the parameter value
+int pktype # the parameter data type
+char pkunits # the parameter units (INDEF if undefined)
+int max_wpunits # the maximum size of the parameter units
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The image results descriptor.
+.le
+.ls pname
+The name of the image parameter for which the description is to be returned.
+.le
+.ls pkname
+The returned image parameter keyword name. Pkname is "INDEF" if undefined.
+.le
+.ls max_pkname
+The maximum size of the returned image parameter keyword name.
+.le
+.ls pkvalue
+The returned image parameter value. Pkvalue is "INDEF" if undefined.
+.le
+.ls max_pkvalue
+The maximum size of the returned image parameter value.
+.le
+.ls pktype
+The image parameter data type. The options are TY_DOUBLE, TY_REAL, TY_LONG,
+TY_INT, TY_SHORT, and TY_CHAR.
+.le
+.ls pkunits
+The returned image parameter units. Pkunits is "INDEF" if undefined.
+.le
+.ls max_pkunits
+The maximum size of the returned image parameter units.
+.le
+.ih
+DESCRIPTION
+Cq_kinfo returns the keyword name, default value, data type, and units
+of the requested standard image parameter. Cq_kinfo is an integer function
+which returns the sequence number of the standard image parameter as its
+function value. Zero is returned if the standard image parameter is not found.
+.ih
+NOTES
+For more information about the standard image parameters and their relationship
+to the image surveys configuration file type "help surveys".
+.ih
+SEE ALSO
+cqkinfon
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqkinfon.hlp b/pkg/xtools/catquery/doc/cqkinfon.hlp
new file mode 100644
index 00000000..e57f0d47
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqkinfon.hlp
@@ -0,0 +1,73 @@
+.help cqkinfon Mar00 "Catquery Package"
+.ih
+NAME
+cqkinfon -- get the results standard image parameter description by number
+.ih
+SYNOPSIS
+
+ipno = cq_kinfo (imres, ipno, pname, max_pname, pkname, max_pkname, pkvalue,
+ max_pkvalue, pktype, pkunits, max_pkunits)
+
+.nf
+pointer imres # the survey results descriptor
+int ipno # the image parameter sequence number
+char pname # the image parameter name
+int max_pname # the maximum size of the parameter name
+char pkname # the default image keyword name (INDEF if undefined)
+int max_pkname # the maximum size of the keyword name
+char pkvalue # the default parameter value (INDEF if undefined)
+int max_pkvalue # the maximum size of the parameter value
+int pktype # the parameter data type
+char pkunits # the parameter units (INDEF if undefined)
+int max_wpunits # the maximum size of the parameter units
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The image results descriptor.
+.le
+.ls ipno
+The sequence number of the requested parameter.
+.le
+.ls pname
+The returned image parameter name.
+.le
+.ls max_pname
+The maximum size of the returned parameter name.
+.le
+.ls pkname
+The returned image parameter keyword name. Pkname is "INDEF" if undefined.
+.le
+.ls max_pkname
+The maximum size of the returned image parameter keyword name.
+.le
+.ls pkvalue
+The returned image parameter value. Pkvalue is "INDEF" if undefined.
+.le
+.ls max_pkvalue
+The maximum size of the returned image parameter value.
+.le
+.ls pktype
+The image parameter data type. The options are TY_DOUBLE, TY_REAL, TY_LONG,
+TY_INT, TY_SHORT, and TY_CHAR.
+.le
+.ls pkunits
+The returned image parameter units. Pkunits is "INDEF" if undefined.
+.le
+.ls max_pkunits
+The maximum size of the returned image parameter units.
+.le
+.ih
+DESCRIPTION
+Cq_kinfon returns the keyword name, default value, data type, and units
+of the requested standard image parameter. Cq_kinfon is an integer function
+which returns the sequence number of the standard image parameter as its
+function value. Zero is returned if the standard image parameter is not found.
+.ih
+NOTES
+For more information about the standard image parameters and their relationship
+to the image surveys configuration file type "help surveys".
+.ih
+SEE ALSO
+cqkinfo
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqlocate.hlp b/pkg/xtools/catquery/doc/cqlocate.hlp
new file mode 100644
index 00000000..12f7cbc0
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqlocate.hlp
@@ -0,0 +1,35 @@
+.help cqlocate Mar00 "Catquery Package"
+.ih
+NAME
+cqlocate -- locate a catalog / survey record by name
+.ih
+SYNOPSIS
+
+catno = cq_locate (cq, catname)
+
+.nf
+pointer cq # the configuration file descriptor
+char catname # the name of the catalog / survey record to be located
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls catname
+The name of the catalog / survey record to be located.
+.le
+.ih
+DESCRIPTION
+Cq_locate locates a catalog / survey record in the configuration file by
+name. Cq_locate is an integer function which returns the catalog / survey
+record sequence number as its function value. Zero is returned if the catalog
+record is not located.
+.ih
+Cq_locate is used to determine whether the requested record exists. It does
+not set the current catalog / survey. This must be done with a call to
+cq_setcat or cq_setcatn.
+.ih
+SEE ALSO
+cqlocaten, cqsetcat, cqsetcatn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqlocaten.hlp b/pkg/xtools/catquery/doc/cqlocaten.hlp
new file mode 100644
index 00000000..ca7011b0
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqlocaten.hlp
@@ -0,0 +1,47 @@
+.help cqlocaten Mar00 "Catquery Package"
+.ih
+NAME
+cqlocaten -- locate a catalog / survey record by number
+.ih
+SYNOPSIS
+
+catno = cq_locaten (cq, catno, catname, maxch)
+
+.nf
+pointer cq # the configuration file descriptor
+int catno # the number of the catalog / survey to be located
+char catname # the name of the located catalog
+int maxch # the maximum size of the name of the located catalog
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls catno
+The sequence number of the catalog / survey record to be located.
+.le
+.ls catname
+The name of the located catalog.
+.le
+.ls maxch
+The maximum size of the name of the located catalog.
+.le
+.ih
+DESCRIPTION
+Cq_locaten locates a catalog / survey record in the configuration file by
+sequence number. Cq_locaten is an integer function which returns the catalog
+/ survey record sequence number as its function value. Zero is returned
+if the catalog record is not located. Cq_locaten also returns the name of the
+located catalog in the array catname.
+
+.ih
+NOTES
+Cq_locaten is used to determine whether the requested record exists. It does
+not set the current catalog / survey. This must be done with a call to
+cq_setcat or cq_setcatn.
+
+.ih
+SEE ALSO
+cqlocate, cqsetcat, cqsetcatn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqmap.hlp b/pkg/xtools/catquery/doc/cqmap.hlp
new file mode 100644
index 00000000..1c87530d
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqmap.hlp
@@ -0,0 +1,33 @@
+.help cqmap Mar00 "Catquery Package"
+.ih
+NAME
+cq_map -- map the catalog / survey configuration file
+.ih
+SYNOPSIS
+cq = cq_map (file, mode)
+
+.nf
+char file # the catalog / survey configuration file
+int mode # the file access mode
+.fi
+.ih
+ARGUMENTS
+.ls file
+The name of the catalog / survey configuration file.
+.le
+.ls mode
+The configuration file access mode. At present only READ_ONLY is supported.
+.le
+.ih
+DESCRIPTION
+Cq_map maps the record structure of the catalog / survey configuration file.
+Cq_map is a pointer function which returns the configuration file descriptor
+to the calling program.
+.ih
+NOTES
+Cq_map returns a NULL configuration file descriptor if an error occurs in
+the mapping process.
+.ih
+SEE ALSO
+cqunmap
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqnqpars.hlp b/pkg/xtools/catquery/doc/cqnqpars.hlp
new file mode 100644
index 00000000..63ac4ca8
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqnqpars.hlp
@@ -0,0 +1,32 @@
+.help cqnqpars Mar00 "Catquery Package"
+.ih
+NAME
+cqnqpars -- Get the number of query parameters
+.ih
+SYNOPSIS
+
+nqpars = cq_nqpars (cq)
+
+.nf
+pointer cq # the configuration file descriptor
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ih
+DESCRIPTION
+Cq_nqpars returns the number of expected catalog / survey query parameters.
+Cq_nqpars is an integer function which returns the number of expected
+catalog / survey parameters as its function value. The number of query
+parameters may be zero if the query is non-programmable. Not all query
+parameters are programmable.
+.ih
+NOTES
+The routines cq_setcat or cq_setcatn must be called before the number of
+query parameters can be requested.
+.ih
+SEE ALSO
+cqgqpar, cqgqparn, cqsqpar, cqsqparn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqquery.hlp b/pkg/xtools/catquery/doc/cqquery.hlp
new file mode 100644
index 00000000..797cd72c
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqquery.hlp
@@ -0,0 +1,35 @@
+.help cqquery Mar00 "Catquery Package"
+.ih
+NAME
+cqquery -- query a catalog and return the results
+.ih
+SYNOPSIS
+
+res = cq_query (cq)
+
+.nf
+pointer cq # the configuration file descriptor
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ih
+DESCRIPTION
+Cq_query is a pointer function which returns the catalog results descriptor
+as its function value. NULL is returned if an error occurs in the catalog
+query.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before any catalog query can be made.
+
+Cq_nqpars and either cq_gqpar or cq_gqparn must be called to determine the
+number of query parameters and get each query parameter description.
+
+Cq_sqpar or cq_sqparn must be called to replace the default query parameter
+values with the calling program values.
+.ih
+SEE ALSO
+cqfquery, cqrclose
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqrclose.hlp b/pkg/xtools/catquery/doc/cqrclose.hlp
new file mode 100644
index 00000000..98dfb4b5
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqrclose.hlp
@@ -0,0 +1,24 @@
+.help cqrclose Mar00 "Catquery Package"
+.ih
+NAME
+cqrclose -- free the catalog results descriptor
+.ih
+SYNOPSIS
+
+call cq_rclose (res)
+
+.nf
+pointer res # the results descriptor
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ih
+DESCRIPTION
+Cq_rclose frees the results descriptor.
+.ih
+SEE ALSO
+cqquery, cqfquery
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqrstati.hlp b/pkg/xtools/catquery/doc/cqrstati.hlp
new file mode 100644
index 00000000..943a5218
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqrstati.hlp
@@ -0,0 +1,53 @@
+.help cqrstati Mar00 "Catquery Package"
+.ih
+NAME
+cqrstati -- get a catalog results integer parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+ival = cq_rstati (res, parameter)
+
+.nf
+pointer res # the results descriptor
+int parameter # the parameter to be returned
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls parameter
+The catalog results parameter to be returned. The currently supported
+catalog results parameters defined in cq.h are:
+.nf
+CQRNQPARS # the number of query params used to produce results
+CQRTYPE # the data type of the results, CQSTEXT or CQBTEXT
+CQRNRECS # the number of records in the results
+CQRECSIZE # the record size, 0 if undefined
+CQRHSKIP # the number of header records to skip, 0 if undefined
+CQRTSKIP # the number of trailer records to skip, 0 if undefined
+CQRTRIML # the number of leading chars to skip, 0 if undefined
+CQRTRIMR # the number of trailing chars to skip, 0 if undefined
+CQNHEADER # the number of header keyword value pairs, 0 if none defined
+CQNFIELDS # the number of fields in a record
+CQRECPTR # the current record number, BOF or number or EOF
+.fi
+.le
+.ih
+DESCRIPTION
+
+Cq_rstati returns the values of catalog results integer parameters.
+Cq_rstati is an integer function which returns the value of the requested
+parameter as its function value.
+
+.ih
+NOTES
+
+More information about the catalog results parameters and their relationship
+to the parent catalog is available by typing "help catalogs".
+
+.ih
+SEE ALSO
+cqrstats, cqrstatt
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqrstats.hlp b/pkg/xtools/catquery/doc/cqrstats.hlp
new file mode 100644
index 00000000..45487dfd
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqrstats.hlp
@@ -0,0 +1,54 @@
+.help cqrstats Mar00 "Catquery Package"
+.ih
+NAME
+cqsrtats -- get a catalog results string parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+call cq_rstats (res, parameter, str, maxch)
+
+.nf
+pointer res # the results descriptor
+int parameter # the parameter to be returned
+char str # the returned string parameter
+int maxch # the maximum size of the returned string parameter
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls parameter
+The catalog results parameter to be returned. The currently supported
+catalog results parameters defined in cq.h are:
+
+.nf
+CQRCATDB # the name of the parent configuration file
+CQRCATNAME # the name of the parent catalog
+CQRADDRESS # the network address used to produce the results
+CQRQUERY # the network query used to produce the results
+CQRQPNAMES # the results query parameter dictionary
+CQRQPVALUES # the results query parameter values dictionary
+CQRQPUNITS # the results query parameter units dictionary
+.fi
+.le
+.ls str
+Array containing returned string parameter value.
+.le
+.ls maxch
+The maximum size in characters of the returned string parameter value.
+.le
+.ih
+DESCRIPTION
+Cq_rstats returns the values of catalog results string parameters.
+
+.ih
+NOTES
+More information about the catalog results parameters and their relationship
+to the parent catalog is available by typing "help catalogs".
+
+.ih
+SEE ALSO
+cqrstati, cqrstatt
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqrstatt.hlp b/pkg/xtools/catquery/doc/cqrstatt.hlp
new file mode 100644
index 00000000..cbb13c44
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqrstatt.hlp
@@ -0,0 +1,56 @@
+.help cqrstatt Mar00 "Catquery Package"
+.ih
+NAME
+cqrstatt -- get a catalog results text parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+nlines = cq_rstatt (res, parameter, text, maxch)
+
+.nf
+pointer res # the results descriptor
+int parameter # the parameter to be returned
+char text # the returned text parameter value
+int maxch # the maximum size of the returned text parameter
+.fi
+.ih
+ARGUMENTS
+.ls res
+The results descriptor.
+.le
+.ls parameter
+The catalog results parameter to be returned. The currently supported
+catalog results text parameters defined in cq.h are:
+
+.nf
+CQRQPNAMES # the list of catalog results query parameter names
+CQRQPVALUES # the list of catalog results query parameter values
+CQRQPUNITS # the list of catalog results query parameter units
+.fi
+.le
+.ls text
+String containing returned text parameter value. Text parameters differ
+from string parameters only in that they contain embedded newline
+characters.
+.le
+.ls maxch
+The maximum size in characters of the returned text value.
+.le
+.ih
+DESCRIPTION
+Cq_rstatt returns the values of catalog results string parameters.
+
+The buffer size for the returned text parameters can be estimated by getting
+the value of the integer parameter CQRNQPARS, and multiplying it by the maximum
+ buffer sizes CQ_SZ_QPNAME, CQ_SZ_QPVALUE, CQ_SZ_QPUNITS respectively.
+
+.ih
+NOTES
+More information about the catalog results parameters and their relationship
+to the parent catalog is available by typing "help catalogs".
+
+.ih
+SEE ALSO
+cq_rstati, cq_rstats
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqsetcat.hlp b/pkg/xtools/catquery/doc/cqsetcat.hlp
new file mode 100644
index 00000000..1a6a4f62
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqsetcat.hlp
@@ -0,0 +1,35 @@
+.help cqsetcat Mar00 "Catquery Package"
+.ih
+NAME
+cqsetcat -- set the current catalog / survey by name
+.ih
+SYNOPSIS
+
+catno = cq_setcat (cq, catname)
+
+.nf
+pointer cq # the configuration file descriptor
+char catname # the name of the catalog to be set
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls catname
+The name of the catalog / survey to be set.
+.le
+.ih
+DESCRIPTION
+Cq_setcat sets the current catalog. Cq_setcat is an integer function
+which returns the sequence number of the requested catalog / survey as
+its function value. Zero is returned if the requested catalog / survey
+cannot be set.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before any catalog or survey query can
+be made.
+.ih
+SEE ALSO
+cqlocate, cqlocaten, cqsetcatn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqsetcatn.hlp b/pkg/xtools/catquery/doc/cqsetcatn.hlp
new file mode 100644
index 00000000..dac93a00
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqsetcatn.hlp
@@ -0,0 +1,35 @@
+.help cqsetcatn Mar00 "Catquery Package"
+.ih
+NAME
+cqsetcatn -- set the current catalog / survey by number
+.ih
+SYNOPSIS
+
+catno = cq_setcatn (cq, catno)
+
+.nf
+pointer cq # the configuration file descriptor
+int catno # the sequence number of the catalog / survey to be set
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls catno
+The sequence number of the catalog / survey to be set.
+.le
+.ih
+DESCRIPTION
+Cq_setcatn sets the current catalog / survey by number. Cq_setcatn is an
+integer function which returns the catalog / survey
+record sequence number as its function value. Zero is returned if the catalog
+record is not set.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before any catalog or image
+survey query can be made.
+.ih
+SEE ALSO
+cqlocate, cqlocaten, cqsetcat
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqsqpar.hlp b/pkg/xtools/catquery/doc/cqsqpar.hlp
new file mode 100644
index 00000000..57a86255
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqsqpar.hlp
@@ -0,0 +1,39 @@
+.help cqsqpar Mar00 "Catquery Package"
+.ih
+NAME
+cqsqpar -- set the value of a query parameter by name
+.ih
+SYNOPSIS
+
+parno = cq_sqpar (cq, pname, value)
+
+.nf
+pointer cq # the configuration file descriptor
+char pname # the query parameter name
+char value # the query parameter value
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls pname
+The name of the query parameter to be set.
+.le
+.ls value
+The new query parameter value.
+.le
+.ih
+DESCRIPTION
+Cq_sqpar sets the value of the named query parameter. Qq_sqpar is an integer
+function which returns the sequence number of the requested parameter
+as its function value. Zero is returned if the requested query parameter
+is not found.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before a query parameter value
+can be changed.
+.ih
+SEE ALSO
+cqnqpars, cqgpar, cqgqparn, cqsqparn
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqsqparn.hlp b/pkg/xtools/catquery/doc/cqsqparn.hlp
new file mode 100644
index 00000000..f0cc92fc
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqsqparn.hlp
@@ -0,0 +1,39 @@
+.help cqsqparn Mar00 "Catquery Package"
+.ih
+NAME
+cqsqparn -- set the value of a query parameter by number
+.ih
+SYNOPSIS
+
+parno = cq_sqparn (cq, parno, value)
+
+.nf
+pointer cq # the configuration file descriptor
+int parno # the sequence number of the query parameter
+char value # the query parameter value
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls parno
+The sequence number of the query parameter to be set.
+.le
+.ls value
+The new query parameter value.
+.le
+.ih
+DESCRIPTION
+Cq_sqpar sets the value of the named query parameter. Qq_sqpar is an integer
+function which returns the sequence number of the requested parameter
+as its function value. Zero is returned if the requested query parameter
+is not found.
+.ih
+NOTES
+Cq_setcat or cq_setcatn must be called before a query parameter value
+can be changed.
+.ih
+SEE ALSO
+cqnqpars, cqgqpar, cqgparn, cqsqpar
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqstati.hlp b/pkg/xtools/catquery/doc/cqstati.hlp
new file mode 100644
index 00000000..15fe1d9e
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqstati.hlp
@@ -0,0 +1,61 @@
+.help cqstati Mar00 "Catquery Package"
+.ih
+NAME
+cqstati -- get a catalog / survey integer parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+ival = cq_stati (cq, parameter)
+
+.nf
+pointer cq # the configuration file descriptor
+int parameter # the parameter to be returned
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration file descriptor.
+.le
+.ls parameter
+The parameter to be returned. The currently supported parameters defined
+in cq.h are:
+.nf
+ CQNRECS # the number of catalog / survey file records
+ CQSZRECLIST # the length of the record name list in chars
+ CQCATNO # the current catalog number
+.fi
+.le
+.ih
+DESCRIPTION
+Cq_stati returns the values of catalog / survey integer parameters.
+Cq_stati is an integer function which returns the value of the requested
+parameter as its function value.
+
+.ih
+NOTES
+The current catalog number CQCATNO is 0 if the current catalog has not been set
+by a call to cq_setcat or cq_setcatn.
+
+The length of the record list CQSZRECLIST can be used to preallocate the buffer
+required to fetch the text parameter CQRECLIST.
+
+.ih
+EXAMPLES
+.nf
+ include <cq.h>
+
+ int cq_stati()
+
+ ....
+
+ sz_buf = cq_stati (cq, CQSZRECLIST)
+ call malloc (buf, sz_buf, TY_CHAR)
+ nlines = cq_statt (cq, CQRECLIST, Memc[buf], sz_buf)
+
+ ...
+.fi
+.ih
+SEE ALSO
+cq_stats, cq_statt
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqstats.hlp b/pkg/xtools/catquery/doc/cqstats.hlp
new file mode 100644
index 00000000..1aabc590
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqstats.hlp
@@ -0,0 +1,48 @@
+.help cqstats Mar00 "Catquery Package"
+.ih
+NAME
+cqstats -- get a catalog / survey string parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+call cq_stats (cq, parameter, str, maxch)
+
+.nf
+pointer cq # the configuration file descriptor
+int parameter # the parameter to be returned
+char str # the returned string parameter value
+int maxch # the maximum size of the returned string parameter
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The catalog / survey configuration file descriptor.
+.le
+.ls parameter
+The parameter to be returned. The string parameters defined
+in cq.h are:
+.nf
+ CQCATDB # the name of the configuration file
+ CQCATNAME # the name of the current catalog
+.fi
+.le
+.ls str
+Array containing returned string parameter.
+.le
+.ls maxch
+The maximum size of the returned string parameter.
+.le
+.ih
+DESCRIPTION
+Cq_stats returns the requested catalog / survey string parameters.
+
+.ih
+NOTES
+The current catalog name CQCATNAME is "" if the current catalog has not been
+set by a call to cq_setcat or cq_setcatn.
+
+.ih
+SEE ALSO
+cq_stati, cq_statt
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqstatt.hlp b/pkg/xtools/catquery/doc/cqstatt.hlp
new file mode 100644
index 00000000..082f5757
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqstatt.hlp
@@ -0,0 +1,45 @@
+.help cqstatt Mar00 "Catquery Package"
+.ih
+NAME
+cqstatt -- get a catalog / survey text parameter
+.ih
+SYNOPSIS
+include <cq.h>
+
+nlines = cq_statt (cq, parameter, text, maxch)
+
+.nf
+pointer cq # the configuration file descriptor
+int parameter # the parameter to be returned
+char text # the returned text parameter value
+int maxch # the maximum size of the returned text parameter
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The configuration catalog / survey file descriptor.
+.le
+.ls parameter
+The parameter to be returned. The text parameters defined in cq.h are:
+.nf
+define CQRECLIST # the catalog configuration file record list
+.fi
+.le
+.ls text
+The returned text parameter value. Text parameters differ
+from string parameters only in that they may contain embedded newline
+characters.
+.le
+.ls maxch
+The maximum size in characters of the returned text.
+.le
+.ih
+DESCRIPTION
+Cq_statt returns the requested catalog / survey text parameters.
+Cq_statt is an integer function which returns the numbers of lines in the
+requested parameter value as its function value.
+
+.ih
+SEE ALSO
+cq_stati, cq_stats
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqunmap.hlp b/pkg/xtools/catquery/doc/cqunmap.hlp
new file mode 100644
index 00000000..e33128cf
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqunmap.hlp
@@ -0,0 +1,26 @@
+.help cqunmap Mar00 "Catquery Package"
+.ih
+NAME
+cq_unmap -- unmap the catalog / survey configuration file
+.ih
+SYNOPSIS
+call cq_unmap (cq)
+
+.nf
+pointer cq # the configuration file descriptor
+.fi
+.ih
+ARGUMENTS
+.ls cq
+The catalog / survey configuration file descriptor.
+.le
+.ih
+DESCRIPTION
+Unmap the configuration file.
+.ih
+NOTES
+Cq_unmap should be called when catalog / survey access is terminated.
+.ih
+SEE ALSO
+cqmap
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqwinfo.hlp b/pkg/xtools/catquery/doc/cqwinfo.hlp
new file mode 100644
index 00000000..9bdc7edf
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqwinfo.hlp
@@ -0,0 +1,65 @@
+.help cqwinfo Mar00 "Catquery Package"
+.ih
+NAME
+cqwinfo -- get the results wcs parameter description by name
+.ih
+SYNOPSIS
+
+wcsno = cq_winfo (imres, wname, wkname, max_wkname, wkvalue, max_wkvalue,
+ wktype, wkunits, max_wkunits)
+
+.nf
+pointer imres # the survey results descriptor
+char wname # the wcs parameter name
+char wkname # the default wcs keyword name (INDEF if undefined)
+int max_wkname # the maximum size of the returned keyword name
+char wkvalue # the default wcs parameter value (INDEF if undefined)
+int max_wkvalue # the maximum size of the parameter value
+int wktype # the wcs parameter data type
+char wkunits # the wcs parameter units (INDEF if undefined)
+int max_wkunits # the maximum size of the returned wcs parameter units
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The image results descriptor.
+.le
+.ls wname
+The name of the wcs parameter for which the description is to be returned.
+.le
+.ls wkname
+The returned wcs parameter keyword name. Wkname is "INDEF" if undefined.
+.le
+.ls max_wkname
+The maximum size of the returned wcs parameter keyword name.
+.le
+.ls wkvalue
+The returned wcs parameter value. Wkvalue is "INDEF" if undefined.
+.le
+.ls max_wkvalue
+The maximum size of the returned wcs parameter value.
+.le
+.ls wktype
+The wcs parameter data type. The options are TY_DOUBLE, TY_REAL, TY_LONG,
+TY_INT, TY_SHORT, and TY_CHAR.
+.le
+.ls wkunits
+The returned wcs parameter units. Wkunits is "INDEF" if undefined.
+.le
+.ls max_wkunits
+The maximum size of the returned wcs parameter units.
+.le
+.ih
+DESCRIPTION
+Cq_winfo returns the keyword name, default value, data type, and units
+of the requested wcs parameter. Cq_winfo is an integer function
+which returns the sequence number of the wcs parameter as its function
+value. Zero is returned if the wcs parameter is not found.
+.ih
+NOTES
+For more information about the wcs parameters and their relationship
+to the image surveys configuration file type "help surveys".
+.ih
+SEE ALSO
+cqwinfon
+.endhelp
diff --git a/pkg/xtools/catquery/doc/cqwinfon.hlp b/pkg/xtools/catquery/doc/cqwinfon.hlp
new file mode 100644
index 00000000..04fab301
--- /dev/null
+++ b/pkg/xtools/catquery/doc/cqwinfon.hlp
@@ -0,0 +1,75 @@
+.help cqwinfon Mar00 "Catquery Package"
+.ih
+NAME
+cqwinfon -- get the results wcs description by number
+.ih
+SYNOPSIS
+
+wcsno = cq_winfo (imres, wcsno, wname, max_wname, wkname, max_wkname, wkvalue,
+ max_wkvalue, wktype, wkunits, max_wkunits)
+
+.nf
+pointer imres # the image results descriptor
+int wcsno # the wcs parameter sequence number
+char wname # the wcs parameter name
+int max_wname # the maximum size of the wcs parameter name
+char wkname # the default wcs keyword name (INDEF if undefined)
+int max_wkname # the maximum size of the keyword name
+char wkvalue # the default wcs keyword value (INDEF if undefined)
+int max_wkvalue # the maximum size of the parameter value
+int wktype # the wcs parameter data type
+char wkunits # the wcs parameter units (INDEF if undefined)
+int max_wkunits # the maximum size of the wcs parameter units
+.fi
+.ih
+ARGUMENTS
+.ls imres
+The image results descriptor.
+.le
+.ls wcsno
+The sequence number of the wcs parameter to be returned.
+.le
+.ls wname
+The returned wcs parameter name.
+.le
+.ls max_wname
+The maximum size of the returned wcs parameter name.
+.le
+.ls wkname
+The returned wcs parameter keyword name.
+.le
+.ls max_wkname
+The maximum size of the returned wcs parameter keyword name.
+.le
+.ls wkvalue
+The returned wcs parameter value.
+.le
+.ls max_wkvalue
+The maximum size of the returned wcs parameter value.
+.le
+.ls wktype
+The returned wcs parameter type. The options are TY_DOUBLE, TY_REAL, TY_LONG,
+TY_INT, TY_SHORT, and TY_CHAR.
+.le
+.ls wkunits
+The returned wcs parameter units.
+.le
+.ls max_wkunits
+The maximum size of the returned wcs parameter units.
+.le
+.ih
+DESCRIPTION
+Cq_winfon returns the parameter name, keyword name, default value, data type,
+and units of the requested wcs parameter. Cq_winfon is an integer function
+which returns the sequence number of the wcs parameter as its function
+value. Zero is returned if the wcs parameter is not found.
+
+.ih
+NOTES
+For more information about the wcs parameters and their relationship
+to the image surveys configuration file type "help surveys".
+
+.ih
+SEE ALSO
+cqwinfo
+.endhelp
diff --git a/pkg/xtools/catquery/doc/surveys.hlp b/pkg/xtools/catquery/doc/surveys.hlp
new file mode 100644
index 00000000..bfc50e69
--- /dev/null
+++ b/pkg/xtools/catquery/doc/surveys.hlp
@@ -0,0 +1,197 @@
+.help surveys Mar00 catquery
+.ih
+NAME
+surveys -- describe the image survey configuration file
+.ih
+USAGE
+help surveys
+.ih
+IMAGE SURVEYS
+
+An image survey contains image data for a large region of the sky from which
+image data for small regions of the sky can be extracted.
+Image surveys may be installed locally or accessed remotely. Each
+supported survey must have a record in the image survey configuration file,
+which define the image survey network address, the image survey query format,
+and the image survey query output format.
+
+.ih
+THE IMAGE SURVEY CONFIGURATION FILE
+
+A record in the image survey configuration file specifies the network address,
+the query format, and the output image format for each supported image server.
+Each image server is accessed via a record name of the form
+"survey@server", e.g. "dss2@cadc". Adding support for a new image survey
+server or responding to changes in the behavior of an existing image survey
+server requires either adding a new record to the configuration file or
+changing an existing record. No modification to the survey access
+code should be required.
+
+The server network address tells the image survey access code where and how to
+connect to the network. Each network address has the syntax
+"domain:port:address:flags" e.g. "inet:80:www.noao.edu:text".
+
+The query format specifies the form of the query server string, and the
+names, default values, units, and format of the query parameters. A set of
+standard query parameter names are reserved for accessing image surveys
+including "ra", "dec", "radius", "width", "xwidth", and "ywidth".
+
+The server output format specifies the format of the expected server output:
+including the image type, the world coordinate system type, and the
+standard keyword set. At present the only supported image type is FITS,
+the only supported world coordinate system types are FITS and DSS,
+and the standard keyword set includes keyword that are required or
+useful for astrometric analysis tasks.
+
+.ih
+SAMPLE IMAGE SURVEY RECORD
+
+The following example illustrates the main features of a typical image survey
+configuration file record.
+
+.nf
+begin dss1@cadc
+address inet:80:cadcwww.hia.nrc.ca:binary
+query GET /cadcbin/dss-server?ra=%-s&dec=%-s&mime-type=application/x-fits&x=%-s
+&y=%-s HTTP/1.0\n\n
+nquery 5
+ ra 00:00:00.00 hours %0.2h
+ dec +00:00:00.0 degrees %0.1h
+ xwidth 10.0 minutes %0.1f
+ ywidth 10.0 minutes %0.1f
+ qsystem J2000.0 INDEF %s
+type fits
+wcs dss
+nwcs 10
+ wxref INDEF INDEF d pixels
+ wyref INDEF INDEF d pixels
+ wxmag INDEF 1.701 d arcsec/pixel
+ wymag INDEF 1.701 d arcsec/pixel
+ wxrot INDEF 180.0 d degrees
+ wyrot INDEF 0.0 d degrees
+ wraref OBJCTRA INDEF d hms
+ wdecref OBJCTDEC INDEF d dms
+ wproj INDEF tan c INDEF
+ wsystem INDEF J2000 c INDEF
+nkeys 13
+ observat INDEF Palomar c INDEF
+ esitelng INDEF +116:51:46.80 d degrees
+ esitelat INDEF +33:21:21.6 d degrees
+ esitealt INDEF 1706 r meters
+ esitetz INDEF 8 r INDEF
+ emjdobs INDEF INDEF d INDEF
+ edatamin INDEF INDEF r ADU
+ edatamax INDEF INDEF r ADU
+ gain INDEF INDEF r e-/ADU
+ erdnoise INDEF INDEF r e-
+ ewavlen INDEF INDEF r angstroms
+ etemp INDEF INDEF r degrees
+ epress INDEF INDEF r mbars
+.fi
+
+The beginning of a new image survey record is indicated by a line
+of the form \fI"begin surveyname"\fR where surveyname is a unique name of the
+form \fI"survey@server"\fR. Any number of unique names can access the same
+image survey. If more than one record with the same name exists in the
+configuration file the last record is the one read. Multiple entries for
+the same catalog can be used to define a different query format or different
+output type. For example if an image server supports more than one output
+formats then two records with two different queries can be defined,
+one which outputs one format, and another which outputs a different one.
+
+The \fIaddress\fR, \fIquery\fR and \fInquery\fR keywords are required, and
+define the network address, query command format and query parameters for
+the image survey.
+
+The \fIaddress\fR keyword "domain", "port", and "flags" fields are almost
+always "inet", "80", and "binary" respectively for image surveys, so
+the only field that has to be defined is the address field
+":cadcwww.hia.nrc.ca" in this case.
+
+The \fIquery\fR keyword defines the query command whose form is server
+dependent. The query parameter values are encoded via the %-s formatting
+strings. The calling program must encode the user query parameter values
+into a set a strings which then replace the -%s format statement in the
+query string.
+
+The number of query parameters is defined by the \fInquery\fR parameter. The
+number of query parameters must be greater than or equal to the number of "-%s"
+strings in the query keyword value. The name, default value, units,
+and format of each query parameter are listed below the nquery keyword
+one query parameter description per line. The query parameters should be
+defined in the configuration file in the same order that they appear
+in the query keyword value. Alert readers will notice that in the example above
+the number of query parameters is 5 but there are only 4 "%-s" strings
+in the query keyword value. In this example the qsystem query parameter which
+defined the coordinate system of the ra and dec query parameter values is
+fixed at J2000. For some servers this parameter may be a true query parameter,
+i.e. the server may accept coordinates in B1950 or J2000 or some other
+coordinate system.
+
+For "astrometric" image surveys the reserved query parameter names "ra", "dec",
+and "qsystem" should be used to define the extraction region center and its
+coordinate system, and one or more of "radius", "width", "xwidth", and
+"ywidth" should be used to define the extraction region size. The units
+of "ra" should be "hours", "degrees", or "radians", the units of dec
+should be "degrees" or "radians", and units of the size query parameter
+should be "degrees" or "minutes". The qsystem parameter value may be
+any one of the supported celestial coordinate systems. The most common
+qsystem values are "icrs", "J2000", or "B1950". The query parameter
+formats are used to convert numerical values supplied by the calling
+program to string values that can be passed to the query string.
+It should be emphasized that the reserved query parameter names and units
+are conventions that are adopted to simplify writing the configuration
+file and astrometric applications. They are not part of the image survey
+access API itself.
+
+The \fItype\fR keyword defines the format of the output image data. At
+present only FITS data is supported.
+
+The \fIwcs\fR keyword defines the wcs status of the image. The options
+are "fits" for an image which contains a valid FITS wcs, "dss" for an image
+which contains a valid DSS wcs, and "none" for an image contains no
+standard wcs information.
+
+The \fInwcs\fR keyword defines the number of following wcs parameters. Each
+wcs parameter definition consists of a standard keyword name, the actual
+keyword name or INDEF if no keyword exists, the default keyword value or
+INDEF is there is no default value, the data type which must be one of
+d(double), r(real), (i)integer, or c(character), and the units which may
+be INDEF if they are undefined.
+
+The reserved standard wcs keyword names \fIwxref\fR,
+\fIwyref\fR, \fIwxmag\fR, \fIwymag\fR, \fIwxref\fR, \fIwyref\fR, \fIwraref\fR,
+\fIwdecref\fR, \fIwproj\fR, and \fIwsystem\fR, should be used to define the
+pixel reference coordinates, the pixel scale in "/ pixel, the coordinate
+system rotation and skew in degrees, the reference coordinates in some celestial
+coordinate system, the image projection, and the celestial coordinate system.
+The units of wraref may be "hours", "degrees" or "radians" and the units
+of wdecref may be "hours" and "degrees". At present the units for the
+remaining wcs keywords should be regarded as fixed. It should be emphasized
+that the reserved standard wcs parameter names and units are conventions that
+are adopted to simplify writing the configuration file and astrometric image
+applications. They are not part of the image survey access API itself.
+
+The \fInkeys\fR keyword defines the number of following standard keyword
+parameters. Each parameter definition consists of a standard keyword name,
+the actual keyword name or INDEF is no keyword exists, the default value
+or INDEF is there is no default value, the data type which must be one of
+d(double), r(real), (i)integer, or c(character), and the parameter units
+which may be INDEF if they are undefined.
+
+The reserved standard keyword names \fIobservat\fR,
+\fIesitelng\fR, \fIesitelat\fR, \fIesitelat\fR, and \fIesitetz\fR should be
+used to define the site, \fIemjdobs\fR, \fIewavelen\fR, \fIetemp\fR,
+and \fIepress\fR to define the time and physical conditions of the observation,
+ and \fIedatamin\fR, \fIedatamax\fR, \fIegain\fR, and \fIerdnoise\fR
+to define the detector parameters. At present the units of all these
+parameters should be regarded as fixed.
+It should be emphasized that the reserved standard header parameter names and
+units are conventions that are adopted to simplify writing the configuration
+file and astrometric image applications. They are not part of the image survey
+access API itself.
+
+.ih
+SEE ALSO
+ccsystems, catalogs
+.endhelp