2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
30 #include <bbtkInterpreter.h>
31 #include <bbtkConfigurationFile.h>
32 #include <bbtkUtilities.h>
34 //==========================================================================
35 void RegenerateDoc ( bbtk::Package::Pointer p, std::string& doc_path )
38 std::string pack_name(p->GetName());
39 std::string pack_path = doc_path + pack_name;
41 if ( ! bbtk::Utilities::FileExists(pack_path) )
43 std::string command("mkdir \"" +pack_path+ "\"");
44 system( command.c_str() );
46 std::string pack_index(pack_path);
47 pack_index += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
48 pack_index += "index.html";
50 std::cout << "* Generating doc for package '"<<pack_name<<"' in "
51 << pack_index << std::endl;
53 p->SetDocURL(pack_index);
54 p->SetDocRelativeURL("index.html");
57 p->CreateHtmlPage(pack_index,"bbtk",pack_name,"","",0,0,true); //true);
65 std::cout << "usage : bbRegeneratePackageDoc [<package name>|-a] [-q|-v]"
67 << " -a : All packages"<<std::endl
68 << " -q : Quiet"<<std::endl
69 << " -v : Verbose"<<std::endl;
72 //==========================================================================
73 int main(int argc, char **argv)
75 std::string pack("-a");
78 pack = std::string(argv[1]);
82 pack = std::string(argv[1]);
83 std::string param(argv[2]);
84 if (param=="-q") bbtk::MessageManager::SetMessageLevel("max",0);
85 else if (param=="-v") bbtk::MessageManager::SetMessageLevel("all",9);
100 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
101 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
103 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
104 bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
105 I->SetCommandLine(true);
107 //std::cout<<"JCP bbRegeneratePackageDoc.cpp I->InterpretLine( exec freeze_no_error);"<<std::endl;
108 I->InterpretLine( "exec freeze_no_error");
112 I->InterpretLine( "include "+pack);
113 I->InterpretLine( "include "+pack+"-appli");
114 bbtk::Package::Pointer p = I->GetExecuter()->GetFactory()->GetPackage(pack);
115 //std::cout<<"JCP bbRegeneratePackageDoc.cpp RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);"<<std::endl;
116 RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
120 //std::cout<<"JCP bbRegeneratePackageDoc.cpp I->InterpretLine( include );"<<std::endl;
121 I->InterpretLine( "include *");
122 bbtk::Factory::PackageMapType::const_iterator i;
123 for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
124 i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
127 //std::cout<<" if (i->second->GetName()==user) continue;"<<std::endl;
128 if (i->second->GetName()=="user") continue;
129 RegenerateDoc(i->second,doc_path);
133 catch (bbtk::Exception e)
135 std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
138 // JGRR & CM : this kills this never-ending process when it's supposed to!
139 std::cout << "bbRegeneratePackageDoc has finished normally. It will be aborted on purpose."<< std::endl;
144 //==========================================================================