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

PrintWeederVars.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 // Created on Fri Apr  9 15:37:09 PDT 1999 by heydon
00020 // Last modified on Sat Apr 30 16:40:04 EDT 2005 by ken@xorian.net
00021 //      modified on Mon Apr 12 09:53:18 PDT 1999 by heydon
00022 
00023 /* Syntax: PrintWeederVars
00024 
00025    This program prints the weeder's stable variables in a human-readable
00026    form.
00027 */
00028 
00029 #include <SourceOrDerived.H>
00030 #include <BitVector.H>
00031 #include "WeederConfig.H"
00032 #include "RootTbl.H"
00033 
00034 using std::ifstream;
00035 using std::cout;
00036 using std::endl;
00037 using std::hex;
00038 using std::dec;
00039 
00040 int main() {
00041     time_t startTime, keepTime;
00042     ShortId disShortId;
00043     BitVector *weeded;
00044     RootTbl *roots;
00045 
00046     // read variables
00047     ifstream ifs;
00048     try {
00049         try {
00050             FS::OpenReadOnly(Config_WeededFile, /*OUT*/ ifs);
00051             weeded = NEW_CONSTR(BitVector, (ifs));
00052             FS::Close(ifs);
00053         }
00054         catch (FS::DoesNotExist) {
00055           weeded = NEW(BitVector);
00056         }
00057     
00058         try {
00059             FS::OpenReadOnly(Config_MiscVarsFile, /*OUT*/ ifs);
00060             FS::Read(ifs, (char *)(&(startTime)), sizeof(startTime));
00061             FS::Read(ifs, (char *)(&(keepTime)), sizeof(keepTime));
00062             FS::Read(ifs, (char *)(&(disShortId)), sizeof(disShortId));
00063             roots = NEW_CONSTR(RootTbl, (ifs));
00064             FS::Close(ifs);
00065         }
00066         catch (FS::DoesNotExist) {
00067             startTime = -1;
00068             keepTime = -1;
00069             disShortId = 0;
00070             roots = NEW(RootTbl);
00071         }
00072     }
00073     catch (FS::EndOfFile) {
00074         // programming error
00075         assert(false);
00076     }
00077 
00078     // print variables
00079     cout << "*** Start Time ***" << endl;
00080     cout << "  startTime = ";
00081     if(startTime != -1)
00082       {
00083         // The result of ctime has a newline at the end, so we indent
00084         // the integer timestamp to line up with the text one.
00085         cout << ctime(&startTime)
00086              << "              (" << startTime << ")";
00087       }
00088     else
00089       {
00090         cout << startTime;
00091       }
00092     cout << endl;
00093     cout << "  keepTime  = ";
00094     if(keepTime != -1)
00095       {
00096         cout << ctime(&keepTime)
00097              << "              (" << keepTime << ")";
00098       }
00099     else
00100       {
00101         cout << keepTime;
00102       }
00103     cout << endl << endl;
00104     cout << "*** ShortId of DIs file ***" << endl;
00105     cout << "  disShortId = 0x" << hex << disShortId << dec << endl << endl;
00106     cout << "*** Table of GraphLog Roots to keep ***" << endl;
00107     cout << "  Size = " << roots->Size() << endl;
00108     if (roots->Size() > 0) {
00109         cout << "  Content = " << endl;
00110         roots->Print(cout, /*indent=*/ 4,
00111                      "[explicit]", "[fresh]");
00112     }
00113     cout << endl;
00114     cout << "*** Weeded set ***" << endl;
00115     int card = weeded->Cardinality();
00116     cout << "  Size = " << card << endl;
00117     if (card > 0) {
00118         cout << "  Content =" << endl;
00119         weeded->PrintAll(cout, /*indent=*/ 4, /*maxWidth=*/ 76);
00120         cout << endl;
00121     }
00122 }

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