! CSC Summer School 2012
! Introduction to Fortran 95/2003 Exercise 3
module gol_io
  implicit none

contains

  subroutine read_data(iter, height, width)
    integer, intent(out) :: iter, height, width
    character(len=10) :: args(3)
    integer :: n_args, i
    n_args = command_argument_count()
    if ( n_args /= 3 ) then             
      write(*,*) ' Usage : ./gol #iterations height width'
      call abort()
    end if
! TODO: implement the command-line input parsing
  end subroutine read_data

  subroutine draw(board_1, iter)
    integer, parameter :: print_unit = 10
    integer, dimension(:,:) :: board_1
    integer, intent(in) :: iter
    character(len=14) :: filename
    character(len=8) :: printform
    integer :: i, w, h, ios
    h = size(board_1,1)-2
    w = size(board_1,2)-2
! TODO: implement dumping the board into a file
! life_NNNN.pbm where NNNN=iter in the netpbm format
  end subroutine draw

end module gol_io
