Changeset 1814 for trunk/LMDZ.TITAN/libf


Ignore:
Timestamp:
Oct 30, 2017, 11:04:45 AM (7 years ago)
Author:
jvatant
Message:

Correct string management within muphy for ifort
JVO

Location:
trunk/LMDZ.TITAN/libf
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/muphytitan/argparse.F90

    r1793 r1814  
    20652065    !! @warning
    20662066    !! On error, the status of `values` is undefined.
    2067     OBJECT(argparser), INTENT(in)                            :: this
    2068       !! An argparser object reference
    2069     CHARACTER(len=*), INTENT(out), ALLOCATABLE, DIMENSION(:) :: values
     2067    OBJECT(argparser), INTENT(in)                                  :: this
     2068      !! An argparser object reference
     2069    CHARACTER(len=st_slen), INTENT(out), ALLOCATABLE, DIMENSION(:) :: values
    20702070      !! An allocatable vector of **assumed length** strings with the value(s) of all
    20712071      !! positionals arguments found.
     
    27792779    !! state is) which is the default value if no specific values are set in the argument.
    27802780    !! Otherwise, `output` status is undefined.
    2781     TYPE(argc), INTENT(in)                                   :: this
     2781    TYPE(argc), INTENT(in)                                         :: this
    27822782      !! Argc object
    2783     CHARACTER(len=*), INTENT(out), ALLOCATABLE, DIMENSION(:) :: output
     2783    CHARACTER(len=st_slen), INTENT(out), ALLOCATABLE, DIMENSION(:) :: output
    27842784      !! Output values
    27852785    TYPE(error) :: ret
  • trunk/LMDZ.TITAN/libf/muphytitan/cfgparse.F90

    r1793 r1814  
    803803    IF (LEN_TRIM(zsname) == 0 ) zsname = "__default__"
    804804    fname = zsname//"/"//str_to_lower(TRIM(pname))
    805     !print*,"DEBUG6: ",fname
    806805    IF (.NOT.cfg_check_name(fname)) THEN
    807806       err = error("Invalid option (no name)",-9)
     
    872871      ! no options yet -> allocate
    873872      ALLOCATE(this%options(1))
    874       !this%options(1) = sca
    875       !this%options(1)%name = pname
    876       !this%options(1)%section = zsname
    877       !this%options(1)%values = values
    878873    ELSE
    879874      ! parser has options: increase this%options size (ugly copy).
     
    890885      ENDDO
    891886      DEALLOCATE(tmp)
    892       !this%options(no+1) = sca
    893       !this%options(no+1)%name = pname
    894       !this%options(no+1)%section = zsname
    895       !this%options(no+1)%values = values
    896887    ENDIF
    897888    ! always add the option at the end.
    898     !print*, words_length(this%options(no+1)%values)
    899889    this%options(no+1) = sca
    900890    CALL op_clear(sca)
     
    18391829             EXIT
    18401830           ENDIF
    1841            !print*,"DEBUG0: New section ",TRIM(name), " <- ",isec
    18421831           isec = TRIM(name)
    18431832         CASE(cfg_OPTION)
     
    18491838           ! 4. update curval
    18501839           IF (op_valid(curopt)) THEN
    1851               !print*,"DEBUG3: new opt: ",TRIM(isec)//"/"//TRIM(name)," <- ",op_full_name(curopt)
    18521840              IF (LEN(curval) > 0) &
    18531841              CALL words_extend(curopt%values,TRIM(ADJUSTL(curval)),space,.true.,.true.)
  • trunk/LMDZ.TITAN/libf/muphytitan/errors.F90

    r1793 r1814  
    8484    CONTAINS
    8585      PROCEDURE, PUBLIC :: to_string => error_to_string
    86         !! Get a string representation of the error
    87 !#if HAVE_FTNDTIO
    88 !      PROCEDURE, PRIVATE :: e_write_wfm
    89 !      PROCEDURE, PRIVATE :: e_write_wofm
    90 !      GENERIC, PUBLIC :: write(formatted) => e_write_wfm
    91 !        !! Generic formatted write statement subroutine interface
    92 !      GENERIC, PUBLIC :: write(unformatted) => e_write_wofm
    93 !        !! Generic unformatted write statement subroutine interface
    94 !#endif
    9586#endif
    9687  END TYPE error
     
    201192  END FUNCTION error_to_string
    202193
    203 !#if HAVE_FTNDTIO
    204 !  SUBROUTINE e_write_wfm(dtv,unit,iotype,v_list,iostat,iomsg)
    205 !    !> Error derived type formatted IO write statement subroutine
    206 !    !!
    207 !    !! The method quietly ignores the derived type edit descriptor as the
    208 !    !! purpose of the subroutine is only to print a string. The edit descriptor
    209 !    !! used here is simply '(a)'.
    210 !    CLASS(error), INTENT(in)         :: dtv
    211 !      !! A reference to the string object
    212 !    INTEGER, INTENT(in)              :: unit
    213 !      !! Logical unit where to print the object
    214 !    CHARACTER (len=*), INTENT(in)    :: iotype
    215 !      !! Type of IO
    216 !    INTEGER, INTENT(in)              :: v_list(:)
    217 !      !! List of value from edit descriptor
    218 !    INTEGER, INTENT(out)             :: iostat
    219 !      !! Error status code (set to 2 if dtv's value if not allocated)
    220 !    CHARACTER (len=*), INTENT(inout) :: iomsg
    221 !      !! Error message
    222 !    CHARACTER(len=15) :: i2s
    223 !    iostat = 0 ; iomsg = ""
    224 !    WRITE(i2s,'(I15)') dtv%id ; i2s=ADJUSTL(i2s)
    225 !    WRITE(unit, '(a)') 'error('//TRIM(i2s)//'): '//TRIM(dtv%msg)
    226 !  END SUBROUTINE e_write_wfm
    227 !
    228 !  SUBROUTINE e_write_wofm(dtv, unit, iostat, iomsg)
    229 !    !! Error type IO unformatted write statement subroutine
    230 !    CLASS(error), INTENT(in)         :: dtv
    231 !      !! A reference to the string object
    232 !    INTEGER, INTENT(in)              :: unit
    233 !      !! Logical unit where to print the object
    234 !    INTEGER, INTENT(out)             :: iostat
    235 !      !! Error status code (set to 2 if dtv's value if not allocated)
    236 !    CHARACTER (len=*), INTENT(inout) :: iomsg
    237 !      !! Error message
    238 !    CHARACTER(len=15) :: i2s
    239 !    iostat = 0 ; iomsg = ""
    240 !    WRITE(i2s,'(I15)') dtv%id ; i2s=ADJUSTL(i2s)
    241 !    WRITE(unit, '(a)') 'error('//TRIM(i2s)//'): '//TRIM(dtv%msg)
    242 !  END SUBROUTINE e_write_wofm
    243 !#endif
    244 
    245194  SUBROUTINE aborting(err)
    246195    !! Abort the program with specific exit code
     
    252201    IF (err /= 0) THEN
    253202      WRITE(*,'(a)') error_to_string(err)
    254       CALL EXIT(err%id)
     203      CALL EXIT(abs(err%id))
    255204    ENDIF
    256205  END SUBROUTINE aborting
  • trunk/LMDZ.TITAN/libf/muphytitan/mm_globals.f90

    r1793 r1814  
    14381438
    14391439END MODULE MM_GLOBALS
    1440 
  • trunk/LMDZ.TITAN/libf/muphytitan/strings.F90

    r1808 r1814  
    219219    !!
    220220    !! @warning
    221     !! It is always limited to strings::st_slen characters.
     221    !! It is always limited to [[strings(module):st_slen(variable)]] characters.
    222222    CHARACTER(len=st_slen)        :: value = ''
    223223#endif
     
    849849    !!
    850850    !! The method attempts to convert the list of words in a vector of strings.
    851     !! If _this_ list of words is empty the output vector is allocated with 0 elements and the method returns
    852     !! .false.. Otherwise it returns .true.
     851    !! If _this_ list of words is empty, the output vector is allocated with 0 elements and the method returns
     852    !! .false., otherwise it returns .true.
    853853    !! @note
    854     !! If the size of the output string vector (i.e. the character length of the string elements within the
    855     !! vector) is too small, words can be truncated.
     854    !! If elements in __this__ words object are wider than [[strings(module):st_slen(variable)]], output
     855    !! values will be truncated.
    856856    OBJECT(words), INTENT(in)                                      :: this
    857857      !! A words object reference
     
    10411041    !! Quotes are removed only if they are the first and last non blank
    10421042    !! characters. Either double and single quotes are stripped without distinction.
    1043     !! The output string is trimmed from leading and trailing blank spaces
     1043    !! The output string is trimmed from leading and trailing blank spaces (after quotes removal !)
    10441044    CHARACTER(len=*), INTENT(in)  :: str  !! A string to check
    10451045    CHARACTER(len=:), ALLOCATABLE :: ostr !! A string without external quotes (if any). 
     
    10531053    IF (i /= 1) i = 0
    10541054    IF (j /= LEN(ostr)) j = LEN(ostr)+1
    1055     ostr = ostr(i+1:j-1)
     1055    ostr = TRIM(ostr(i+1:j-1))
    10561056    RETURN
    10571057  END FUNCTION remove_quotes
     
    16241624    !! The function removes list of csi (ANSI escape sequences) from the given
    16251625    !! string and returns a copy of it.
    1626     !! @note
    1627     !! This method does not update @lerror.
    16281626    CHARACTER(len=*), INTENT(in)      :: string
    16291627      !! Input string
  • trunk/LMDZ.TITAN/libf/phytitan/tracer_h.F90

    r1795 r1814  
    288288    DO i=1,size(indexes)
    289289      idx = indexes(i)
    290       IF (idx < 1 .OR. idx >= nt) THEN
     290      IF (idx < 1 .OR. idx > nt) THEN
    291291        ! WRITE(*,'((a),I3,(a),I3,(a))') "index out of range (",idx,"/",nt,")"
    292292        CYCLE
Note: See TracChangeset for help on using the changeset viewer.