00001
00002
00003
00004 #include "osl/eval/ppair/piecePairRawEval.h"
00005 #include "osl/record/csa.h"
00006 #include <boost/scoped_ptr.hpp>
00007 #include <iostream>
00008 #include <cstdlib>
00009 #include <unistd.h>
00010
00011
00012
00013 using namespace osl;
00014 using namespace osl::eval;
00015
00016 void usage(const char *prog)
00017 {
00018 using namespace std;
00019 cerr << "Usage: " << prog << " table1 table2"
00020 << endl;
00021 exit(1);
00022 }
00023
00024 void show(std::ostream& os, Position pos, PtypeO ptypeo)
00025 {
00026 csaShow(os, pos);
00027 os << " ";
00028 os << getOwner(ptypeo);
00029 csaShow(os, getPtype(ptypeo));
00030 }
00031
00032 int main(int argc, char **argv)
00033 {
00034 const char *program_name = argv[0];
00035 bool error_flag = false;
00036 const char *filename1 = 0;
00037 const char *filename2 = 0;
00038
00039
00040 extern int optind;
00041 char c;
00042 while ((c = getopt(argc, argv, "vh")) != EOF)
00043 {
00044 switch(c)
00045 {
00046 default: error_flag = true;
00047 }
00048 }
00049 argc -= optind;
00050 argv += optind;
00051
00052 if (error_flag || (argc < 2))
00053 usage(program_name);
00054 filename1 = argv[0];
00055 filename2 = argv[1];
00056
00057 boost::scoped_ptr<PiecePairRawTable> table1(new PiecePairRawTable());
00058 table1->loadFromBinaryFile(filename1);
00059 boost::scoped_ptr<PiecePairRawTable> table2(new PiecePairRawTable());
00060 table2->loadFromBinaryFile(filename2);
00061
00062 for (unsigned int i=0; i<PiecePairRawTable::maxPairIndex; ++i)
00063 {
00064 const int val1 = table1->value(i);
00065 const int val2 = table2->value(i);
00066 if (val1 != val2)
00067 {
00068 size_t i1, i2;
00069 PiecePairRawTable::meltIndex(i, i1, i2);
00070 Position pos1, pos2;
00071 PtypeO ptypeo1, ptypeo2;
00072 PiecePairRawTable::meltIndex(i1, pos1, ptypeo1);
00073 PiecePairRawTable::meltIndex(i2, pos2, ptypeo2);
00074 show(std::cout, pos1, ptypeo1);
00075 std::cout << " ";
00076 show(std::cout, pos2, ptypeo2);
00077 std::cout << " : " << val1 << " != " << val2 << "\n";
00078 }
00079 }
00080 }
00081
00082
00083
00084
00085
00086
00087