]> Creatis software - bbtk.git/blob - kernel/appli/bbRegenerateBoxesLists/bbRegenerateBoxesLists.cpp
198d7cd23da8756304ab5b645a3d8a350afd103f
[bbtk.git] / kernel / appli / bbRegenerateBoxesLists / bbRegenerateBoxesLists.cpp
1
2 #include <bbtkInterpreter.h>
3 #include <bbtkConfigurationFile.h>
4
5 //==========================================================================
6 int main(int argc, char **argv)
7 {
8   if (argc>1)
9     {
10       if (argv[1][1]=='q') 
11         bbtk::MessageManager::SetMessageLevel("max",0);
12       else if (argv[1][1]=='v')
13         bbtk::MessageManager::SetMessageLevel("all",9);          
14       else 
15         {
16           std::cout << "usage : bbRegenerateBoxesLists [-q|-v] (quiet or verbose)" << std::endl;
17           return 0;
18         }
19     }
20
21   try
22     {
23       bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
24       I->SetCommandLine(true);
25       I->SetThrow(false);
26
27       std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
28       doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
29       doc_path += "bbdoc";
30       doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
31
32       I->InterpretLine( "exec freeze_no_error");
33       I->InterpretLine( "include *");
34       I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Initials, doc_path   + "index-alpha.html");
35       I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Packages, doc_path   + "index-package.html");
36       I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Categories, doc_path + "index-category.html");
37       I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Adaptors, doc_path   + "index-adaptors.html");
38
39     }
40   catch (bbtk::Exception e)
41     {
42       std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
43       return 1;
44     }
45
46   // JGRR & CM : this kills this never-ending process, when it's supposed to.
47   std::cout << "bbRegenerateBoxesLists has finished normally. It will be aborted on purpose."<< std::endl; 
48   abort();
49   // EO JGRR & CM
50   return 0;
51 }
52 //==========================================================================
53
54