Skip to content

Commit

Permalink
sst: Define comment characters in a single place
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Aug 15, 2014
1 parent a7a6a02 commit 47d052c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
9 changes: 9 additions & 0 deletions applications/sst/SST_PAR
Expand Up @@ -19,16 +19,20 @@
* Authors:
* RFWS: R.F. Warren-Smith (STARLINK)
* PWD: Peter W. Draper (STARLINK, Durham University)
* TIMJ: Tim Jenness
* {enter_new_authors_here}

* History:
* 8-AUG-1990 (RFWS):
* Original version.
* 14-APR-2005 (PWD):
* Add parameterization of printable backslash.
* 14-AUG-2014 (TIMJ):
* Define comment characters in one location
* {enter_changes_here}

* Copyright:
* Copyright (C) 2014 Tim Jenness
* Copyright (C) 2005 Particle Physics and Astronomy Research Council.
* Copyright (C) 1990 Science and Engineering Research Council.
* All Rights Reserved.
Expand Down Expand Up @@ -64,5 +68,10 @@
* on the occasions when that isn't needed.
CHARACTER * ( 1 ) SST__BKSLH
PARAMETER ( SST__BKSLH = '\\' )

* Characters that can represent a comment in SST prologues
CHARACTER * (3) SST__COMCHARS
PARAMETER ( SST__COMCHARS = '*Cc' )

*.
* @(#)sst_par 1.1 94/12/05 11:38:25 96/07/05 10:28:45
5 changes: 4 additions & 1 deletion applications/sst/sst_analp.f
Expand Up @@ -86,6 +86,7 @@ SUBROUTINE SST_ANALP( PUNAME, PUTYPE, MXCODE, NBLANK, NCODBL,
* Copyright:
* Copyright (C) 1990 Science & Engineering Research Council.
* Copyright (C) 2006 Particle Physics & Astronomy Research Council.
* Copyright (C) 2014 Tim Jenness
* All Rights Reserved.

* Licence:
Expand Down Expand Up @@ -126,6 +127,8 @@ SUBROUTINE SST_ANALP( PUNAME, PUTYPE, MXCODE, NBLANK, NCODBL,
* Added calls to ERR_MARK and ERR_RLSE.
* 13-APR-2006 (TIMJ):
* Check for ENDFL as well as EOF
* 14-AUG-2014 (TIMJ):
* Use comment character constant from SST_PAR
* {enter_further_changes_here}

* Bugs:
Expand Down Expand Up @@ -247,7 +250,7 @@ SUBROUTINE SST_ANALP( PUNAME, PUTYPE, MXCODE, NBLANK, NCODBL,
CALL CHR_CLEAN( LINE ( : NC ) )

* Note if it is a comment line.
COMENT = INDEX( '*Cc', LINE( 1 : 1 ) ) .NE. 0
COMENT = INDEX( SST__COMCHARS, LINE( 1 : 1 ) ) .NE. 0

* Note if it is blank (whether a comment or not).
BLANK = LINE( 2 : NC ) .EQ. ' '
Expand Down
5 changes: 4 additions & 1 deletion applications/sst/sst_rdad1.f
Expand Up @@ -55,6 +55,7 @@ SUBROUTINE SST_RDAD1( NAME, TYPE, PURPOS, STATUS )
* Copyright:
* Copyright (C) 1990 Science & Engineering Research Council.
* Copyright (C) 2006 Particle Physics & Astronomy Research Council.
* Copyright (C) 2014 Tim Jenness
* All Rights Reserved.

* Licence:
Expand Down Expand Up @@ -92,6 +93,8 @@ SUBROUTINE SST_RDAD1( NAME, TYPE, PURPOS, STATUS )
* Added calls to ERR_MARK and ERR_RLSE.
* 13-APR-2006 (TIMJ):
* Seems that FIO__ENDFL is also a valid "end of file" status.
* 14-AUG-2014 (TIMJ):
* Use comment character constant from SST_PAR
* {enter_further_changes_here}

* Bugs:
Expand Down Expand Up @@ -163,7 +166,7 @@ SUBROUTINE SST_RDAD1( NAME, TYPE, PURPOS, STATUS )
* Find the significant length of the line read and determine if it is
* a comment line.
NC = CHR_LEN( LINE )
COMENT = INDEX( '*Cc', LINE( 1 : 1 ) ) .NE. 0
COMENT = INDEX( SST__COMCHARS, LINE( 1 : 1 ) ) .NE. 0

* If the program unit type is not yet known and this line is not a
* comment and is sufficiently long, then check to see if it is a
Expand Down
9 changes: 6 additions & 3 deletions applications/sst/sst_rdad2.f
Expand Up @@ -31,6 +31,7 @@ SUBROUTINE SST_RDAD2( STATUS )
* Copyright:
* Copyright (C) 1990, 1994 Science & Engineering Research Council.
* Copyright (C) 2006 Particle Physics & Astronomy Research Council.
* Copyright (C) 2014 Tim Jenness
* All Rights Reserved.

* Licence:
Expand Down Expand Up @@ -65,6 +66,8 @@ SUBROUTINE SST_RDAD2( STATUS )
* Added calls to ERR_MARK and ERR_RLSE.
* 13-APR-2006 (TIMJ):
* Check for ENDFL as well as EOF
* 14-AUG-2014 (TIMJ):
* Use comment character constant from SST_PAR
* {enter_further_changes_here}

* Bugs:
Expand Down Expand Up @@ -124,7 +127,7 @@ SUBROUTINE SST_RDAD2( STATUS )
* of prologue" character sequence. If so, then back space the input
* file and terminate the input loop.
IF ( .NOT. PROLOG ) THEN
IF ( ( INDEX( '*Cc', LINE( 1 : 1 ) ) .NE. 0 ) .AND.
IF ( ( INDEX( SST__COMCHARS, LINE( 1 : 1 ) ) .NE. 0 ) .AND.
: ( LINE( 2 : 2 ) .EQ. '+' ) ) THEN
BACKSPACE( SCB_IN )
GO TO 99
Expand Down Expand Up @@ -156,7 +159,7 @@ SUBROUTINE SST_RDAD2( STATUS )
* See if the input line contains an "end of prologue" character
* sequence. If so, then write the equivalent output sequence and turn
* the prologue flag off.
ELSE IF ( ( INDEX( '*Cc', LINE( 1 : 1 ) ) .NE. 0 ) .AND.
ELSE IF ( ( INDEX( SST__COMCHARS, LINE( 1 : 1 ) ) .NE. 0) .AND.
: ( LINE( 2 : 2 ) .EQ. '-' ) ) THEN
IF ( .NOT. PREVBL ) CALL SST_PUT( 0, ' ', STATUS )
CALL SST_FOR( 1, '.', STATUS )
Expand All @@ -167,7 +170,7 @@ SUBROUTINE SST_RDAD2( STATUS )

* Any non-comment lines are sent straight to the output file. However,
* blank lines are only used if the previous line was not blank.
ELSE IF ( INDEX( '*Cc', LINE( 1 : 1 ) ) .EQ. 0 ) THEN
ELSE IF ( INDEX( SST__COMCHARS, LINE( 1 : 1 ) ) .EQ. 0 ) THEN
RECOG = .FALSE.
IF ( NC .EQ. 0 ) THEN
IF ( .NOT. PREVBL ) CALL SST_PUT( 0, ' ', STATUS )
Expand Down
7 changes: 5 additions & 2 deletions applications/sst/sst_rdpro.f
Expand Up @@ -35,6 +35,7 @@ SUBROUTINE SST_RDPRO( STATUS )
* Copyright:
* Copyright (C) 1989, 1990 Science & Engineering Research Council.
* Copyright (C) 2006 Particle Physics & Astronomy Research Council.
* Copyright (C) 2014 Tim Jenness
* All Rights Reserved.

* Licence:
Expand Down Expand Up @@ -74,6 +75,8 @@ SUBROUTINE SST_RDPRO( STATUS )
* Added calls to ERR_MARK and ERR_RLSE.
* 13-APR-2006 (TIMJ):
* Check for ENDFL as well as EOF
* 14-AUG-2014 (TIMJ):
* Use comment character constant from SST_PAR
* {enter_further_changes_here}

* Bugs:
Expand Down Expand Up @@ -123,7 +126,7 @@ SUBROUTINE SST_RDPRO( STATUS )
* column. This line is not wanted, but marks the start of the
* prologue.
IF ( ( TEST( 2 : 2 ) .NE. '+' ) .OR.
: ( INDEX( '*Cc', TEST( 1 : 1 ) ) .EQ. 0 ) ) GO TO 1
: ( INDEX( SST__COMCHARS, TEST( 1 : 1 ) ) .EQ. 0 ) ) GO TO 1

* Loop to read the prologue lines, checking for errors.
2 CONTINUE
Expand All @@ -135,7 +138,7 @@ SUBROUTINE SST_RDPRO( STATUS )
* if they do not actually have a comment character).
NC = CHR_LEN( LINE )
IF ( ( NC .EQ. 0 ) .OR.
: ( INDEX( '*Cc', LINE( 1 : 1 ) ) .NE. 0 ) ) THEN
: ( INDEX( SST__COMCHARS, LINE( 1 : 1 ) ) .NE. 0 ) ) THEN

* If there is a '-' in the second column, then it marks the end of the
* prologue. Disregard this line and exit from the reading loop.
Expand Down

0 comments on commit 47d052c

Please sign in to comment.