[fitsbits] Start of the CONTINUE keyword Public Comment Period

Mark Calabretta mcalabre at atnf.CSIRO.AU
Thu Jul 12 21:21:04 EDT 2007


On Thu 2007/07/12 16:10:24 -0400, William Pence wrote
in a message to: fitsbits at nrao.edu

>Another case where ordering may be implicit is in a sequence of HISTORY 
>keywords that document the order of data processing steps.  In some 

Another obvious example is that of COMMENT strings that span successive
records and are meant to be read as a paragraph.

An implicit example is where two header cards define the same keyword
(this condition is not addressed by the current standard, though I note
that the new draft specifically deprecates it).  Since scanner/parsers
are likely to read the header top-to-bottom the most likely result will
be that the last occurrence prevails.

>Keep in mind that the approval process for adding a convention to the 
>Registry is mainly only designed to ensure that the documentation is 
>clear and complete.  If a continuation convention were to be considered 

Not withstanding that (and contrary to my normal practice), I'd like to
make a couple of points: 

  1) The continuation character, '&', is redundant syntax.  As described
     in the prologue of fitshdr.h (from WCSLIB, as appended), it only
     indicates continuation if the following card is CONTINUE otherwise
     it must be interpreted literally.

  2) Making the continuation character part of the keyvalue, rather than
     a separate token, means that:

     a) Continuation is only defined for string keyvalues.

     b) When the parser tokenizes a header card, instead of being a
        separate token in itself the (redundant) continuation character
        must be removed from one of the other tokens.  Consequently, the
        parser is obliged to modify the keyvalue.

Does anyone know of any other syntax that uses a similar method of
continuation?  As alternatives think about the way it's done in Fortran,
C/C++, and Bourne shell (or python, or Glish).  Cobol is also quite
interesting in this respect as it's card-oriented, so is relevant to
FITS, and has elements of both C and Fortran continuation.

Mark Calabretta
ATNF


>>> Extract from the prologue of fitshdr.h: >>>

*    2) The parser supports a generalization of the OGIP Long String Keyvalue
*       Convention (v1.0) whereby strings may be continued onto successive
*       header cards.  A card contains a segment of a continued string if and
*       only if
*          a) it contains the pseudo-keyword "CONTINUE",
*          b) columns 9 and 10 are both blank,
*          c) columns 11 to 80 contain what would be considered a valid string
*             keyvalue, including optional inline comment, if column 9 had
*             contained '=',
*          d) the previous card contained either a valid string keyvalue or a
*             valid CONTINUE card.
*       If any of these conditions is violated, the card is considered in
*       isolation.
*
*       Syntax errors in inline comments in a continued string are treated
*       more permissively than usual; the '/' delimiter may be omitted
*       provided that parsing of the string keyvalue is not compromised.
*       However, the FITSHDR_COMMENT status bit will be set for the card (see
*       below).
*
*       As for normal strings, trailing blanks in a continued string are not
*       significant.
*
*       In the OGIP convention "the '&' character is used as the last non-
*       blank character of the string to indicate that the string is
*       (probably) continued on the following keyword".  This additional
*       syntax is not required by fitshdr(), but if '&' does occur as the last
*       non-blank character of a continued string keyvalue then it will be
*       removed, along with any trailing blanks.  However, blanks that occur
*       before the '&' will be preserved.





More information about the fitsbits mailing list