This file is indexed.

/usr/bin/gnucap2genspic is in chiark-scripts 5.0.2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/perl
#   gnucap2genspic - Copyright 2004 Ian Jackson - see below
#
# Reads the output from gnucap and outputs a `genspic' file
# for use with genspic2gnuplot.  Takes no arguments or options.
#
# Limitations
#
#  Only Freq (.AC) and Time (.TRAN) plots have been tested.  If
#   other types go wrong they can probably be fixed by adding code for
#   them to startplot().
#
#  Displaying voltages and currents on the same .TRAN graph won't work
#   well because they currently have to have the same Y scale.  This
#   could be fixed by assigning carefully to $mmm in startplot().
#
#  This whole scheme is very clumsy.  There should be a driver program
#  with command-line option parsing.

# This program and its documentation are free software; you can
# redistribute them and/or modify them under the terms of the GNU
# General Public License as published by the Free Software Foundation;
# either version 3, or (at your option) any later version.
# 
# This program and its documentation are distributed in the hope that
# they will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, consult the Free Software Foundation's
# website at www.fsf.org, or the GNU Project website at www.gnu.org.

die if @ARGV;

%facttimes= qw(f 1e-15
	       p 1e-12
	       n 1e-9
	       u 1e-6
	       m 1e-3
	       K 1e3
	       Meg 1e6
	       G 1e9
	       T 1e12);

sub startplot () {
    $logxy= 0;
    for ($yn=1; $yn<=$#columns; $yn++) {
	$mmm[$yn]= 'y';
    }
    if ($kind eq 'Freq') {
	$logxy= 1;
	for ($yn=1; $yn<=$#columns; $yn++) {
	    die unless $columns[$yn] =~ m/.*([MP])\(\d+\)$/i;
	    $mmm[$yn]= 'y2' if uc $1 eq 'P';
	}
    }
    printf "S %s %d", $cplot, $logxy or die $!;
    for ($yn=1; $yn<=$#columns; $yn++) {
	printf " %s:%s", $mmm[$yn], $columns[$yn] or die $!;
    }
    print "\n" or die $!;
}
sub endplot () {
    return unless defined $kind;
    print "T\n" or die $!;
}

$readahead= <STDIN>;
for (;;) {
    $linesofar= $readahead;
    for (;;) {
	$readahead= <STDIN>;
	last unless $readahead =~ s/^\+//;
	die unless length $linesofar;
	$linesofar =~ s/\n$//;
	$linesofar .= $readahead;
    }
    $_= $linesofar;
    last unless length;
    s/\s+$//;
    
    if (m/^\#(\w+)/) {
	endplot();
	$kind= $1;
	@columns= split /\s+/;
	$cplot= $kind;
	startplot();
	next;
    } elsif (!defined $kind) {
	next;
    } elsif (s/^\s+//) {
	@numbers= split /\s+/;
	map {
	    if (m/^(\-?\d+\.\d*)([A-Za-z]+)$/) {
		die "factor $2" unless exists $facttimes{$2};
		$_= $1*$facttimes{$2};
	    }
	} @numbers;
	print "D @numbers\n" or die $!;
    } else {
	die "$_ ?";
    }
}
die "no plots" unless defined $kind;
endplot();
print "F\n" or die $!;

# $Id: gnucap2genspic,v 1.4 2007-09-21 21:21:15 ianmdlvl Exp $