Restructure the command parsing loops so the mode commands only parse the mode options

This commit is contained in:
Alex Selimov 2019-12-11 09:07:59 -05:00 committed by Alex Selimov
parent c291ec65b4
commit 0dff3b2ca9
5 changed files with 49 additions and 52 deletions

View file

@ -21,11 +21,12 @@ module mode_create
public
contains
subroutine create()
subroutine create(arg_pos)
! Main subroutine which controls execution
character(len=100) :: textholder
integer, intent(out) :: arg_pos
integer :: i, ibasis, inod
real(kind=dp), allocatable :: r_node_temp(:,:,:)
@ -45,14 +46,8 @@ module mode_create
lat_atom_num = 0
!First we parse the command
call parse_command()
call parse_command(arg_pos)
! Before building do a check on the file
if (outfilenum == 0) then
textholder = 'none'
call get_out_file(textholder)
end if
!Now we setup the unit element and call other init subroutines
call def_ng_node(1, element_type)
@ -161,10 +156,10 @@ module mode_create
sub_box_array_bd(2,2,1) = ele_num
end subroutine create
!This subroutine parses the command and pulls out information needed for mode_create
subroutine parse_command()
subroutine parse_command(arg_pos)
integer :: arg_pos, ori_pos, i, j, arglen, stat
integer, intent(out) :: arg_pos
integer :: ori_pos, i, j, arglen, stat
character(len=100) :: textholder
character(len=8) :: orient_string
@ -245,20 +240,10 @@ module mode_create
read(textholder, *) origin(i)
arg_pos = arg_pos + 1
end do
!If a filetype is passed then we add name.ext to the outfiles list
case('xyz')
textholder = trim(adjustl(name)) //'.xyz'
call get_out_file(textholder)
case default
!Check to see if it is an option command, if so then mode_create must be finished
if(textholder(1:1) == '-') then
exit
!Check to see if a filename was passed
elseif(scan(textholder,'.',.true.) > 0) then
call get_out_file(textholder)
end if
!If it isn't an option then you have to exit
exit
end select
end do