//*-- Author :    Damir Buskulic   03/12/00

////////////////////////////////////////////////////////////////////////////
//                                                                        //
// VHtml                                                                  //
//                                                                        //
// VHtml makes a documentation for VEGA classes (including index)         //
// using Hypertext Markup Language 2.0                                    //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

#include "VHtml.h"
#include "TROOT.h"
#include "TClass.h"
#include "TClassTable.h"

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <fstream.h>
#include <iostream.h>

ClassImp(VHtml)

//______________________________________________________________________________
 void VHtml::MakeVegaIndex()
{
// Have to create index html files for VEGA classes since MakeIndex
// in THtml is only valid for the ROOT configuration of sources
// Make a copy of THtml::MakeIndex() and adapt it.

#ifdef _HAS_HTML  
   
//   CreateListOfTypes();

   // get total number of classes
   Int_t numberOfClasses = gClassTable->Classes();
   Int_t curvc = 0;


   // allocate memory
   const char **classNames = new const char *[numberOfClasses];
   const char *curClassName;
   char       **fileNames  = new       char *[numberOfClasses];

   // start from begining
   gClassTable->Init();

   // get class names
   Int_t len = 0;
   Int_t maxLen = 0;
   Int_t numberOfImpFiles = 0;

   curvc =0;
   for( Int_t i = 0; i < numberOfClasses; i++ ) {

      // get class name
      curClassName = gClassTable->Next();
      if (*curClassName == 'V') {
         classNames[curvc] = curClassName;
      
         len    = strlen( classNames[curvc] );
         maxLen = maxLen > len ? maxLen : len;

       // get class & filename
         TClass *classPtr = GetClass( (const char * ) classNames[curvc] );
         const char *impname = classPtr->GetImplFileName();

         if( impname ) {
            impname = strstr(impname,"src/");
            fileNames[numberOfImpFiles] = StrDup( impname, 64 );

            char *underline = strchr( fileNames[numberOfImpFiles], '_');
            if( underline )
               strcpy( underline + 1, classNames[curvc] );
            else {
             // for VEGA install the impl file name has the form: /src/base/VCode.cc
               char *srcdir = strstr(fileNames[numberOfImpFiles], "/V");
               if (srcdir) {
                  memcpy(fileNames[numberOfImpFiles],"VEGA",4);
                  strcpy(srcdir, "_");
                  for (char *t = fileNames[numberOfImpFiles]; (t[0] = toupper(t[0])); t++) ;
                  strcat(srcdir, classNames[curvc]);
               } else {
                  strcpy( fileNames[curvc], "USER_" );
                  strcat( fileNames[curvc], classNames[curvc] );
               }
            }
            numberOfImpFiles++;
            curvc++;
         }
         else cout << "WARNING class:" << classNames[curvc] << " has no implementation file name !" << endl;
      }
   }
   maxLen += 1;

   // quick sort
   SortNames( classNames, curvc );
   SortNames( (const char ** ) fileNames,  numberOfImpFiles );

   // create an index
   CreateIndex( classNames, curvc );
   CreateIndexByTopic( fileNames, curvc, maxLen );

   // free allocated memory
   delete [] classNames;
   delete [] fileNames;
#endif
}

//______________________________________________________________________________
 void VHtml::WriteHtmlHeader( ofstream &out, const char *title )
{
// Write HTML header
//
//
// Input: out   - output file stream
//        title - title for the HTML page
//

    TDatime date;

    out << "<!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">" << endl;
    out << "<html>" << endl;
    out << "<!--                                             -->" << endl;
    out << "<!-- Author: ROOT team (rootdev@hpsalo.cern.ch)  -->" << endl;
    out << "<!--                                             -->" << endl;
    out << "<!--   Date: "<< date.AsString() << "            -->" << endl;
    out << "<!--                                             -->" << endl;
    out << "<head>" << endl;
    out << "<title>";
    ReplaceSpecialChars( out, title );
    out << "</title>" << endl;
    
    out << "<link rev=made href="mailto:rootdev@root.cern.ch">" << endl;
    out << "<meta name="rating" content="General">" << endl;
    out << "<meta name="objecttype" content="Manual">" << endl;
    out << "<meta name="keywords" content="software development, oo, object oriented, ";
    out << "unix, x11, windows, c++, html, rene brun, fons rademakers">" << endl;
    out << "<meta name="description" content="ROOT - An Object Oriented Framework For Large Scale Data Analysis.">" << endl;
    out << "</head>" << endl;

    out << "<body BGCOLOR="#000099" LINK="#FFFF00" VLINK="#00FFFF" ALINK="#00FFFF" TEXT="#CCFFCC">" << endl;
    out << "<a name="TopOfPage"></a>" << endl;
    out << "<center><img SRC="gif/bande6up.gif" height=15 width=400></center>" << endl;
}


//______________________________________________________________________________
 void VHtml::WriteHtmlFooter( ofstream &out, const char *dir, const char *lastUpdate,
                             const char *author, const char *copyright )
{
// Write HTML footer
//
//
// Input: out        - output file stream
//        dir        - usually equal to "" or "../", depends of
//                     current file directory position, i.e. if
//                     file is in the fOutputDir, then dir will be ""
//        lastUpdate - last update string
//        author     - author's name
//        copyright  - copyright note
//

    out << endl;

//    if( *author || *lastUpdate || *copyright ) out << "<center><img SRC="gif/bande6down.gif" height=15 width=400></center>" << endl;

    out << "<!--SIGNATURE-->" << endl;

    out << "<center><img SRC="gif/bande6down.gif" height=15 width=400></center>" << endl;

    // get the author( s )
    if( *author )  {

        out << "<em>Author: ";

        char *auth = StrDup(author);

        char *name = strtok( auth, "," );

        Bool_t firstAuthor = kTRUE;

        do {
            char *ptr = name;
            char c;

            // remove leading spaces
            while( *ptr && isspace( *ptr ) ) ptr++;

            if( !firstAuthor ) out << ", ";

            if( !strncmp( ptr, "Nicolas", 7 ) ) {
                out << "<a href=http://pcbrun.cern.ch/nicolas/index.html";
                ptr += 12;
            } else {
                out << "<a href="<<GetXwho();
            }
            while( *ptr ) {
                while( *ptr && !isspace( *ptr ) )
                    out << *ptr++;

                if( isspace( *ptr ) ) {
                    while( *ptr && isspace( *ptr ) ) ptr++;
                    if( isalpha( *ptr) ) out << '+';
                    else break;
                }
                else break;
            }
            c = *ptr;
            *ptr = 0;
            out << ">" << name << "</a>";
            *ptr = c;
            out << ptr;

            firstAuthor = kFALSE;

        } while (( name = strtok( NULL, "," )));
        out << "</em><br>" << endl;
        delete [] auth;
    }

    if( *lastUpdate ) out << "<em>Last update: " << lastUpdate << "</em><br>" << endl;
    if( *copyright )  out << "<em>Copyright " << copyright << "</em><br>" << endl;


    // this is a menu
    out << "<br>" << endl;
    out << "<address>" << endl;
    out << "<hr>" << endl;
    out << "<a href="http://wwwlapp.in2p3.fr/virgo/vega"><img SRC="gif/vegalogo1.gif" height=60 width=68 align=CENTER></a>   -  ";

    // link to the ROOT home page
    out << "<a href="http://root.cern.ch/root/Welcome.html">ROOT page</a> - ";

    // link to the VEGA home page
    out << "<a href="http://wwwlapp.in2p3.fr/virgo/vega">VEGA page</a> - ";

    // link to the index file
    out << "<a href="";
    if( *dir ) out << dir;
    out << "ClassIndex.html">Class index</a> - ";

    // link to the top of the page
    out << "<a href="#TopOfPage">Top of the page</a><br>" << endl;

    // Link to developers email address but anonymize  it so spambots have
    // a harder time finding it. Thanks to Hiveware Enkoder (www.hiveware.com)
    out << "<hr>This page has been automatically generated. If you have any comments or suggestions" << endl;
    out << "about the page layout send a mail to" << endl;
    out << "<script language="JavaScript" type="text/javascript">" << endl;
    out << "<!-- " << endl;
    out << "var d=new Array(" << endl;
    out << "   109,136,113,111,116,108,118,101,119,226,119," << endl;
    out << "   210,118,144,116,184,113,161,109,136,104,110," << endl;
    out << "   140,183,133,138,125,142,116,192,106,208,137," << endl;
    out << "   159,122,142,109,113,137,121,122,151,106,113," << endl;
    out << "   131,195,113,156,136,164,116,183,137,132,115," << endl;
    out << "   118,134,184,110,222,127,191,101,136,116,100," << endl;
    out << "   130,147,101,172,113,127,124,212,134,142,101," << endl;
    out << "   206,109,154,116,107,122,201" << endl;
    out << ");" << endl;
    out << "var t = new Array(); " << endl;
    out << "var i=0,ii=0, v=0,vv=0, c=0,cc=0; " << endl;
    out << "while (c<84) { " << endl;
    out << "for (f0=164; f0<=289; f0++) { i+=f0; v+=i; cc+=1; if (c>=84) break; " << endl;
    out << "if (f0==252 || v==i) continue; if (f0==233) v=cc; " << endl;
    out << "for (f1=112; f1<=228; f1++) { i+=f1; v+=i; cc+=1; if (c>=84) break; " << endl;
    out << "if (cc<f1 && v<i) break; if (f1==119) v=cc; " << endl;
    out << "for (f2=122; f2<=276; f2++) { i+=f2; v+=i; cc+=1; if (c>=84) break; " << endl;
    out << "if (cc<f2 && v<i) break; if (f2==139) i=cc; " << endl;
    out << "ii=i+d[c++]; vv=v+d[c++]; ii%=42; vv%=127; t[ii]=vv; i%=42; v%=127; " << endl;
    out << "}}}}" << endl;
    out << "i=0; document.write("\<a href=\""); " << endl;
    out << "while( t[i] ) document.write("\&\#"+t[i++]+";"); " << endl;
    out << "i++; document.write("\" title=\""); " << endl;
    out << "while( t[i] ) document.write("\&\#"+t[i++]+";"); " << endl;
    out << "i++; document.write("\"\>"); " << endl;
    out << "while( t[i] ) document.write("\&\#"+t[i++]+";"); " << endl;
    out << "i++; document.write("\<\/a\>");" << endl;
    out << "// -->" << endl;
    out << "</script> " << endl;
    out << "<noscript>" << endl;
    out << "	<p> JavaScript must be enabled to display this email address. </p>" << endl;
    out << "</noscript>" << endl;
    out << ", or" << endl;
    out << "contact" << endl;
    out << "<script language="JavaScript" type="text/javascript">" << endl;
    out << "<!-- " << endl;
    out << "var d=new Array(" << endl;
    out << "   141,123,130,224,118,205,105,167,145,173,130," << endl;
    out << "   150,114,189,151,103,133,104,114,191,148,178," << endl;
    out << "   127,161,105,102,136,206,112,155,141,103,115," << endl;
    out << "   103,142,201,114,169,139,146,109,153,132,180," << endl;
    out << "   100,120,121,142,141,178,106,182,124,132,141," << endl;
    out << "   159,103,103,118,189,132,148,145,108,103,151," << endl;
    out << "   114,213,124,218,133,114,141,204,148,189,100," << endl;
    out << "   218,105,148,109,194,112,123,114,168,115,110," << endl;
    out << "   115,166,114,136,112,138,109,175,105,146,100," << endl;
    out << "   108,148,173,141,122,133,181,124,171" << endl;
    out << ");" << endl;
    out << "var t = new Array(); " << endl;
    out << "var i=0,ii=0, v=0,vv=0, c=0,cc=0; " << endl;
    out << "while (c<108) { " << endl;
    out << "for (f0=199; f0<=315; f0++) { i+=f0; v+=i; cc+=1; if (c>=108) break; " << endl;
    out << "if (cc<f0 && v<i) break; if (f0==311) v=cc; " << endl;
    out << "for (f1=128; f1<=282; f1++) { i+=f1; v+=i; cc+=1; if (c>=108) break; " << endl;
    out << "if (f1==266 || v==i) continue; if (f1==151) i=cc; " << endl;
    out << "for (f2=169; f2<=307; f2++) { i+=f2; v+=i; cc+=1; if (c>=108) break; " << endl;
    out << "if (cc<f2 && v<i) break; if (f2==247) v=cc; " << endl;
    out << "for (f3=119; f3<=301; f3++) { i+=f3; v+=i; cc+=1; if (c>=108) break; " << endl;
    out << "if (cc<f3 && v<i) break; if (f3==159) v=cc; " << endl;
    out << "ii=i+d[c++]; vv=v+d[c++]; ii%=54; vv%=127; t[ii]=vv; i%=54; v%=127; " << endl;
    out << "}}}}}" << endl;
    out << "i=0; document.write("\<a href=\""); " << endl;
    out << "while( t[i] ) document.write("\&\#"+t[i++]+";"); " << endl;
    out << "i++; document.write("\" title=\""); " << endl;
    out << "while( t[i] ) document.write("\&\#"+t[i++]+";"); " << endl;
    out << "i++; document.write("\"\>"); " << endl;
    out << "while( t[i] ) document.write("\&\#"+t[i++]+";"); " << endl;
    out << "i++; document.write("\<\/a\>");" << endl;
    out << "// -->" << endl;
    out << "</script> " << endl;
    out << "<noscript>" << endl;
    out << "	<p> JavaScript must be enabled to display this email address. </p>" << endl;
    out << "</noscript>" << endl;
    out << "with any questions or problems regarding ROOT or VEGA." << endl;
    out << "</address>" << endl;
    out << "</body>" << endl;
    out << "</html>" << endl;
}


- ROOT page - VEGA page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to , or contact with any questions or problems regarding ROOT or VEGA.