Extract Procedure

Description:  Extract Procedure removes a sequence of statements from a procedure, places them into a new subroutine, and replaces the original statements with a call to that subroutine. Any local variables used by those statements will be passed as parameters to the new procedure. This refactoring is generally used to make long procedures shorter.

State: Implemeted         Author: Jeff Overbey      Version:   Photran 5.0

Code Example:

    program main
    implicit none

    integer :: i,j,k
    integer :: w,z


    print *,'********************'
    print *,'*     header       *'
    print *,'********************'

    z=(2*k+3*i-5*j)
    print *,z


end program
    program main
    implicit none

    integer :: i,j,k
    integer :: w,z
    call Print_Header()

    z=(2*k+3*i-5*j)
    print *,z

contains

    subroutine Print_Header()
        implicit none


        print *,'********************'
        print *,'*     header       *'
        print *,'********************'
    end subroutine
end program


ScreenShots

       



HTML Comment Box is loading comments...