1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:16:27 +02:00

cameo/fped2d2z.pl: convert fped 2D stacks into 2.5D paths with Z information

This commit is contained in:
Werner Almesberger 2012-03-18 23:05:40 -03:00
parent 085754f931
commit 219e0a5c2d

36
cameo/fped2d2z.pl Executable file
View File

@ -0,0 +1,36 @@
#!/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;
}