Advertisement
Guest User

Untitled

a guest
Jun 11th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. recursive function Read_Line(in) result(srcLine)
  2.  40    type(Line), pointer  :: srcLine
  3.  41    integer, intent(in)        :: in
  4.  42    integer, parameter      :: max_len = 1024
  5.  43    character(max_len, CH_) :: string
  6.  44    integer                 :: IO  
  7.  45
  8.  46    read (in, "(a)", iostat=IO) string
  9.  47    call Handle_IO_Status(IO, "reading line from source code")      
  10.  48    if (IO == 0) then
  11.  49       allocate (srcLine)
  12.  50       srcLine%Str = Trim(string)      
  13.  51       srcLine%Next => Read_Line(in)
  14.  52    else
  15.  53       srcLine => Null()
  16.  54    end if
  17.  55 end function Read_Line        
  18.  56 !        recursive function read_line(in) result (srcLine)
  19.  57 !            type(Line), pointer    :: srcLine
  20.  58 !            character(*), intent(in) :: in
  21.  59 !            integer, parameter       :: max_len = 1024
  22.  60 !            character(max_len,kind = CH_)   :: string
  23.  61 !            integer                  :: IO
  24.  62 !            
  25.  63 !            
  26.  64 !            read(in,"(a)",iostat=IO) string
  27.  65 !            call Handle_IO_Status(IO,"reading line from file")
  28.  66 !            if (IO == 0) then
  29.  67 !               allocate(srcLine)
  30.  68 !
  31.  69 !               srcLine%Str = string
  32.  70 !               srcLine%next => read_line(in)
  33.  71 !            else
  34.  72 !                 srcLine => Null()  
  35.  73 !            end if
  36.  74 !      end function read_line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement