Date:2012-03-19 03:05:40 (12 years 9 days ago)
Author:Werner Almesberger
Commit:219e0a5c2dac6d451b18a130e186b413685ad5ab
Message:cameo/fped2d2z.pl: convert fped 2D stacks into 2.5D paths with Z information

Files: cameo/fped2d2z.pl (1 diff)

Change Details

cameo/fped2d2z.pl
1#!/usr/bin/perl
2#
3# fped2d2z.pl - Convert fped 2D stacks into 2.5D paths with Z information
4#
5# Written 2012 by Werner Almesberger
6# Copyright 2012 Werner Almesberger
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13
14
15sub usage
16{
17    print STDERR "usage: $0 prefix [file ...]\n";
18    exit(1);
19}
20
21
22$pfx = shift @ARGV;
23&usage unless defined $pfx;
24
25$skip = 1;
26while (<>) {
27    if (/^# $pfx.*?(\d+(\.\d*)?)\s*$/) {
28        $z = $1;
29        $skip = 0;
30    } elsif (/^# /) {
31        $skip = 1;
32    }
33    next if $skip;
34    s/\s+-?\d+(\.\d*)?$/$& $z/;
35    print;
36}

Archive Download the corresponding diff file

Branches:
master



interactive