This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] Fix list directed reads of real number


On Fri, Dec 10, 2004 at 11:13:43PM +0100, Steven Bosscher wrote:
> On Friday 10 December 2004 22:52, Steve Kargl wrote:
> > On Fri, Dec 10, 2004 at 11:27:27AM -0800, Steve Kargl wrote:
> > Crud!  The patch doesn't totally fix the problem.
> >
> > troutmask:sgk[330] gfc -o fg fg.f90
> > troutmask:sgk[331] ./fg
> >  10,-20,30,40
> >    10.00000       0.000000       30.00000       40.00000
> > troutmask:sgk[332] cat fg.f90
> > program fg
> >   character(len=80) buff
> >   write (buff,'(a)') '10,-20,30,40'
> >   read(buff,*) a, b, c, d
> >   print *, buff
> >   print*, a, b, c, d
> > end program
> >
> > If a minus sign follows a comma, my  patch appears to miss
> > the next digit.
> 
> What happens is that when the library is asked to read the second real,
> it is still looking at the comma.  I would expect it to gobble that as
> part of reading the first real.
> 

That's what I thought.  The relevant code fragment is

    CASE_SEPARATORS:
      unget_char (c);           /* Single null.  */
      eat_separator ();
      break;

where I changed a "return" to the above "break".  I thought the
eat_separator() invocation would gobble up the comma.  What I
don't understand, is what does the unget_char(c) function do?

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]