Hi Mark, I noticed that your patch XFig_empty_lines_after_header.diff fails with the regression-test script attached below. I created a new patch (also attached below) that changes the method parseHeader instead of parseBody. Could you please test it? -- Rafael
#!/usr/bin/perl -w
use XFig; my $fig = new XFig; my $success = 1; $fig->parseHead (*DATA); $fig->parseBody (*DATA); close DATA; my @objects = $fig->eachPrimitive(); $success = 0 if scalar @objects != 1; print "Accepting empty lines after the header: ", ($success ? "ok" : "failed"), "\n"; exit not $success; __DATA__ #FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 # some files have empty lines after the header # that would be accepted by xfig (though swallowed on saving) but caused # XFig.pm to ignore the remainder of the file 1200 2 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 0 0 1.00 60.00 120.00 4575 975 5475 975
#! /bin/sh /usr/share/dpatch/dpatch-run ## 72_XFig.pm-empty-lines-after-header.dpatch by Rafael Laboissiere <[EMAIL PROTECTED]> ## ## DP: Allow empty lines after the header, as used by some of the files ## DP: in the standard XFig libraries. @DPATCH@ --- fig2sty-0.1.orig/XFig.pm +++ fig2sty-0.1/XFig.pm @@ -187,8 +187,10 @@ $self->{transparent} = nextline($fh) if ($ver >= 3.2); $line = nextline($fh); # Note: comment lines can appear before the resolution and coordsystem line - while( $line =~ s%^#%% ){ - push @{$self->{comment}}, $line; + # Also, swallow empty lines + while( $line =~ s%^#%% or $line =~ /^$/ ){ + push @{$self->{comment}}, $line + if not ($line =~ /^$/); $line = nextline($fh); } ($self->{resolution}, $self->{coordsystem}) = split ' ', $line;