cla_command_argument_count Function

public function cla_command_argument_count()

Arguments

None

Return Value integer


Called by

proc~~cla_command_argument_count~~CalledByGraph proc~cla_command_argument_count cla_command_argument_count proc~cla_get_char cla_get_char proc~cla_get_char->proc~cla_command_argument_count proc~cla_show cla_show proc~cla_get_char->proc~cla_show proc~cla_key_present cla_key_present proc~cla_key_present->proc~cla_command_argument_count proc~cla_key_present->proc~cla_show proc~cla_validate_info cla_validate_info proc~cla_validate_info->proc~cla_command_argument_count interface~cla_get cla_get 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 proc~cla_show->proc~cla_get_char proc~cla_show->proc~cla_key_present proc~cla_validate cla_validate proc~cla_validate->proc~cla_validate_info proc~get_cla_gvec_to_jorek get_CLA_gvec_to_jorek proc~get_cla_gvec_to_jorek->proc~cla_key_present proc~get_cla_gvec_to_jorek->interface~cla_get proc~get_cla_gvec_to_jorek->proc~cla_validate program~gvec GVEC program~gvec->interface~cla_get program~gvec->proc~cla_validate

Source Code

    integer function cla_command_argument_count()
      ! Define these wrappers for these intrinsic functions because we want to implement
      ! a cla parser that can work with plain strings, read from stdin for example,
      ! not just from the command line.
      ! The purpose is to easily adapt a program that runs using command line inputs into
      ! a program that can run with string input it eats from a pipe.
      implicit none
      CHARACTER(len=CLALEN) :: outs
      INTEGER               :: i, k, n

      if (cla_cla_len == 0) then
         cla_command_argument_count = command_argument_count()
      else
         ! Count number of spaces to get
         ! number of parameters minus 1:
         cla_command_argument_count = 0
         ! Now count arguments:
!         write(*,*) 'Counting arguments in :',trim(cla_cla)
         cla_cla_len = len_trim(cla_cla)
         if (cla_cla_len == 0) then
            return
         end if
         do i=1,cla_cla_len
            if (cla_cla(i:i) == ' ') then
               cla_command_argument_count = cla_command_argument_count + 1
            end if
         end do
         cla_command_argument_count = cla_command_argument_count + 1
!         write(*,*) 'cla_command_argument_count found ',cla_command_argument_count
      end if
    end function cla_command_argument_count