This is the mail archive of the guile@cygnus.com mailing list for the guile project.


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

Re: port-line bug details & patch question.


Greg Harvey <Greg.Harvey@thezone.net> writes:

 > "Harvey J. Stein" <hjstein@bfr.co.il> writes:
 >
 > > My questions are:
 > > 
 > > 1. Where should it be called for line reading?  The options, as far as
 > > I can tell are:
 > > 
 > >    scm_do_read_line
 > 
 > It can't be (as easily) done there, because fgets & generic_fgets
 > munch off the newline (you could check for eof).

Isn't that a semantic issue?  Is the # of lines supposed to = the number
of newlines?  Or should it be the number of strings that (read-line)
returns?  I was thinking of the latter, in which case it would be
incremented when (read-line) reads the last line in a file, even if it
isn't newline terminated.  It's kind of irrelevant since the next
thing to be read will be eof-object anyway, but doing it my way would
allow just putting an increment into scm_do_read_line if it's not
returning eof-object (& doing the same in fgets & generic_fgets, which
is marginally more complicated because of how they're written).

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il