Skip to content
Snippets Groups Projects
Commit 94dd7597 authored by Goik Martin's avatar Goik Martin
Browse files

Transform .dia files

parent ae64bbd1
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/perl
my $argCount = $#ARGV;
if (0 != $argCount) {
die "usage: dia2svgmult file.dia" ;
}
my ($diaFileName) = @ARGV;
my @layerLines = `gunzip -d -c $diaFileName |grep '<dia:layer'`;
my %layerblock2id = ();
my @blockIdList;
foreach my $layerLine (@layerLines) {
chop($layerLine);
$layerLine =~ /^[ \t]*<dia:layer name="([^"]+)"/;
my $layerId = $1;
$layerId =~ /([^0-9]+)([0-9]+)/;
my $nonNumeric = $1, $numeric = $2;
if ($layerblock2id {$nonNumeric}) {
push($layerblock2id {$nonNumeric}, $numeric);
} else {
$layerblock2id {$nonNumeric} = [$numeric];
push(@blockIdList, $nonNumeric);
}
}
foreach my $layerBlockId (@blockIdList) {
my $sublayerIds = $layerblock2id {$layerBlockId};
foreach my $subLayerId (@$sublayerIds) {
print $layerBlockId, ":", $subLayerId ,"\n";
}
}
#end
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment