1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 11:21:08 +02:00
cae-tools/cameo/fped2d2z.pl

37 lines
719 B
Perl
Raw Normal View History

#!/usr/bin/perl
#
# fped2d2z.pl - Convert fped 2D stacks into 2.5D paths with Z information
#
# Written 2012 by Werner Almesberger
# Copyright 2012 Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
sub usage
{
print STDERR "usage: $0 prefix [file ...]\n";
exit(1);
}
$pfx = shift @ARGV;
&usage unless defined $pfx;
$skip = 1;
while (<>) {
if (/^# $pfx.*?(\d+(\.\d*)?)\s*$/) {
$z = $1;
$skip = 0;
} elsif (/^# /) {
$skip = 1;
}
next if $skip;
s/\s+-?\d+(\.\d*)?$/$& $z/;
print;
}