cla_key_present Function

public function cla_key_present(key)

Arguments

Type IntentOptional Attributes Name
character(len=*) :: key

Return Value logical


Calls

proc~~cla_key_present~~CallsGraph proc~cla_key_present cla_key_present proc~cla_command_argument_count cla_command_argument_count proc~cla_key_present->proc~cla_command_argument_count proc~cla_fatal cla_fatal proc~cla_key_present->proc~cla_fatal proc~cla_get_command_argument cla_get_command_argument proc~cla_key_present->proc~cla_get_command_argument proc~cla_key_arg_match cla_key_arg_match proc~cla_key_present->proc~cla_key_arg_match proc~cla_show cla_show proc~cla_key_present->proc~cla_show proc~cla_str_eq cla_str_eq proc~cla_key_arg_match->proc~cla_str_eq proc~cla_show->proc~cla_key_present proc~cla_get_char cla_get_char proc~cla_show->proc~cla_get_char proc~cla_message cla_message proc~cla_show->proc~cla_message proc~cla_get_char->proc~cla_command_argument_count proc~cla_get_char->proc~cla_get_command_argument proc~cla_get_char->proc~cla_key_arg_match proc~cla_get_char->proc~cla_show proc~cla_get_char->proc~cla_str_eq

Called by

proc~~cla_key_present~~CalledByGraph proc~cla_key_present cla_key_present proc~cla_show cla_show proc~cla_key_present->proc~cla_show proc~cla_show->proc~cla_key_present proc~cla_get_char cla_get_char proc~cla_show->proc~cla_get_char proc~get_cla_gvec_to_jorek get_CLA_gvec_to_jorek proc~get_cla_gvec_to_jorek->proc~cla_key_present interface~cla_get cla_get proc~get_cla_gvec_to_jorek->interface~cla_get proc~cla_get_char->proc~cla_show interface~cla_get->proc~cla_get_char proc~cla_get_float_r4 cla_get_float_r4 interface~cla_get->proc~cla_get_float_r4 proc~cla_get_float_r8 cla_get_float_r8 interface~cla_get->proc~cla_get_float_r8 proc~cla_get_int_i4 cla_get_int_i4 interface~cla_get->proc~cla_get_int_i4 proc~cla_get_int_i8 cla_get_int_i8 interface~cla_get->proc~cla_get_int_i8 proc~cla_get_logical cla_get_logical interface~cla_get->proc~cla_get_logical proc~cla_get_flag cla_get_flag proc~cla_get_flag->proc~cla_get_char proc~cla_get_float_r4->proc~cla_get_char proc~cla_get_float_r8->proc~cla_get_char proc~cla_get_int_i4->proc~cla_get_char proc~cla_get_int_i8->proc~cla_get_char proc~cla_get_logical->proc~cla_get_char program~gvec GVEC program~gvec->interface~cla_get

Source Code

    logical function cla_key_present(key)
      implicit none
      character(len=STRLEN) :: arg
      character(len=*)  :: key
      character(len=STRLEN) :: longkey
      character(len=2) :: shortkey
      character(len=STRLEN)  :: value

      integer(kind=int_kind) :: ncla, k, kk
!      integer :: cla_command_argument_count
!      external cla_command_argument_count

      !     Loop over the command line arguments to assign to
      !     value.
      !     Note that no error is reported if the key was NOT
      !     registered, but it is present on the command line.

      cla_key_present = .false.

!      write(*,*) 'Calling cla_key_present with key = ',trim(key)
      value = trim(cla_empty)
      do kk=1,cla_num
         ! must test for exact match, not just substring
         if (cla_key_arg_match(cla_registry(kk)%key, &
                           cla_registry(kk)%longkey, &
                           key))then
            value = trim(cla_registry(kk)%default)
            longkey = cla_registry(kk)%longkey
            shortkey = cla_registry(kk)%key
            exit
         end if
      end do

      if (index(trim(value),trim(cla_empty)) /= 0) then
         call cla_show
         call cla_fatal('Unknown command line argument: '//trim(key))
      endif

      ncla = cla_command_argument_count()
      if (ncla == 0) return

      do k=1,ncla
         call cla_get_command_argument(k,arg)
         ! test for exact match
         if (cla_key_arg_match(shortkey,longkey,arg))then
            cla_key_present = .true.
            return
         endif
      enddo

    end function cla_key_present