This is the mail archive of the gdb@sourceware.org mailing list for the GDB 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]

text file formats


Hi,

While trying to display to the user a source file, it has become
increasingly obvious to me how complicated such a simple task can be.

Unix formatted text files have "\n" for a newline, dos formatted text files 
have "\r\n" for a newline and mac formatted text files have "\r" for a
newline. In the 3 case's above it is obvious how to determine exactly
which line is which.

However, it is easy to mix these file formats. In this case, any particular 
file can use any combination of "\r", "\r\n" and "\n" for newlines. I'm not 
even sure how to display such a file. I'm guessing that's it's
ambiguous, and i can make a best guess as to what the newline sequence
should be. Is this correct?

One thing I have determined, is that in order to know what the file
format is, the entire text file needs to be parsed. After that, either
the file format is defined (unix/dos/mac) or it is undefined (mix of
them).

I would like to make sure that the algorithm CGDB uses to determine
the line number from a file is the same algorithm that GDB uses. Can
anyone point me in the correct direction?

Thanks,
Bob Rossi


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