[BGL] Bug and proposed patch for read_graphviz to read dos formatted .dot files

Hi, I am submitting this bug and proposed patch as outlined in the procedure in http://www.boost.org/more/bugs.htm. Let me know if more information is needed. Also, since my patch is just a proposed solution, I am open to a better solution, etc because there may be issues I am not aware of and therefore, not taken into account. Bug description : Platform - Win2K Compiler - Cygwin g++ 3.3.1 read_graphviz when compiled with g++ will only read .dot in unix format, and fails with a "Syntax error" for .dot files in dos format. For comparison, read_graphviz when compiled with VC7.1 will read .dot files created in both formats. FYI : A text file created in dos format has line terminations as \r\n while a text file created in unix forma has line terminations in \n. Proposed fix: This patch allows the graphviz_lex.ll to consider both \n and \r\n as line terminations, thereby allowing read_graphviz to work on .dot files created in dos and unix format, regardless of which platform/compiler BGL was compiled on. This is also consistent with the Windows Graphviz tools like dotty, that also work regardless of whether the .dot files are of unix or dos format. Essentially, an additional rule is added to graphviz_lex.ll to recognize and discard \r\n. Attached file : graphviz_lex.ll.patch begin 666 graphviz_lex.ll.patch M*BHJ(&=R87!H=FEZ7VQE>"YM86EN+FQL"5-U;B!*=6P@(#,@,C$Z,# Z,C,@ M,C P-0HM+2T@9W)A<&AV:7I?;&5X+FQL"5-U;B!*=6P@(#,@,C$Z,#8Z,3 @ M,C P-0HJ*BHJ*BHJ*BHJ*BHJ*BH**BHJ(#@X+#DS("HJ*BH*+2TM(#@X+#DT M("TM+2T*(" \3&ET97)A;#Y;7%Q=6UQN72 @(" @.PH@(#Q,:71E<F%L/BA; M7B)<7%TJ?%M<7%TN*2 @>R!A9&1?<W1R:6YG*'EY=&5X="D[('T*("!;(%QT M72 @(" @(" @(" @.PHK(%QR7&X@(" @(" @(" @(" ["B @7&X@(" @(" @ M(" @(" @(#L*(" N(" @(" @(" @(" @(" @>R!R971U<FX@>7ET97AT6S!= ).R!]"B @)24* ` end

Hello, On Jul 4, 2005, at 12:31 AM, Tan Kwee Heong wrote:
I am submitting this bug and proposed patch as outlined in the procedure in http://www.boost.org/more/bugs.htm.
Thanks!
Essentially, an additional rule is added to graphviz_lex.ll to recognize and discard \r\n.
I've just checked in a similar change that instead allows "\r" (in addition to "\n"). That should cover DOS, Unix, and Mac line endings. Thanks for the report and bug fix! Doug
participants (2)
-
Douglas Gregor
-
Tan Kwee Heong