C ***** This is the routine in the WaveForm Program ***** C ***** that processes the data section in the ***** C ***** Timing Specification File. This routine ***** C ***** will read each record in the data section ***** C ***** and look for one of the following: blank ***** C ***** line, comment only line, end_of_data_section, ***** C ***** up_for, down_for, repeat, and an illegal ***** C ***** data section record. ***** C ***** MTG WaveForm Program Rev. 28-OCT-1991 ***** SUBROUTINE Process_Data_Section C ***************************************** C Define all Variables and Arrays C ***************************************** IMPLICIT NONE INCLUDE 'WaveForm_Common.INC' INTEGER*2 LineLength C *************************************************************** C Advertize that processing of the data section will start C *************************************************************** WRITE ( 6, 41 ) 41 FORMAT ( /, & ' The Data Section of the Timing Specification ', / & ' file has beem found and will now be processed. ', / ) C ******************************************************* C Get a record and see what it is C ******************************************************* 100 CALL Get_Record_and_Capitalize IF ( IOSTATUS .EQ. -1 ) GOTO 940 IF ( IOSTATUS .NE. 0 ) GOTO 970 C ************************************************************** C ***** Now test to see if this record is a blank line ***** C ************************************************************** IF ( NumChr .NE. 0 ) GOTO 180 C This record IS a blank line so get the next record IF ( Full_Display .EQ. 0 ) GOTO 100 WRITE ( 6, 170 ) 170 FORMAT ( /, ' This record is a blank line. ', / ) GOTO 100 C ********************************************************************** C ***** Now test to see if this record contains only a comment ***** C ********************************************************************** C Test the first character to see if it is a comment 180 IF ( ThisLine(1) .EQ. ';' ) GOTO 192 IF ( ThisLine(1) .EQ. '!' ) GOTO 192 IF ( ThisLine(1) .EQ. '*' ) GOTO 192 C The first character was NOT a comment so continue with tests GOTO 200 C The first character WAS a comment so get next record 192 IF ( Full_Display .EQ. 0 ) GOTO 100 WRITE ( 6, 195 ) 195 FORMAT ( /, ' This record contains only a comment. ', / ) GOTO 100 C ********************************************************************** C ***** This record is not a blank line or a comment only line, ***** C ***** so test to see if it is the end of the Data Section. ***** C ********************************************************************** 200 IF ( ThisLine(1) .EQ. 'E' .AND. & ThisLine(2) .EQ. 'N' .AND. & ThisLine(3) .EQ. 'D' .AND. & ThisLine(4) .EQ. '_' .AND. & ThisLine(5) .EQ. 'O' .AND. & ThisLine(6) .EQ. 'F' .AND. & ThisLine(7) .EQ. '_' .AND. & ThisLine(8) .EQ. 'D' .AND. & ThisLine(9) .EQ. 'A' .AND. & ThisLine(10) .EQ. 'T' .AND. & ThisLine(11) .EQ. 'A' .AND. & ThisLine(12) .EQ. '_' .AND. & ThisLine(13) .EQ. 'S' .AND. & ThisLine(14) .EQ. 'E' .AND. & ThisLine(15) .EQ. 'C' .AND. & ThisLine(16) .EQ. 'T' .AND. & ThisLine(17) .EQ. 'I' .AND. & ThisLine(18) .EQ. 'O' .AND. & ThisLine(19) .EQ. 'N' ) GOTO 220 C This is NOT the End of the Data Section so continue with other tests GOTO 250 C This IS the End of the Data Section so RETURN from Data Section processing 220 IF ( Full_Display .EQ. 0 ) RETURN WRITE ( 6, 221 ) 221 FORMAT (/, ' This record is the End of the Data Section. ', /) RETURN C ********************************************************************** C ***** This record is not a blank line, a comment only line, ***** C ***** or the end of the data section, so test to see if ***** C ***** this record is an Up_Down_At record. ***** C ********************************************************************** C Test the first characters to see if they are: "Channel #" 250 IF ( ThisLine(1) .EQ. 'C' .AND. & ThisLine(2) .EQ. 'H' .AND. & ThisLine(3) .EQ. 'A' .AND. & ThisLine(4) .EQ. 'N' .AND. & ThisLine(5) .EQ. 'N' .AND. & ThisLine(6) .EQ. 'E' .AND. & ThisLine(7) .EQ. 'L' .AND. & ThisLine(8) .EQ. '#' ) GOTO 260 C This does NOT look like the beginning of an Up_Down_At record GOTO 300 C This DOES look like the beginning of an Up_Down_At record C Test this record to see if it contains either an Up_At or Down_At 260 DO ChrPt=1,NumChr-4,1 IF ( ThisLine(ChrPt+0) .EQ. 'U' .AND. & ThisLine(ChrPt+1) .EQ. 'P' .AND. & ThisLine(ChrPt+2) .EQ. '_' .AND. & ThisLine(ChrPt+3) .EQ. 'A' .AND. & ThisLine(ChrPt+4) .EQ. 'T' ) GOTO 270 END DO DO ChrPt=1,NumChr-6,1 IF ( ThisLine(ChrPt+0) .EQ. 'D' .AND. & ThisLine(ChrPt+1) .EQ. 'O' .AND. & ThisLine(ChrPt+2) .EQ. 'W' .AND. & ThisLine(ChrPt+3) .EQ. 'N' .AND. & ThisLine(ChrPt+4) .EQ. '_' .AND. & ThisLine(ChrPt+5) .EQ. 'A' .AND. & ThisLine(ChrPt+6) .EQ. 'T' ) GOTO 270 END DO C This does NOT look like an Up_Down_At record so continue GOTO 300 C This DOES look like an Up_Down_At record so call the routine to process it 270 CALL Process_Up_Down_At GOTO 100 C ********************************************************************** C ***** This record is not a blank line, a comment only line, ***** C ***** the end of the data section, or an Up_Down_At record, ***** C ***** so test to see if this record is a Repeat record. ***** C ********************************************************************** C Test the first characters to see if they are: "Repeat Channel #" 300 IF ( ThisLine(1) .EQ. 'R' .AND. & ThisLine(2) .EQ. 'E' .AND. & ThisLine(3) .EQ. 'P' .AND. & ThisLine(4) .EQ. 'E' .AND. & ThisLine(5) .EQ. 'A' .AND. & ThisLine(6) .EQ. 'T' .AND. & ThisLine(7) .EQ. 'C' .AND. & ThisLine(8) .EQ. 'H' .AND. & ThisLine(9) .EQ. 'A' .AND. & ThisLine(10) .EQ. 'N' .AND. & ThisLine(11) .EQ. 'N' .AND. & ThisLine(12) .EQ. 'E' .AND. & ThisLine(13) .EQ. 'L' .AND. & ThisLine(14) .EQ. '#' ) GOTO 320 C This does NOT look like the beginning of a Repeat record so continue GOTO 350 C This DOES look like the beginning of a Repeat record so call its routine 320 CALL Process_Repeat GOTO 100 C *********************************************************************** C ***** This record is not a blank line, a comment only line, ***** C ***** the end of the data section, an Up_Down_At record, or a ***** C ***** Repeat record, thus it is an illegal data section record. ***** C *********************************************************************** 350 WRITE ( 6, 355 ) 355 FORMAT ( /, & ' An illegal record was found in the Data ', / & ' Section. This is a fatal error. ', / & ' No output files will be produced. ', / ) CLOSE ( UNIT=10 ) GOTO 998 C ************************************************************ C This is the section for handling IO Errors and all Exits C ***********************************---------*********-----** 940 WRITE ( 6, 941 ) 941 FORMAT ( /, & ' The end of the Timing Specification ', / & ' file was reached before finding the ', / & ' end of the data section. ', / ) CLOSE ( UNIT=10 ) GOTO 998 970 WRITE ( 6, 971 ) IOSTATUS 971 FORMAT ( /, & ' There has been an IO System Error trying ', / & ' to Read from the Timing Specification ', / & ' file. Is this file of the correct format? ', // & ' Did you type the filename correctly? ', // & ' Fortran Read IOSTAT = ', I3, // & ' You will need to restart the program. ' , // ) CLOSE ( UNIT=10 ) 998 WRITE ( 6, 999 ) 999 FORMAT ( / ' MTG WaveForm Program will now exit. ', // ) STOP ' ' END