From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/tbtables/tbzsub.x | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 pkg/tbtables/tbzsub.x (limited to 'pkg/tbtables/tbzsub.x') diff --git a/pkg/tbtables/tbzsub.x b/pkg/tbtables/tbzsub.x new file mode 100644 index 00000000..2162a14b --- /dev/null +++ b/pkg/tbtables/tbzsub.x @@ -0,0 +1,54 @@ +include # for subtype codes +include "tbtables.h" +include "tbltext.h" + +# tbzsub -- determine text table subtype +# +# Phil Hodge, 7-Jun-1999 Subroutine created. + +procedure tbzsub (tp, buf, maxch, line, line_type, subtype) + +pointer tp # i: pointer to table info structure +char buf[ARB] # o: buffer for the line that was read +int maxch # i: size of line buffer +int line # io: line number in input file +int line_type # o: type of line read by tbzlin +int subtype # o: subtype of text table +#-- +int fd # fd for the file +bool read_enough # true if we have read enough to determine the subtype +int nchar, tbzlin() +errchk tbzlin + +begin + fd = TB_FILE(tp) + read_enough = false + subtype = TBL_SUBTYPE_UNKNOWN + + while (!read_enough) { + + nchar = tbzlin (fd, buf, maxch, line, line_type) + + if (nchar == EOF) { + subtype = TBL_SUBTYPE_SIMPLE + read_enough = true + buf[1] = EOS + + } else if (line_type == COLDEF_LINE) { + subtype = TBL_SUBTYPE_EXPLICIT + read_enough = true + + } else if (line_type == KEYWORD_LINE) { + call tbzkey (tp, buf, 0) # append to list of keywords + buf[1] = EOS # done with this line + + } else if (line_type == COMMENT_LINE) { + call tbbcmt (tp, buf) # append to comment buffer + buf[1] = EOS # done with this line + + } else { # data + subtype = TBL_SUBTYPE_SIMPLE + read_enough = true + } + } +end -- cgit