#! /usr/bin/perl -w

# something to help me calc. mean values from tables on p.4 in:
# http://www.dscc.dla.mil/Downloads/MilSpec/Docs/MIL-DTL-24308/dtl24308ss23.pdf
# http://www.dscc.dla.mil/Downloads/MilSpec/Docs/MIL-DTL-24308/dtl24308ss24.pdf

use strict;

my $old = 0;
my $str = ' => [ 0, ';
my $flag = 0;

while (<>) {
    if (m/^$/) {
	if ($flag) {
	    print "$str ],\n";
	}
	$str = ' => [ 0, ';
	$flag = 0;
    }

    next if m/\((\d+\.\d+)\)?/;
    chomp;
    s/\)//; # typo in table, an extra ")"

    if ($old) {
	$old += $_;
	$old /= 2;
	$str .= sprintf " %5.2f,", $old * 25.4;
	$flag = 1;
	$old = 0;
    } else {
	$old = $_;
    }
}
