aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbparse.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /pkg/tbtables/tbparse.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/tbtables/tbparse.x')
-rw-r--r--pkg/tbtables/tbparse.x67
1 files changed, 67 insertions, 0 deletions
diff --git a/pkg/tbtables/tbparse.x b/pkg/tbtables/tbparse.x
new file mode 100644
index 00000000..e47db257
--- /dev/null
+++ b/pkg/tbtables/tbparse.x
@@ -0,0 +1,67 @@
+include <ctype.h>
+include <tbset.h>
+
+# tbparse -- extract different portions of table name
+# For a table in a QPOE file, the user may give a table name such as
+# stuff.qp[abc], where "stuff.qp" is the file name, and "abc" is the name
+# of the QPOE parameter containing the table.
+#
+# For a FITS file, the user may give either the extension name (the value
+# of the EXTNAME keyword) or the extension number. The convention for
+# extension number is that the first extension after the primary HDU is
+# number one. This differs from the convention in the FITSIO interface,
+# where the primary HDU is number one, so other routines in the table I/O
+# interface (tbfopn and tbfnew) will add one to that number. If the
+# extension was specified by name rather than number, the HDU number will
+# be set to -1. If no extension name or number was specified, the value
+# returned as the HDU number will be -1.
+#
+# If the input name has one or more bracketed expressions at the end of the
+# name (extension name, etc, for a FITS file, or row or column selectors),
+# the bracketed expressions will be returned in the extname string. Note
+# that even if this is just an EXTNAME, the string will include the brackets.
+#
+# Phil Hodge, 22-Dec-1994 Subroutine created based on qp_parse.
+# Phil Hodge, 7-Sep-1995 Allow ".??f" as an extension for a FITS file.
+# Phil Hodge, 22-Jan-1996 Allow escaped [ within the file name.
+# Phil Hodge, 2-Feb-1996 Move the guts of this routine to tbnparse.
+# Phil Hodge, 30-Sep-1997 Change calling sequence of tbnparse.
+# Phil Hodge, 12-Apr-1999 Remove type from calling sequence;
+# use SZ_FNAME instead of SZ_LINE for local buffers.
+
+int procedure tbparse (tablename, fname, extname, maxch, hdu)
+
+char tablename[ARB] # i: name as specified by user
+char fname[ARB] # o: name of file containing table
+char extname[ARB] # o: CDF name, or null if none
+int maxch # i: size of fname and extname strings
+int hdu # o: HDU number for FITS file, or -1 if none
+#--
+pointer sp
+pointer brackets # scratch for expression in brackets
+pointer rowselect, colselect # ignored (selector strings)
+pointer scratch
+int localmax, nchar
+int extver, overwrite # ignored
+int tbnparse()
+errchk tbnparse
+
+begin
+ localmax = max (SZ_FNAME, maxch)
+
+ call smark (sp)
+ call salloc (brackets, localmax, TY_CHAR)
+ call salloc (scratch, localmax, TY_CHAR)
+ call salloc (rowselect, SZ_FNAME, TY_CHAR)
+ call salloc (colselect, SZ_FNAME, TY_CHAR)
+
+ nchar = tbnparse (tablename, fname, Memc[scratch], Memc[brackets],
+ localmax, extver, hdu, overwrite,
+ Memc[rowselect], Memc[colselect], SZ_FNAME)
+
+ call strcpy (Memc[brackets], extname, maxch)
+
+ call sfree (sp)
+
+ return (nchar)
+end