Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TestFPTable.C

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // Last modified on Fri Jul 16 17:23:03 EDT 2004 by ken@xorian.net
00020 //      modified on Mon Dec 23 14:18:03 PST 1996 by heydon
00021 
00022 // This program generates a C file that declares the constant values for the
00023 // implementation of the fingerprint module "FP.C".
00024 
00025 #include <Basics.H>
00026 #include "ByteModTable.H"
00027 
00028 using std::cout;
00029 using std::endl;
00030 
00031 int main()
00032 {
00033     cout << "// The table for computing raw fingerprints\n//\n";
00034     cout << "// This table was generated by the program \"TestFPTable\"\n//\n";
00035     cout << "// These used to be compiled in as constants, but are" << endl
00036          << "// now generated when the fingerprinting library is" << endl
00037          << "// initialized.  The output of this program can still" << endl
00038          << "// serve as a test that the table generation algorithm" << endl
00039          << "// is working correctly.\n\n";
00040     cout << "Poly ";
00041 
00042     // Write out "ByteModTable"
00043     cout << "ByteModTable[8][256] = {\n";
00044     for (int i = 0; i < 8; i++) {
00045         cout << "  { ";
00046         for (int j = 0; j < 256; j++) {
00047             if (j > 0) cout << "    ";
00048             cout << "{ ";
00049             for (int ix = 0; ix < PolyVal::WordCnt; ix ++) {
00050                 if (ix > 0) cout << "      ";
00051                 char buff[17];
00052                 sprintf(buff, "%016" FORMAT_LENGTH_INT_64 "x",
00053                         ByteModTable[i][j].w[ix]);
00054                 cout << "CONST_INT_64(0x" << buff << ")";
00055                 if (ix < PolyVal::WordCnt-1) cout << "," << endl;
00056             }
00057             cout << " }";
00058             if (j < 255) cout << ",";
00059             cout << "\n";
00060         }
00061         cout << "  }";
00062         if (i < 7) cout << ",";
00063         cout << "\n";
00064     }      
00065     cout << "};\n";
00066     cout.flush();
00067     return(0);
00068 }

Generated on Mon May 8 00:48:41 2006 for Vesta by  doxygen 1.4.2