[ovs-dev] [PATCH] dot2pic: Be less picky parsing "dot" output.

Ben Pfaff blp at nicira.com
Wed Dec 1 21:15:57 UTC 2010


Thanks, pushed.

On Wed, Dec 01, 2010 at 01:13:15PM -0800, Justin Pettit wrote:
> Looks good.
> 
> (Or as good as it can in Perl.)
> 
> --Justin
> 
> 
> On Dec 1, 2010, at 11:03 AM, Ben Pfaff wrote:
> 
> > Some versions of "dot" put two spaces after the "node" keyword instead of
> > one, which didn't match the regular expression used in dot2pic.  This
> > commit changes dot2pic not to care about the number of spaces in "node" and
> > "graph" lines.  (The "graph" lines weren't actually a problem but I don't
> > see a reason to be picky about them either.)
> > 
> > Different versions of "dot" still produce different output for the same
> > input, but I don't see how to avoid that.
> > 
> > Reported-by: Justin Pettit <jpettit at nicira.com>
> > ---
> > ovsdb/dot2pic |    7 ++++---
> > 1 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/ovsdb/dot2pic b/ovsdb/dot2pic
> > index 3e2f308..caca9f8 100755
> > --- a/ovsdb/dot2pic
> > +++ b/ovsdb/dot2pic
> > @@ -21,9 +21,10 @@ my ($scale) = 1;
> > print ".PS\n";
> > print "linethick = 1;\n";
> > while (<>) {
> > -    if (/graph (\S+) (\S+) (\S+)/) {
> > -        $scale = $1;
> > -    } elsif (my ($name, $x, $y, $width, $height, $label, $style, $shape, $color, $fillcolor) = /node (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)/) {
> > +    if (/^graph/) {
> > +        (undef, $scale) = split;
> > +    } elsif (/^node/) {
> > +        my (undef, $name, $x, $y, $width, $height, $label, $style, $shape, $color, $fillcolor) = split;
> >         $x *= $scale;
> >         $y *= $scale;
> >         $width *= $scale;
> > -- 
> > 1.7.1
> > 
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
> 




More information about the dev mailing list