Index: /trunk/psLib/Makefile.am
===================================================================
--- /trunk/psLib/Makefile.am	(revision 8905)
+++ /trunk/psLib/Makefile.am	(revision 8906)
@@ -1,8 +1,5 @@
 SUBDIRS = $(SUBDIR)
 
-bin_SCRIPTS = pslib-config psParseErrorCodes
-
-bin_PROGRAMS = psTableParse
-
+bin_SCRIPTS = pslib-config 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA= pslib.pc
@@ -12,10 +9,5 @@
     pslib-config.in \
     pslib.pc.in \
-    share \
-    psParseErrorCodes \
-    psParsePrecessionTable \
     autogen.sh
-
-psTableParse_SOURCES = psTableParse.c
 
 if DOXYGEN
@@ -32,21 +24,4 @@
 	mkdir -p -m 744 $(mandir)/man3
 
-$(datadir)/pslib:
-	if [ -d $(datadir) ] ; then chmod u+w $(datadir) ; fi
-	mkdir -p -m 744 $(datadir)/pslib
-
-$(sysconfdir)/pslib:
-	if [ -d $(sysconfdir) ] ; then chmod u+w $(sysconfdir) ; fi
-	mkdir -p -m 744 $(sysconfdir)/pslib
-
-install-data-hook: $(datadir)/pslib $(sysconfdir)/pslib
-	if [ `pwd`/share != $(datadir) ] ; then $(INSTALL_DATA) $(srcdir)/share/pslib/*.dat $(datadir)/pslib ; fi
-	if [ `pwd`/etc != $(sysconfdir) ] ; then  $(INSTALL_DATA) $(srcdir)/etc/pslib/psTime.xml etc/pslib/pslib.config $(sysconfdir)/pslib ; fi
-
-uninstall-hook:
-	if [ `pwd`/share != $(datadir) ] ; then rm -rf $(datadir)/pslib ; fi
-	if [ `pwd`/etc != $(sysconfdir) ] ; then  rm -rf $(sysconfdir)/pslib ; fi
-	rm -rf $(prefix)/docs/pslib/*
-
 CLEANFILES = $(prefix)/docs/pslib/* *~ *.bb *.bbg *.da
 
Index: /trunk/psLib/configure.ac
===================================================================
--- /trunk/psLib/configure.ac	(revision 8905)
+++ /trunk/psLib/configure.ac	(revision 8906)
@@ -26,5 +26,5 @@
     AC_SUBST(PERL,$PERL)
 
-SUBDIR="etc src test" dnl don't include 'swig', as it is optional
+SUBDIR="etc src test utils" dnl don't include 'swig', as it is optional
 
 SRCPATH='${top_srcdir}/src'
@@ -413,5 +413,7 @@
   test/pstap/Makefile
   test/pstap/src/Makefile
+  utils/Makefile
   etc/Makefile
+  share/Makefile
   pslib-config
   pslib.pc
Index: unk/psLib/psParseErrorCodes
===================================================================
--- /trunk/psLib/psParseErrorCodes	(revision 8905)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#!/usr/bin/perl
-
-# Provides functions for handling long command line options
-use Getopt::Long;
-
-my @ErrorCodes        = ();
-my @ErrorDescriptions = ();
-
-my $data = "psErrorCodes.dat";
-my $outdir = ".";
-
-# Assign variables based on the presence of command line options to the script
-GetOptions(
-    "data=s"  => \$data,
-    "outdir=s" => \$outdir,
-    "verbose" => \$verbose,
-    "help"    => \$help
-);
-
-if ($help) {
-    print "Usage: parseErrorCodes ", "[--data=dataFile] ", "[--help] ",
-        "[--verbose] filename\n\n";
-    exit(0);
-}
-
-print "Using data file '$data'\n" if $verbose;
-unless ( open( DATAFILE, "<", $data ) ) {
-    die "Can not open data file $data.";
-}
-
-print "Datafile:\n" if $verbose;
-while (<DATAFILE>) {
-    chop;
-    if (/^\s*\#/) {
-        print "C $_\n" if $verbose;
-    }
-    else {
-        if (/^\s*(\w+)\s+([\%\w].*)/) {
-            my $ErrorCode        = $1;
-            my $ErrorDescription = $2;
-            print "  $ErrorCode: '$ErrorDescription'\n" if $verbose;
-            push( @ErrorCodes,        $ErrorCode );
-            push( @ErrorDescriptions, $ErrorDescription );
-        } else {
-            print "I $_\n" if $verbose;
-        }
-    }
-}
-close(DATAFILE);
-
-my $found = $#ErrorCodes + 1;
-print "\nFound $found error codes.\n" if $verbose;
-
-foreach (@ARGV) {
-    my $filename = $_.".in";
-    m/\/?([\w\.]+)$/;
-    my $output = "$outdir/$1";
-
-    die "Failed to open input file '$filename'"
-      if !open( INFILE, "<", $filename );
-    die "Failed to open output file '$output'"
-      if !open( OUTFILE, ">", $output );
-
-    print "\nOutput File: $output\n" if $verbose;
-    while (<INFILE>) {
-        if (/\${ErrorCode}/ || /\${ErrorDescription}/ || /\${n}/) {
-            $line = $_;
-            for ( $n = 0 ; $n < $found ; $n++ ) {
-                $_ = $line;
-                s/\${ErrorCode}/$ErrorCodes[$n]/g;
-                s/\${ErrorDescription}/$ErrorDescriptions[$n]/g;
-                s/\${n}/$n/g;
-                print OUTFILE;
-                print if $verbose;
-            }
-        } else {
-            print OUTFILE;
-            print if $verbose;
-        }
-    }
-
-    close(INFILE);
-    close(OUTFILE);
-}
Index: unk/psLib/psParsePrecessionTable
===================================================================
--- /trunk/psLib/psParsePrecessionTable	(revision 8905)
+++ 	(revision )
@@ -1,149 +1,0 @@
-#!/usr/bin/perl
-
-# Provides functions for handling long command line options
-use Getopt::Long;
-
-# Assign variables based on the presence of command line options to the script
-GetOptions(
-    "verbose" => \$verbose,
-    "help"    => \$help
-);
-
-if ($help) {
-    print "Usage: psParsePrecessionTable ",
-        "[--help] ",
-        "[--verbose] ",
-        "tableFile.txt";
-    exit(0);
-}
-
-# Loop through the arguements passed to the script
-foreach (@ARGV) {
-    chomp;
-    $tableFile = $_;
-    s/\.txt$//;
-    $outputFile = $_ . ".dat";
-    $coeffFile = $_ . ".coeff";
-    print "Table output file is $outputFile\n",
-          "Coefficient output file is $coeffFile\n" if $verbose;
-
-    unless ( open( TABLEFILE, "<", $tableFile ) ) {
-        die "Can not open table file $tableFile.";
-    }
-
-    unless ( open( OUTPUTFILE, ">", $outputFile ) ) {
-        die "Can not create output file $outputFile.";
-    }
-
-    unless ( open( COEFFFILE, ">", $coeffFile ) ) {
-        die "Can not create coeff file $coeffFile.";
-    }
-
-    # Read Header and tranfer it to the output files
-    $found = 0;
-    while ($found < 2 && ($line=<TABLEFILE>)) {
-        print "# $line" if $verbose;
-        print COEFFFILE "# $line";
-        print OUTPUTFILE "# $line";
-        if ($line =~ /^----/) {
-            $found++;
-        }
-    }
-
-
-    die "Failed to parse the polynomials in $tableFile."
-        if &parsePolynomialCoefficients;
-
-    &parseTable;
-
-    close(TABLEFILE);
-    close(OUTPUTFILE);
-    close(COEFFFILE);
-}
-
-
-exit(0);
-
-sub parsePolynomialCoefficients {
-
-
-    print "Parsing table for polynomial values\n" if $verbose;
-
-    # find the polynomial part header
-    local $found = 0;
-    while (! $found && ($line=<TABLEFILE>)) {
-        if ($line =~ /^Polynomial part/) {
-            print COEFFFILE "# $line";
-            $found = 1;
-        }
-    }
-
-     if (! $found) {
-        print "Failed to find the coefficient section" if $verbose;
-        return 1;
-    }
-
-    print "Found proper polynomials section\n" if $verbose;
-
-    # find the line of coefficients
-    $found = 0;
-    while (! $found && ($line=<TABLEFILE>)) {
-        if ($line =~ /^\s*(\S+)\s+([\+-])\s*(\S+)\s+t\s+([\+-])\s*(\S+)\s+t\^2\s+([\+-])\s*(\S+)\s+t\^3\s+([\+-])\s*(\S+)\s+t\^4\s+([\+-])\s*(\S+)\s+t\^5/) {
-            $found = 1;
-            print COEFFFILE "$1 $2$3 $4$5 $6$7 $8$9 $10$11\n";
-            print "Coeff: $1 $2$3 $4$5 $6$7 $8$9 $10$11\n" if $verbose;
-        }
-        if ($line =~ /^\-\-\-\-\-\-\-/) {
-            $found = 2;
-        }
-    }
-
-    if ($found != 1) {
-        print "Failed to find the coefficients" if $verbose;
-        return 1;
-    }
-
-    return 0;
-}
-
- sub parseTable {
-
-    print "Parsing table for non-polynomial values\n" if $verbose;
-
-    # find the non-polynomial part header
-    local $found = 0;
-    local $j = 0;
-    while (! $found && ($line=<TABLEFILE>)) {
-        if ($line =~ /^\s*j\s*=\s*(\d+)/) {
-            $j = $1;
-            print "Found data for j=$j\n" if $verbose;
-            $found = 1;
-        } else {
-            print OUTPUTFILE "# $line";
-        }
-    }
-
-     if (! $found) {
-        print "Failed to find the non-polynomial data" if $verbose;
-        return 1;
-    }
-
-    # find the line of coefficients
-    local $items = 0;
-    while ($line=<TABLEFILE>) {
-        if ($line =~ /^\s*j\s*=\s*(\d+)/) {
-            $j = $1;
-            print "Found data for j=$j\n" if $verbose;
-        } elsif ($line =~ /^\s*\d+\s(.+)/) {
-            print OUTPUTFILE "$j $1\n";
-            $items++;
-        }
-    }
-
-    print "Found $items data lines.\n" if $verbose;
-
-    return 0;
-}
-
-
-
Index: unk/psLib/psTableParse.c
===================================================================
--- /trunk/psLib/psTableParse.c	(revision 8905)
+++ 	(revision )
@@ -1,381 +1,0 @@
-/** @file  psTableParse.c
- *
- *  @brief Parses input data tables (finals2000A.data) and outputs files for specified format
- *
- *  @ingroup psTableParse
- *
- *  @author Dave Robbins, MHPCC
- *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-01-18 00:41:29 $
- *
- *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
- */
-
-//#include "pslib.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-static FILE *output = NULL;
-static FILE *input = NULL;
-
-static void printHeader(char *filename);
-
-int main(int argc, char *argv[])
-{
-    if (argc < 2) {
-        printf("\n Insufficient arguments.  Use [-h] for help.\n");
-        return 0;
-    }
-    if (!strncmp(argv[1], "-h", 2) ) {
-        printf("\n Usage:  psTableParse inputTable.data outputTable.dat <Sections>.\n");
-        printf(" i.e.    psTableParse finals.data finals.dat 1 3 4 8\n");
-        printf("\n Sections:\n 1)MJD Date       2)X (Bull A)     3)Y (Bull A)");
-        printf("\n 4)X (Bull B)     5)Y (Bull B)     6)dX (Bull A)");
-        printf("\n 7)dY (Bull A)    8)dX (Bull B)    9)dY (Bull B)");
-        printf("\n 10)UT1-UTC (Bull A)       11)UT1-UTC (Bull B)");
-        printf("\n 12)Error in X (Bull A)    13)Error in Y (Bull A)");
-        printf("\n 14)Error in dX (Bull A)   15)Error in dY (Bull A)    ");
-        printf("\n 16)Error in UT1-UTC (Bull A)\n\n");
-        return 0;
-    }
-    input = fopen(argv[1], "r");
-    output = fopen(argv[2], "w");
-    if (input == NULL) {
-        printf("\nERROR.  Could not open input file.\n");
-        return 0;
-    }
-    if (output == NULL) {
-        printf("\nERROR.  Could not open or create output file.\n");
-        return 0;
-    }
-    char data2[200];
-    printHeader(argv[1]);
-    fprintf(output, "#  ");
-    for (int i = 3; i < argc; i++) {
-        if(!strncmp(argv[i], "1", 2)) {
-            fprintf(output, "MJD       ");
-        }
-        if(!strncmp(argv[i], "2", 2)) {
-            fprintf(output, " X (A)     ");
-        }
-        if(!strncmp(argv[i], "3", 2)) {
-            fprintf(output, " Y (A)     ");
-        }
-        if(!strncmp(argv[i], "4", 2)) {
-            fprintf(output, " X (B)     ");
-        }
-        if(!strncmp(argv[i], "5", 2)) {
-            fprintf(output, "  Y (B)     ");
-        }
-        if(!strncmp(argv[i], "6", 2)) {
-            fprintf(output, " dX (A)     ");
-        }
-        if(!strncmp(argv[i], "7", 2)) {
-            fprintf(output, " dY (A)     ");
-        }
-        if(!strncmp(argv[i], "8", 2)) {
-            fprintf(output, " dX (B)     ");
-        }
-        if(!strncmp(argv[i], "9", 2)) {
-            fprintf(output, " dY (B)     ");
-        }
-        if(!strncmp(argv[i], "10", 2)) {
-            fprintf(output, "UT1-UTC (A)  ");
-        }
-        if(!strncmp(argv[i], "11", 2)) {
-            fprintf(output, "UT1-UTC (B)  ");
-        }
-        if(!strncmp(argv[i], "12", 2)) {
-            fprintf(output, " xErr (A)  ");
-        }
-        if(!strncmp(argv[i], "13", 2)) {
-            fprintf(output, " yErr (A)  ");
-        }
-        if(!strncmp(argv[i], "14", 2)) {
-            fprintf(output, " dXErr (A) ");
-        }
-        if(!strncmp(argv[i], "15", 2)) {
-            fprintf(output, " dYErr (A) ");
-        }
-        if(!strncmp(argv[i], "16", 2)) {
-            fprintf(output, "UT1-UTC Err");
-        }
-    }
-    fprintf(output, "\n#\n#\n");
-    int i;
-    while ( fscanf(input, "%188c", data2) != EOF) {
-
-        for(int j = 3; j < argc; j++) {
-            if(!strncmp(argv[j], "1", 2) ) {
-                for (i = 7; i <= 14; i++) {
-                    fprintf(output, "%c", data2[i]);
-                }
-            }
-            if(!strncmp(argv[j], "2", 2) ) {
-                if (data2[23] == ' ') {
-                    fprintf(output, "   0.000 ");
-                } else {
-                    for (i = 18; i <= 26; i++) {
-                        if (i == 18 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 21;
-                        }
-                        if (i == 19) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "3", 2) ) {
-                if (data2[42] == ' ') {
-                    fprintf(output, "   0.000 ");
-                } else {
-                    for (i = 37; i <= 45; i++) {
-                        if (i == 37 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 40;
-                        }
-                        if (i == 38) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "4", 2) ) {
-                if (data2[139] == ' ') {
-                    fprintf(output, "    0.000 ");
-                    //                    i = 144;
-                } else {
-                    for (i = 134; i <= 143; i++) {
-                        if (i == 135 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 138;
-                        }
-                        if (i == 136) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "5", 2) ) {
-                if (data2[149] == ' ') {
-                    fprintf(output, "    0.000 ");
-                } else {
-                    for (i = 144; i <= 153; i++) {
-                        if (i == 145 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 148;
-                        }
-                        if (i == 146) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "6", 2) ) {
-                if (data2[102] == ' ') {
-                    fprintf(output, "   0.000 ");
-                } else {
-                    for (i = 97; i <= 105; i++) {
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "7", 2) ) {
-                if (data2[121] == ' ') {
-                    fprintf(output, "   0.000 ");
-                } else {
-                    for (i = 116; i <= 124; i++) {
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "8", 2) ) {
-                if (data2[170] == ' ') {
-                    fprintf(output, "    0.000 ");
-                } else {
-                    for (i = 165; i <= 174; i++) {
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "9", 2) ) {
-                if (data2[180] == ' ') {
-                    fprintf(output, "    0.000 ");
-                } else {
-                    for (i = 175; i <= 184; i++) {
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "10", 2) ) {
-                if (data2[63] == ' ') {
-                    fprintf(output, "    0.000 ");
-                } else {
-                    for (i = 58; i <= 67; i++) {
-                        if (i == 58 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 61;
-                        }
-                        if (i == 59) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "11", 2) ) {
-                if (data2[159] == ' ') {
-                    fprintf(output, "     0.000 ");
-                } else {
-                    for (i = 154; i <= 164; i++) {
-                        if (i == 155 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 158;
-                        }
-                        if (i == 156) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "12", 2) ) {
-                if (data2[32] == ' ') {
-                    fprintf(output, "    0.000 ");
-                } else {
-                    for (i = 27; i <= 35; i++) {
-                        if (i == 27 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 30;
-                        }
-                        if (i == 28) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "13", 2) ) {
-                if (data2[51] == ' ') {
-                    fprintf(output, "     0.000 ");
-                } else {
-                    for (i = 46; i <= 54; i++) {
-                        if (i == 46 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 49;
-                        }
-                        if (i == 47) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "14", 2) ) {
-                if (data2[111] == ' ') {
-                    fprintf(output, "    0.000 ");
-                } else {
-                    for (i = 106; i <= 114; i++) {
-                        if (i == 106 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 109;
-                        }
-                        if (i == 107) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "15", 2) ) {
-                if (data2[131] == ' ') {
-                    fprintf(output, "     0.000 ");
-                } else {
-                    for (i = 125; i <= 133; i++) {
-                        if (i == 125 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 128;
-                        }
-                        if (i == 126) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            if(!strncmp(argv[j], "16", 2) ) {
-                if (data2[73] == ' ') {
-                    fprintf(output, "     0.000 ");
-                } else {
-                    for (i = 68; i <= 77; i++) {
-                        if (i == 155 && data2[i+1] == '-' && data2[i+2] == '.') {
-                            fprintf(output, "-0.");
-                            i = 71;
-                        }
-                        if (i == 69) {
-                            if (data2[i] == ' ' && data2[i+1] == '.') {
-                                fprintf(output, "0");
-                                i++;
-                            }
-                        }
-                        fprintf(output, "%c", data2[i]);
-                    }
-                }
-            }
-            fprintf(output, "  ");
-        }
-        fprintf(output, "\n");
-    }
-
-    fclose(input);
-    fclose(output);
-    return 0;
-}
-
-void printHeader(char *filename)
-{
-    if (output == NULL) {
-        printf("\n Unable to access output file.  Output is NULL.\n");
-    } else {
-        fprintf(output, "#\n#  Stripped version of %s file\n#\n#\n", filename);
-    }
-}
-
Index: /trunk/psLib/share/Makefile.am
===================================================================
--- /trunk/psLib/share/Makefile.am	(revision 8906)
+++ /trunk/psLib/share/Makefile.am	(revision 8906)
@@ -0,0 +1,11 @@
+pslibdatadir = $(datadir)/@PACKAGE_NAME@
+pslibdata_DATA = \
+	tab5.2a.dat \
+	tab5.2b.dat \
+	tab5.2c.dat \
+	finals2000A.dat \
+	finals_all.dat
+
+install-data-hook:
+	chmod 0755 $(pslibdatadir)
+
Index: /trunk/psLib/src/sys/Makefile.am
===================================================================
--- /trunk/psLib/src/sys/Makefile.am	(revision 8905)
+++ /trunk/psLib/src/sys/Makefile.am	(revision 8906)
@@ -20,10 +20,10 @@
 
 psErrorCodes.c: ../psErrorCodes_$(PS_LANG).dat psErrorCodes.c.in psErrorCodes.h
-	$(top_srcdir)/psParseErrorCodes --data=../psErrorCodes_$(PS_LANG).dat $@
+	$(top_srcdir)/utils/psParseErrorCodes --data=../psErrorCodes_$(PS_LANG).dat $@
 
 psError.h: psErrorCodes.h
 
 psErrorCodes.h: ../psErrorCodes_$(PS_LANG).dat psErrorCodes.h.in
-	$(top_srcdir)/psParseErrorCodes --data=../psErrorCodes_$(PS_LANG).dat $@
+	$(top_srcdir)/utils/psParseErrorCodes --data=../psErrorCodes_$(PS_LANG).dat $@
 
 pslibincludedir = $(includedir)
Index: /trunk/psLib/utils/Makefile.am
===================================================================
--- /trunk/psLib/utils/Makefile.am	(revision 8906)
+++ /trunk/psLib/utils/Makefile.am	(revision 8906)
@@ -0,0 +1,4 @@
+bin_SCRIPTS = psParsePrecessionTable psParseErrorCodes
+bin_PROGRAMS = psTableParse
+
+psTableParse_SOURCES = psTableParse.c
Index: /trunk/psLib/utils/psParseErrorCodes
===================================================================
--- /trunk/psLib/utils/psParseErrorCodes	(revision 8906)
+++ /trunk/psLib/utils/psParseErrorCodes	(revision 8906)
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+
+# Provides functions for handling long command line options
+use Getopt::Long;
+
+my @ErrorCodes        = ();
+my @ErrorDescriptions = ();
+
+my $data = "psErrorCodes.dat";
+my $outdir = ".";
+
+# Assign variables based on the presence of command line options to the script
+GetOptions(
+    "data=s"  => \$data,
+    "outdir=s" => \$outdir,
+    "verbose" => \$verbose,
+    "help"    => \$help
+);
+
+if ($help) {
+    print "Usage: parseErrorCodes ", "[--data=dataFile] ", "[--help] ",
+        "[--verbose] filename\n\n";
+    exit(0);
+}
+
+print "Using data file '$data'\n" if $verbose;
+unless ( open( DATAFILE, "<", $data ) ) {
+    die "Can not open data file $data.";
+}
+
+print "Datafile:\n" if $verbose;
+while (<DATAFILE>) {
+    chop;
+    if (/^\s*\#/) {
+        print "C $_\n" if $verbose;
+    }
+    else {
+        if (/^\s*(\w+)\s+([\%\w].*)/) {
+            my $ErrorCode        = $1;
+            my $ErrorDescription = $2;
+            print "  $ErrorCode: '$ErrorDescription'\n" if $verbose;
+            push( @ErrorCodes,        $ErrorCode );
+            push( @ErrorDescriptions, $ErrorDescription );
+        } else {
+            print "I $_\n" if $verbose;
+        }
+    }
+}
+close(DATAFILE);
+
+my $found = $#ErrorCodes + 1;
+print "\nFound $found error codes.\n" if $verbose;
+
+foreach (@ARGV) {
+    my $filename = $_.".in";
+    m/\/?([\w\.]+)$/;
+    my $output = "$outdir/$1";
+
+    die "Failed to open input file '$filename'"
+      if !open( INFILE, "<", $filename );
+    die "Failed to open output file '$output'"
+      if !open( OUTFILE, ">", $output );
+
+    print "\nOutput File: $output\n" if $verbose;
+    while (<INFILE>) {
+        if (/\${ErrorCode}/ || /\${ErrorDescription}/ || /\${n}/) {
+            $line = $_;
+            for ( $n = 0 ; $n < $found ; $n++ ) {
+                $_ = $line;
+                s/\${ErrorCode}/$ErrorCodes[$n]/g;
+                s/\${ErrorDescription}/$ErrorDescriptions[$n]/g;
+                s/\${n}/$n/g;
+                print OUTFILE;
+                print if $verbose;
+            }
+        } else {
+            print OUTFILE;
+            print if $verbose;
+        }
+    }
+
+    close(INFILE);
+    close(OUTFILE);
+}
Index: /trunk/psLib/utils/psParsePrecessionTable
===================================================================
--- /trunk/psLib/utils/psParsePrecessionTable	(revision 8906)
+++ /trunk/psLib/utils/psParsePrecessionTable	(revision 8906)
@@ -0,0 +1,149 @@
+#!/usr/bin/perl
+
+# Provides functions for handling long command line options
+use Getopt::Long;
+
+# Assign variables based on the presence of command line options to the script
+GetOptions(
+    "verbose" => \$verbose,
+    "help"    => \$help
+);
+
+if ($help) {
+    print "Usage: psParsePrecessionTable ",
+        "[--help] ",
+        "[--verbose] ",
+        "tableFile.txt";
+    exit(0);
+}
+
+# Loop through the arguements passed to the script
+foreach (@ARGV) {
+    chomp;
+    $tableFile = $_;
+    s/\.txt$//;
+    $outputFile = $_ . ".dat";
+    $coeffFile = $_ . ".coeff";
+    print "Table output file is $outputFile\n",
+          "Coefficient output file is $coeffFile\n" if $verbose;
+
+    unless ( open( TABLEFILE, "<", $tableFile ) ) {
+        die "Can not open table file $tableFile.";
+    }
+
+    unless ( open( OUTPUTFILE, ">", $outputFile ) ) {
+        die "Can not create output file $outputFile.";
+    }
+
+    unless ( open( COEFFFILE, ">", $coeffFile ) ) {
+        die "Can not create coeff file $coeffFile.";
+    }
+
+    # Read Header and tranfer it to the output files
+    $found = 0;
+    while ($found < 2 && ($line=<TABLEFILE>)) {
+        print "# $line" if $verbose;
+        print COEFFFILE "# $line";
+        print OUTPUTFILE "# $line";
+        if ($line =~ /^----/) {
+            $found++;
+        }
+    }
+
+
+    die "Failed to parse the polynomials in $tableFile."
+        if &parsePolynomialCoefficients;
+
+    &parseTable;
+
+    close(TABLEFILE);
+    close(OUTPUTFILE);
+    close(COEFFFILE);
+}
+
+
+exit(0);
+
+sub parsePolynomialCoefficients {
+
+
+    print "Parsing table for polynomial values\n" if $verbose;
+
+    # find the polynomial part header
+    local $found = 0;
+    while (! $found && ($line=<TABLEFILE>)) {
+        if ($line =~ /^Polynomial part/) {
+            print COEFFFILE "# $line";
+            $found = 1;
+        }
+    }
+
+     if (! $found) {
+        print "Failed to find the coefficient section" if $verbose;
+        return 1;
+    }
+
+    print "Found proper polynomials section\n" if $verbose;
+
+    # find the line of coefficients
+    $found = 0;
+    while (! $found && ($line=<TABLEFILE>)) {
+        if ($line =~ /^\s*(\S+)\s+([\+-])\s*(\S+)\s+t\s+([\+-])\s*(\S+)\s+t\^2\s+([\+-])\s*(\S+)\s+t\^3\s+([\+-])\s*(\S+)\s+t\^4\s+([\+-])\s*(\S+)\s+t\^5/) {
+            $found = 1;
+            print COEFFFILE "$1 $2$3 $4$5 $6$7 $8$9 $10$11\n";
+            print "Coeff: $1 $2$3 $4$5 $6$7 $8$9 $10$11\n" if $verbose;
+        }
+        if ($line =~ /^\-\-\-\-\-\-\-/) {
+            $found = 2;
+        }
+    }
+
+    if ($found != 1) {
+        print "Failed to find the coefficients" if $verbose;
+        return 1;
+    }
+
+    return 0;
+}
+
+ sub parseTable {
+
+    print "Parsing table for non-polynomial values\n" if $verbose;
+
+    # find the non-polynomial part header
+    local $found = 0;
+    local $j = 0;
+    while (! $found && ($line=<TABLEFILE>)) {
+        if ($line =~ /^\s*j\s*=\s*(\d+)/) {
+            $j = $1;
+            print "Found data for j=$j\n" if $verbose;
+            $found = 1;
+        } else {
+            print OUTPUTFILE "# $line";
+        }
+    }
+
+     if (! $found) {
+        print "Failed to find the non-polynomial data" if $verbose;
+        return 1;
+    }
+
+    # find the line of coefficients
+    local $items = 0;
+    while ($line=<TABLEFILE>) {
+        if ($line =~ /^\s*j\s*=\s*(\d+)/) {
+            $j = $1;
+            print "Found data for j=$j\n" if $verbose;
+        } elsif ($line =~ /^\s*\d+\s(.+)/) {
+            print OUTPUTFILE "$j $1\n";
+            $items++;
+        }
+    }
+
+    print "Found $items data lines.\n" if $verbose;
+
+    return 0;
+}
+
+
+
Index: /trunk/psLib/utils/psTableParse.c
===================================================================
--- /trunk/psLib/utils/psTableParse.c	(revision 8906)
+++ /trunk/psLib/utils/psTableParse.c	(revision 8906)
@@ -0,0 +1,381 @@
+/** @file  psTableParse.c
+ *
+ *  @brief Parses input data tables (finals2000A.data) and outputs files for specified format
+ *
+ *  @ingroup psTableParse
+ *
+ *  @author Dave Robbins, MHPCC
+ *
+ *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-09-23 03:03:14 $
+ *
+ *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
+ */
+
+//#include "pslib.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+static FILE *output = NULL;
+static FILE *input = NULL;
+
+static void printHeader(char *filename);
+
+int main(int argc, char *argv[])
+{
+    if (argc < 2) {
+        printf("\n Insufficient arguments.  Use [-h] for help.\n");
+        return 0;
+    }
+    if (!strncmp(argv[1], "-h", 2) ) {
+        printf("\n Usage:  psTableParse inputTable.data outputTable.dat <Sections>.\n");
+        printf(" i.e.    psTableParse finals.data finals.dat 1 3 4 8\n");
+        printf("\n Sections:\n 1)MJD Date       2)X (Bull A)     3)Y (Bull A)");
+        printf("\n 4)X (Bull B)     5)Y (Bull B)     6)dX (Bull A)");
+        printf("\n 7)dY (Bull A)    8)dX (Bull B)    9)dY (Bull B)");
+        printf("\n 10)UT1-UTC (Bull A)       11)UT1-UTC (Bull B)");
+        printf("\n 12)Error in X (Bull A)    13)Error in Y (Bull A)");
+        printf("\n 14)Error in dX (Bull A)   15)Error in dY (Bull A)    ");
+        printf("\n 16)Error in UT1-UTC (Bull A)\n\n");
+        return 0;
+    }
+    input = fopen(argv[1], "r");
+    output = fopen(argv[2], "w");
+    if (input == NULL) {
+        printf("\nERROR.  Could not open input file.\n");
+        return 0;
+    }
+    if (output == NULL) {
+        printf("\nERROR.  Could not open or create output file.\n");
+        return 0;
+    }
+    char data2[200];
+    printHeader(argv[1]);
+    fprintf(output, "#  ");
+    for (int i = 3; i < argc; i++) {
+        if(!strncmp(argv[i], "1", 2)) {
+            fprintf(output, "MJD       ");
+        }
+        if(!strncmp(argv[i], "2", 2)) {
+            fprintf(output, " X (A)     ");
+        }
+        if(!strncmp(argv[i], "3", 2)) {
+            fprintf(output, " Y (A)     ");
+        }
+        if(!strncmp(argv[i], "4", 2)) {
+            fprintf(output, " X (B)     ");
+        }
+        if(!strncmp(argv[i], "5", 2)) {
+            fprintf(output, "  Y (B)     ");
+        }
+        if(!strncmp(argv[i], "6", 2)) {
+            fprintf(output, " dX (A)     ");
+        }
+        if(!strncmp(argv[i], "7", 2)) {
+            fprintf(output, " dY (A)     ");
+        }
+        if(!strncmp(argv[i], "8", 2)) {
+            fprintf(output, " dX (B)     ");
+        }
+        if(!strncmp(argv[i], "9", 2)) {
+            fprintf(output, " dY (B)     ");
+        }
+        if(!strncmp(argv[i], "10", 2)) {
+            fprintf(output, "UT1-UTC (A)  ");
+        }
+        if(!strncmp(argv[i], "11", 2)) {
+            fprintf(output, "UT1-UTC (B)  ");
+        }
+        if(!strncmp(argv[i], "12", 2)) {
+            fprintf(output, " xErr (A)  ");
+        }
+        if(!strncmp(argv[i], "13", 2)) {
+            fprintf(output, " yErr (A)  ");
+        }
+        if(!strncmp(argv[i], "14", 2)) {
+            fprintf(output, " dXErr (A) ");
+        }
+        if(!strncmp(argv[i], "15", 2)) {
+            fprintf(output, " dYErr (A) ");
+        }
+        if(!strncmp(argv[i], "16", 2)) {
+            fprintf(output, "UT1-UTC Err");
+        }
+    }
+    fprintf(output, "\n#\n#\n");
+    int i;
+    while ( fscanf(input, "%188c", data2) != EOF) {
+
+        for(int j = 3; j < argc; j++) {
+            if(!strncmp(argv[j], "1", 2) ) {
+                for (i = 7; i <= 14; i++) {
+                    fprintf(output, "%c", data2[i]);
+                }
+            }
+            if(!strncmp(argv[j], "2", 2) ) {
+                if (data2[23] == ' ') {
+                    fprintf(output, "   0.000 ");
+                } else {
+                    for (i = 18; i <= 26; i++) {
+                        if (i == 18 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 21;
+                        }
+                        if (i == 19) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "3", 2) ) {
+                if (data2[42] == ' ') {
+                    fprintf(output, "   0.000 ");
+                } else {
+                    for (i = 37; i <= 45; i++) {
+                        if (i == 37 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 40;
+                        }
+                        if (i == 38) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "4", 2) ) {
+                if (data2[139] == ' ') {
+                    fprintf(output, "    0.000 ");
+                    //                    i = 144;
+                } else {
+                    for (i = 134; i <= 143; i++) {
+                        if (i == 135 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 138;
+                        }
+                        if (i == 136) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "5", 2) ) {
+                if (data2[149] == ' ') {
+                    fprintf(output, "    0.000 ");
+                } else {
+                    for (i = 144; i <= 153; i++) {
+                        if (i == 145 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 148;
+                        }
+                        if (i == 146) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "6", 2) ) {
+                if (data2[102] == ' ') {
+                    fprintf(output, "   0.000 ");
+                } else {
+                    for (i = 97; i <= 105; i++) {
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "7", 2) ) {
+                if (data2[121] == ' ') {
+                    fprintf(output, "   0.000 ");
+                } else {
+                    for (i = 116; i <= 124; i++) {
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "8", 2) ) {
+                if (data2[170] == ' ') {
+                    fprintf(output, "    0.000 ");
+                } else {
+                    for (i = 165; i <= 174; i++) {
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "9", 2) ) {
+                if (data2[180] == ' ') {
+                    fprintf(output, "    0.000 ");
+                } else {
+                    for (i = 175; i <= 184; i++) {
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "10", 2) ) {
+                if (data2[63] == ' ') {
+                    fprintf(output, "    0.000 ");
+                } else {
+                    for (i = 58; i <= 67; i++) {
+                        if (i == 58 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 61;
+                        }
+                        if (i == 59) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "11", 2) ) {
+                if (data2[159] == ' ') {
+                    fprintf(output, "     0.000 ");
+                } else {
+                    for (i = 154; i <= 164; i++) {
+                        if (i == 155 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 158;
+                        }
+                        if (i == 156) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "12", 2) ) {
+                if (data2[32] == ' ') {
+                    fprintf(output, "    0.000 ");
+                } else {
+                    for (i = 27; i <= 35; i++) {
+                        if (i == 27 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 30;
+                        }
+                        if (i == 28) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "13", 2) ) {
+                if (data2[51] == ' ') {
+                    fprintf(output, "     0.000 ");
+                } else {
+                    for (i = 46; i <= 54; i++) {
+                        if (i == 46 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 49;
+                        }
+                        if (i == 47) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "14", 2) ) {
+                if (data2[111] == ' ') {
+                    fprintf(output, "    0.000 ");
+                } else {
+                    for (i = 106; i <= 114; i++) {
+                        if (i == 106 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 109;
+                        }
+                        if (i == 107) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "15", 2) ) {
+                if (data2[131] == ' ') {
+                    fprintf(output, "     0.000 ");
+                } else {
+                    for (i = 125; i <= 133; i++) {
+                        if (i == 125 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 128;
+                        }
+                        if (i == 126) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            if(!strncmp(argv[j], "16", 2) ) {
+                if (data2[73] == ' ') {
+                    fprintf(output, "     0.000 ");
+                } else {
+                    for (i = 68; i <= 77; i++) {
+                        if (i == 155 && data2[i+1] == '-' && data2[i+2] == '.') {
+                            fprintf(output, "-0.");
+                            i = 71;
+                        }
+                        if (i == 69) {
+                            if (data2[i] == ' ' && data2[i+1] == '.') {
+                                fprintf(output, "0");
+                                i++;
+                            }
+                        }
+                        fprintf(output, "%c", data2[i]);
+                    }
+                }
+            }
+            fprintf(output, "  ");
+        }
+        fprintf(output, "\n");
+    }
+
+    fclose(input);
+    fclose(output);
+    return 0;
+}
+
+void printHeader(char *filename)
+{
+    if (output == NULL) {
+        printf("\n Unable to access output file.  Output is NULL.\n");
+    } else {
+        fprintf(output, "#\n#  Stripped version of %s file\n#\n#\n", filename);
+    }
+}
+
