!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
module cubemain_template_twosteps
  use cubemain_messaging
  use cubemain_template_ima_real, &
       lmv_template_user_t => template_user_t, &
       lmv_template_prog_t => template_prog_t
  use cubemain_template_spe_outofplace, &
       vlm_template_user_t => template_user_t, &
       vlm_template_prog_t => template_prog_t
  use cubetools_structure
  use cubeadm_cubeid_types
  !
  public :: cubemain_template_twosteps_command
  private
  !
  integer(kind=4), parameter :: icube = 1 
  type(option_t), pointer :: template
  !
contains
  !
  subroutine cubemain_template_twosteps_command(opt,line,error)
    !----------------------------------------------------------------------
    !
    !----------------------------------------------------------------------
    type(option_t),pointer, intent(in)    :: opt
    character(len=*), intent(in)          :: line
    logical,          intent(inout)       :: error
    !
    character(len=*), parameter :: rname='TEMPLATE>COMMAND'
    !
    call cubemain_message(mainseve%trace,rname,'Welcome')
    !
    call cubemain_template_twosteps_main(line,error)
    if (error)  return
  end subroutine cubemain_template_twosteps_command
  !
  subroutine cubemain_template_twosteps_main(line,error)
    !----------------------------------------------------------------------
    !
    !----------------------------------------------------------------------
    character(len=*), intent(in)    :: line
    logical,          intent(inout) :: error
    !
    ! type(lmv_template_user_t) :: user1
    ! type(lmv_template_prog_t) :: prog1
    ! type(vlm_template_user_t) :: user2
    ! type(vlm_template_prog_t) :: prog2
    character(len=*), parameter :: rname='TEMPLATE>MAIN'
    !
    call cubemain_message(mainseve%trace,rname,'Welcome')
    !
    ! VVV This command cannot work as it is today, is it a priority to
    ! get this fixed?
    !
    ! ! First step: from LMV to LMV
    ! ! Fill the 'user1' description: use original command-line parser for simplicity
    ! call cubemain_template_ima_real_parse(line,user1,error)
    ! if (error) return
    ! ! ZZZ Might want to better customize the output file name
    ! call cubemain_template_ima_real_main(user1,prog1,error)
    ! if (error) continue
    !
    ! ! Second step: from LMV (with implicit transposition) to VLM
    ! ! Fill the 'user2' description: use original command-line parser for simplicity
    ! call cubemain_template_spe_outofplace_parse(line,user2,error)
    ! if (error) return
    ! ! But override input name to get the output from 1st step
    ! ! ZZZ how to get correctly the output name at 1st step?
    ! user2%name = trim(user1%name)//'-template'
    ! ! ZZZ Might want to better customize the output file name
    ! call cubemain_template_spe_outofplace_main(user2,prog2,error)
    ! if (error) continue
  end subroutine cubemain_template_twosteps_main
end module cubemain_template_twosteps
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
