File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -976,14 +976,10 @@ static RT_API_ATTRS bool EditListDirectedCharacterInput(
976
976
return false ;
977
977
}
978
978
// Undelimited list-directed character input: stop at a value separator
979
- // or the end of the current record. Subtlety: the "remaining" count
980
- // here is a dummy that's used to avoid the interpretation of separators
981
- // in NextInField.
982
- Fortran::common::optional<int > remaining{length > 0 ? maxUTF8Bytes : 0 };
983
- while (Fortran::common::optional<char32_t > next{
984
- io.NextInField (remaining, edit)}) {
979
+ // or the end of the current record.
980
+ while (auto ch{io.GetCurrentChar (byteCount)}) {
985
981
bool isSep{false };
986
- switch (*next ) {
982
+ switch (*ch ) {
987
983
case ' ' :
988
984
case ' \t ' :
989
985
case ' /' :
@@ -1003,11 +999,17 @@ static RT_API_ATTRS bool EditListDirectedCharacterInput(
1003
999
break ;
1004
1000
}
1005
1001
if (isSep) {
1006
- remaining = 0 ;
1007
- } else {
1008
- *x++ = *next;
1009
- remaining = --length > 0 ? maxUTF8Bytes : 0 ;
1002
+ break ;
1003
+ }
1004
+ if (length > 0 ) {
1005
+ *x++ = *ch;
1006
+ --length;
1007
+ } else if (edit.IsNamelist ()) {
1008
+ // GNU compatibility
1009
+ break ;
1010
1010
}
1011
+ io.HandleRelativePosition (byteCount);
1012
+ io.GotChar (byteCount);
1011
1013
}
1012
1014
Fortran::runtime::fill_n (x, length, ' ' );
1013
1015
return true ;
You can’t perform that action at this time.
0 commit comments