From: Ethan A M. <merritt@u.washington.edu> - 2004-07-10 18:31:10
|
On Saturday 10 July 2004 01:21 am, Daniel J Sebald wrote: > Ethan A Merritt wrote: > > > >Daniel - don't you think it would be cleaner to provide an entirely > >separate routine, df_readbinary(), and call it instead of df_readline() > >when needed? > > That is correct, and I sort of started out that way. However, the more > I thought about it, it just seemed that the formatted and binary input > really weren't too much different. One can still imagine data inside a > binary file as being in columns, with implicit columns filled in by the > line number, etc.; just like with the formatted I/O. For what it's worth - After I apply the with-image patch df_readline contains 653 lines of code, of which only 303 are shared by the two modes. The largest block of shared code is the section (lines 3362-3465) checking for blank lines, skipped lines, and EOF. Is this even relevant to binary mode? > And at the bottom > of df_readline() is the important code which knows how and where to put > data in the v[] variables Yes, that is clearly important to both modes. But perhaps it should be split out into a common subroutine shared by two different input routines. At that point you might even find that 2 input stages + 1 shared output stage have fewer lines of code jointly than the current single routine with its tangle of #ifdefs. -- Ethan A Merritt Department of Biochemistry & Biomolecular Structure Center University of Washington, Seattle |