[comp.lang.fortran] Fortran preprocessor description..

sp4@beach.cis.ufl.edu (Scott Preston) (09/28/89)

Below is the list of things that the SFOR compiler does....if interested
in this just send mail..  Sp4@beach.cis.ufl.edu

************************************************************************
*
*           SFOR - A STRUCTURED FORTRAN TRANSLATOR
*           Written by:  Thomas M. Kisko
*           Version: 08/08/88
*                  with VAX modifications
*
*              University Of Florida
*
*      SFOR is a program that will translate structured FORTRAN
*  into standard FORTRAN 77.  The structures implemented in
*  SFOR are DOWHILE loops, REPEAT loops, and DO/ENDDO loops.
*  SFOR also allows comments on the same line as FORTRAN code
*  and debug lines that are switchable between comments and
*  executable statements.
*
*      SFOR reads an input file called SFOR.IN that should contain
*  two lines.  The first should contain the name of the structured
*  FORTRAN input file, and the second should contain the name of
*  the output file that is to contain the translated standard
*  FORTRAN 77 code.  If an error occurs during processing, a file
*  SFOR.OUT is created that contains the line "SFOR FAILED".
*
*      The recommended implementation of SFOR is in a user
*  friendly command procedure.
*
*  RULES OF SFOR:
*
*   1. The syntax of the DO WHILE loop is:
*
*                DO WHILE (expression)
*                  .
*                  .
*                END DO
*
*      The resulting code sent to the output file is:
*
*          n     IF (expression) THEN
*                   .
*                   .
*                  GOTO n
*                ENDIF
*
*   2. The syntax of the REPEAT loop is:
*
*                REPEAT
*                   .
*                   .
*                UNTIL (expression)
*
*      The resulting code sent to the output file is:
*
*          n     CONTINUE
*                   .
*                   .
*                IF (.NOT.(expression)) GOTO n
*
*   3. The syntax of the DO/ENDDO loop is:
*
*                DO var=start,limit[,step]
*                   .
*                   .
*                END DO
*
*      The resulting code sent to the output file is:
*
*                DO n var=start,limit[,step]
*                   .
*                   .
*          n     CONTINUE
*
*   4. Comments may be added to the end of a statement by adding
*      an exclamation point and then the comment.  For example:
*            PRINT *, 'WHAT!'
*      Note that the exclamation point in the string constant is not
*      interpreted as a comment delimiter.  SFOR does not send the
*      comment nor the exclamation point to the output file.  See
*      rule 8 below for a directive that allows
*      sent to the output file as a standard FORTRAN comment.
*
*   5. A "D" in column one of an input line specifies a debug
*      line.  A debug line is sent to the output file with a
*      "C" in column one if DEBUG is false or a blank in column
*      1 if DEBUG is true.  See rule 6 for manipulating the
*      status of DEBUG.
*
*   6. A "$D+" in columns 1 thru 3 of an input line sets DEBUG
*      to true.  A "$D-" in columns 1 thru 3 of an input line
*      sets DEBUG to false.  DEBUG is initially set to false.
*      In the output file the $ is replaced with an * to make
*      the line a FORTRAN comment.
*
*   7. A "$Sn" starting in column 1 of an input line sets the
*      next available statement number that will be used in
*      simulated structured statements to n.  By default, SFOR
*      uses statement numbers starting at 60001.  In the output
*      file the $ is replaced with an * to make the line a
*      FORTRAN comment.  Note: n is read using an I5 FORMAT.
*
*   8. A "$C+" in columns 1 thru 3 of an input line sets
*      SHOW_INLINE_COMMENTS to true.  A "$C-" in columns 1 thru
*      3 of an input line sets SHOW_INLINE_COMMENTS to false.
*      SHOW_INLINE_COMMENTS is initially set to false.  If
*      SHOW_INLINE_COMMENTS is true, an input line with an
*      exclamation point comment will be output twice; once
*      with the inline comment as a valid FORTRAN 77 comment
*      and once without the comment.  For example:
*
*            CALL UPCASE(LINE)
*
*      would be output as:
*
*      *
*            CALL UPCASE(LINE)
*
*
*   9. Input lines may contain up to 160 characters.  It is
*      the responsibility of the user to make sure that lines do not
*      exceed the length required by the FORTRAN compiler.
*      The standard maximum length of a source code line allowed by
*      the FORTRAN compiler is 72 columns.  Note that substituted lines
*      for some structured statements will be longer in the output file.
*
*  10. The output file will have the same number of lines as
*      the input file if:
*
*         - a blank line is placed after the ENDDO of a DO WHILE.
*           In the output file, the END DO line will contain the
*           GO TO n and the blank line will contain the END IF.
*
*         - a blank line is placed after exclamation point comment
*           lines when the $C+ directive is in effect.  See the
*           $C directive (rule 8) for more information.
*************************************************************************

sp4@beach.cis.ufl.edu
preston@ise.ufl.edu