Merge lp:~nickpapior/siesta/4.0-fdf into lp:siesta/4.0

Proposed by Nick Papior
Status: Merged
Approved by: Alberto Garcia
Approved revision: 544
Merged at revision: 544
Proposed branch: lp:~nickpapior/siesta/4.0-fdf
Merge into: lp:siesta/4.0
Diff against target: 108 lines (+28/-10)
3 files modified
Src/fdf/fdf.F90 (+4/-2)
Src/fdf/parse.F90 (+23/-7)
version.info (+1/-1)
To merge this branch: bzr merge lp:~nickpapior/siesta/4.0-fdf
Reviewer Review Type Date Requested Status
Alberto Garcia Approve
Review via email: mp+332964@code.launchpad.net

Description of the change

Fixed bug, however, I am mainly concerned whether anything will be broken by this.

I can't see why, but good to get a new view on this.

To post a comment you must log in.
Revision history for this message
Alberto Garcia (albertog) wrote :

I cannot see any downsides.

For the next iteration, we might make the 'line' component of the parsed-line object into
an allocatable character variable, and the token markers into allocatable arrays.

review: Approve
Revision history for this message
Nick Papior (nickpapior) wrote :

Exactly my thought, it does however require some restructuring due to array vs. string sub-indexing.

But would be nice to have!

I will merge.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Src/fdf/fdf.F90'
--- Src/fdf/fdf.F90 2017-09-27 11:54:09 +0000
+++ Src/fdf/fdf.F90 2017-10-29 13:48:37 +0000
@@ -827,7 +827,8 @@
827 logical :: dump827 logical :: dump
828 logical, allocatable :: found(:)828 logical, allocatable :: found(:)
829 character(80) :: msg829 character(80) :: msg
830 character(len=MAX_LENGTH) :: line, label, inc_file830 character(len=MAX_LENGTH) :: label, inc_file
831 character(len=MAX_LENGTH*2):: line
831 integer(ip) :: i, ierr, ntok, ind_less, nlstart832 integer(ip) :: i, ierr, ntok, ind_less, nlstart
832 type(parsed_line), pointer :: pline833 type(parsed_line), pointer :: pline
833834
@@ -1044,7 +1045,8 @@
1044 logical :: dump, found_elem1045 logical :: dump, found_elem
1045 logical, pointer :: found_loc(:)1046 logical, pointer :: found_loc(:)
1046 character(80) :: msg1047 character(80) :: msg
1047 character(len=MAX_LENGTH) :: line, inc_file, label1048 character(len=MAX_LENGTH*2):: line
1049 character(len=MAX_LENGTH) :: label, inc_file
1048 integer(ip) :: i, ierr, ntok, ind_less, nlstart1050 integer(ip) :: i, ierr, ntok, ind_less, nlstart
1049 integer(ip) :: elem, nelem_loc1051 integer(ip) :: elem, nelem_loc
1050 integer(ip), pointer :: found_index(:)1052 integer(ip), pointer :: found_index(:)
10511053
=== modified file 'Src/fdf/parse.F90'
--- Src/fdf/parse.F90 2013-12-11 14:01:58 +0000
+++ Src/fdf/parse.F90 2017-10-29 13:48:37 +0000
@@ -686,6 +686,7 @@
686 ! grab the seperator686 ! grab the seperator
687 sep = names(lpline,1,after=ti)687 sep = names(lpline,1,after=ti)
688 if ( leqi(sep,'to') .or. &688 if ( leqi(sep,'to') .or. &
689 leqi(sep,':') .or. &
689 leqi(sep,'--') .or. &690 leqi(sep,'--') .or. &
690 leqi(sep,'---') ) then691 leqi(sep,'---') ) then
691692
@@ -1088,7 +1089,7 @@
1088 SUBROUTINE parses(ntokens, line, first, last)1089 SUBROUTINE parses(ntokens, line, first, last)
1089 implicit none1090 implicit none
1090!------------------------------------------------- Input Variables1091!------------------------------------------------- Input Variables
1091 character(len=MAX_LENGTH) :: line1092 character(len=*) :: line
1092 1093
1093!------------------------------------------------ Output Variables1094!------------------------------------------------ Output Variables
1094 integer(ip) :: ntokens1095 integer(ip) :: ntokens
@@ -1097,7 +1098,7 @@
1097!------------------------------------------------- Local Variables1098!------------------------------------------------- Local Variables
1098 logical :: intoken, instring, completed1099 logical :: intoken, instring, completed
1099 logical :: inlist1100 logical :: inlist
1100 integer(ip) :: i, c, stringdel1101 integer(ip) :: i, c, stringdel, length
11011102
1102! Character statement functions1103! Character statement functions
1103 logical :: is_digit, is_upper, is_lower, is_alpha, &1104 logical :: is_digit, is_upper, is_lower, is_alpha, &
@@ -1138,9 +1139,12 @@
1138 inlist = .FALSE.1139 inlist = .FALSE.
1139 stringdel = 01140 stringdel = 0
11401141
1142 ! Trim space at the end (not from the left)
1143 length = len_trim(line)
1144
1141 i = 11145 i = 1
1142 completed = .FALSE.1146 completed = .FALSE.
1143 do while((i .le. len(line)) .and. (.not. completed))1147 do while((i <= length) .and. (.not. completed))
1144 c = ichar(line(i:i))1148 c = ichar(line(i:i))
11451149
1146! Possible comment...1150! Possible comment...
@@ -1219,9 +1223,21 @@
1219 endif1223 endif
12201224
1221 i = i + 11225 i = i + 1
1222 enddo1226
12231227 ! Check whether the parsing is correctly handled
1224 if (parse_debug) then1228 if ( i > MAX_LENGTH ) then
1229 ! Because we will limit search to the len_trim length,
1230 ! then this should only be found when the line has "content" too long.
1231 ! Note that this will *never* be executed if a comment is too
1232 ! long because it is checked as the first requirement and then
1233 ! completes parsing the line.
1234 call die('PARSE module: parses', 'Too long line (132 char): ' // &
1235 trim(line), THIS_FILE, __LINE__)
1236 end if
1237
1238 enddo
1239
1240 if (parse_debug) then
1225 write(parse_log,*) 'PARSER:', ntokens, 'token(s)'1241 write(parse_log,*) 'PARSER:', ntokens, 'token(s)'
1226 do i= 1, ntokens1242 do i= 1, ntokens
1227 write(parse_log,*) ' Token:', '|',line(first(i):last(i)),'|'1243 write(parse_log,*) ' Token:', '|',line(first(i):last(i)),'|'
@@ -1237,7 +1253,7 @@
1237 SUBROUTINE morphol(ntokens, line, first, last, token_id)1253 SUBROUTINE morphol(ntokens, line, first, last, token_id)
1238 implicit none1254 implicit none
1239!------------------------------------------------- Input Variables1255!------------------------------------------------- Input Variables
1240 character(len=MAX_LENGTH) :: line1256 character(len=*) :: line
1241 integer(ip) :: ntokens1257 integer(ip) :: ntokens
1242 integer(ip) :: first(MAX_NTOKENS), last(MAX_NTOKENS)1258 integer(ip) :: first(MAX_NTOKENS), last(MAX_NTOKENS)
12431259
12441260
=== modified file 'version.info'
--- version.info 2017-10-18 16:14:45 +0000
+++ version.info 2017-10-29 13:48:37 +0000
@@ -1,1 +1,1 @@
1siesta-4.0--5431siesta-4.0--543--fdf-1

Subscribers

People subscribed via source and target branches