33 static const char* tag[] = {
"<",
"^",
">"};
34 static const char*
name[] = {
"prev",
"up",
"next"};
35 static const TNamed emptyName;
38 TString arrowid(
"contextheadarrow_"); arrowid +=
name[id];
39 TString entryid(
"contextheadentry_"); entryid +=
name[id];
40 TString ardivid(
"divcontextheadar_"); ardivid +=
name[id];
41 if (!
n)
n = &emptyName;
46 if (
id != 1) title =
n->GetName();
47 if (title.Length()) title +=
": ";
48 title +=
n->GetTitle();
49 const char* mytag = tag[id];
51 if (!
n->GetName()[0]) mytag =
"";
54 "<a class=\"contextheadarrow\" href=\"%s.html\">%s</a></div></td>",
55 arrowid.Data(), ardivid.Data(),
n->GetName(), mytag);
57 TString entry =
TString::Format(
"<td class=\"contextheadentry\" id=\"%s\">"
58 "<a class=\"contextheadentry\" href=\"%s.html\">%s</a></td>",
59 entryid.Data(),
n->GetName(), title.Data());
62 links += entry +
arrow;
64 links +=
arrow + entry;
68void MakeTopLinks(TString &links,
const char*
name,
const char* title,
const char* upLink,
const char* upTitle,
80 links =
"<div id=\"toplinks\"><div class=\"descrhead\">"
81 "<table class=\"descrtitle\" id=\"contexttitle\"><tr class=\"descrtitle\">";
89 if (upLink && upLink[0])
96 links += TString(
"</tr></table></div><h1 class=\"convert\">") + title +
"</h1></div>\n";
98 TString subtitle = dir;
100 if (!subtitle.EndsWith(
"/")) {
103 subtitle += TString(
name);
104 suburl = subtitle +
"?view=markup";
106 links +=
TString::Format(
"<div class=\"location\"><h2>From <a href=\"http://root.cern.ch/viewvc/trunk/tutorials/%s\">$ROOTSYS/tutorials/%s</a></h2></div>",
107 suburl.Data(), subtitle.Data());
138 const char *imagenew =
"";
139 cout <<
"writingItem: " << numb <<
", ref=" << ref <<
", name=" <<
name <<
", title=" << title << endl;
140 if (isnew) imagenew =
" <img src=\"http://root.cern.ch/root/images/new01.gif\" alt=\"new\" align=\"top\" />";
141 out <<
"<li class=\"idxl" << numb%2 <<
"\">";
142 out <<
"<a href=\"" << ref <<
"\"><span class=\"typename\">" << numb <<
". " <<
name <<
"</span></a> "
143 << title << imagenew <<
"</li>" << endl;
158 out <<
"<li class=\"idxl" << (
n++)%2 <<
"\"><a href=\"" << dir <<
"/index.html\">"
159 <<
"<span class=\"typename\">" << dir <<
"</span></a>" << title <<
"</li>" << endl;
161 scandir(html, dir, title, lnk);
173 const char* tutorials[][2] = {
174 {
"hist",
"Histograms"},
175 {
"graphics",
"Basic Graphics"},
176 {
"graphs",
"TGraph, TGraphErrors, etc"},
177 {
"gui",
"Graphics User Interface"},
178 {
"fit",
"Fitting tutorials"},
179 {
"fitsio",
"CFITSIO interface"},
180 {
"io",
"Input/Output"},
181 {
"tree",
"Trees I/O, Queries, Graphics"},
182 {
"math",
"Math tutorials"},
183 {
"matrix",
"Matrix packages tutorials"},
184 {
"geom",
"Geometry package"},
185 {
"gl",
"OpenGL examples"},
186 {
"eve",
"Event Display"},
187 {
"fft",
"Fast Fourier Transforms"},
188 {
"foam",
"TFoam example"},
189 {
"image",
"Image Processing"},
190 {
"mlp",
"Neural Networks"},
191 {
"net",
"Network, Client/server"},
192 {
"physics",
"Physics misc"},
193 {
"proof",
"PROOF tutorials"},
194 {
"pyroot",
"Python-ROOT"},
195 {
"pythia",
"Pythia event generator"},
196 {
"quadp",
"Quadratic Programming package"},
197 {
"roofit",
"RooFit tutorials"},
198 {
"roostats",
"Roostats tutorials"},
199 {
"ruby",
"Ruby-ROOT"},
200 {
"spectrum",
"Peak Finder, Deconvolutions"},
201 {
"splot",
"TSPlot example"},
202 {
"sql",
"SQL Data Bases interfaces"},
203 {
"thread",
"Multi-Threading examples"},
204 {
"unuran",
"The Unuran package"},
205 {
"xml",
"XML tools"},
210 ofstream fptop(
"htmldoc/tutorials/index.html");
213 MakeTopLinks(topLinks, 0,
"ROOT Tutorials",
"../index",
"ROOT", 0,
"");
214 fptop << topLinks << endl;
215 fptop <<
"<ul id=\"indx\">" << endl;
223 TNamed curr(tutorials[0][0], tutorials[0][1]);
224 TNamed next(tutorials[1][0], tutorials[1][1]);
230 const char** iTut = tutorials[2];
240 fptop <<
"</ul>" << endl;
241 fptop <<
"<p><a href=\"http://root.cern.ch/drupal/content/downloading-root\">Download ROOT</a> and run the tutorials in $ROOTSYS/tutorials yourself!</p>" << endl;
252 FILE *fp = fopen(fullpath,
"r");
255 while (fgets(
line,240,fp)) {
257 char *com = strstr(
line,
"//");
259 if (strstr(
line,
"Author"))
continue;
260 if (strstr(
line,
"@(#)"))
continue;
261 if (strstr(
line,
"****"))
continue;
262 if (strstr(
line,
"////"))
continue;
263 if (strstr(
line,
"===="))
continue;
264 if (strstr(
line,
"...."))
continue;
265 if (strstr(
line,
"----"))
continue;
266 if (strstr(
line,
"____"))
continue;
267 if (strlen(com+1) < 5)
continue;
268 if (!strncmp(com,
"//+ ", 4)) {
275 if (nlines > 50)
break;
283 FILE *fpdate = fopen(
"MakeTutorials-tmp.log",
"r");
288 Int_t year,month,day;
289 while (fgets(
line,240,fpdate)) {
290 const char *com = strstr(
line,
"Last Changed Date: ");
292 sscanf(&com[19],
"%d-%d-%d",&year,&month,&day);
293 Int_t filedate = 365*(year-1) + 12*(month-1) + day;
294 if (now-filedate< 6*30) isnew =
kTRUE;
307 if (strstr(dir,
"net"))
return kFALSE;
308 if (strstr(dir,
"xml"))
return kFALSE;
309 if (strstr(dir,
"sql"))
return kFALSE;
310 if (strstr(dir,
"proof"))
return kFALSE;
311 if (strstr(dir,
"foam"))
return kFALSE;
312 if (strstr(dir,
"unuran"))
return kFALSE;
313 if (strstr(dir,
"roofit"))
return kFALSE;
314 if (strstr(dir,
"thread"))
return kFALSE;
321 static const char* vetoed[] = {
333 "rs401d_FeldmanCousins",
334 "graph_edit_playback",
342 for (
const char** iVetoed = vetoed; *iVetoed; ++iVetoed)
343 if (strstr(tut, *iVetoed))
353 TString fullpath(
"htmldoc/tutorials/");
356 fullpath +=
"/index.html";
358 ofstream fpind(fullpath);
363 MakeTopLinks(topLinks, 0, title,
".",
"ROOT Tutorials", toplnk, dir);
366 topLinks.ReplaceAll(
"href=\"",
"href=\"../");
367 topLinks.ReplaceAll(
"href=\"../http://",
"href=\"http://");
368 topLinks.ReplaceAll(
"href=\"../https://",
"href=\"https://");
369 topLinks.ReplaceAll(
".html\"",
"/index.html\"");
371 topLinks.ReplaceAll(
"<h1 class=\"convert\">",
"<h1 class=\"convert\">ROOT Tutorials: ");
372 fpind << topLinks << endl;
373 fpind <<
"<ul id=\"indx\">" << endl;
375 TString outpath(
"htmldoc/tutorials/");
377 TString inpath(
"$ROOTSYS/tutorials/");
383 printf(
"MakeTutorials.C: error opening directory %s", inpath.Data());
386 const char *direntry;
389 if(*direntry ==
'.')
continue;
390 const char *CC = strstr(direntry,
".C");
392 if (!CC || *(CC+2))
continue;
394 if(strstr(direntry,
"h1anal"))
continue;
395 if(strstr(direntry,
"hsimpleProxy"))
continue;
396 if(strstr(direntry,
"tv3"))
continue;
397 if(strstr(direntry,
"tvdemo"))
continue;
398 if(strstr(direntry,
"na49"))
continue;
399 if(strstr(direntry,
"fit1_C"))
continue;
400 if(strstr(direntry,
"c1.C"))
continue;
401 if(strstr(direntry,
"MDF.C"))
continue;
402 if(strstr(direntry,
"cms_calo_detail"))
continue;
403 TString atut(inpath + direntry);
418 TString atut(inpath + direntry);
420 TString iname(direntry);
424 if (!
gROOT->IsBatch()) {
435 TString tutTitle(named->
GetName());
439 html.
Convert(atut,named->
GetTitle(),outpath,
"../../",includeOutput,links);
440 gROOT->GetListOfCanvases()->Delete();
442 gROOT->GetListOfFunctions()->Delete();
443 gROOT->GetListOfBrowsers()->Delete();
444 gROOT->GetListOfGeometries()->Delete();
449 gROOT->SetStyle(
"Default");
452 fpind <<
"</ul>" << endl;
462 gEnv->
SetValue(
"Unix.*.Root.Html.SourceDir",
"$(ROOTSYS)");
463 gEnv->
SetValue(
"Root.Html.ViewCVS",
"http://root.cern.ch/viewcvs/trunk/%f?view=log");
464 gEnv->
SetValue(
"Root.Html.Search",
"http://www.google.com/search?q=%s+site%3A%u");
Bool_t IsNew(const char *filename)
void writeHeader(THtml &html, ostream &out, const char *title, const char *relPath="../")
void AppendLink(TString &links, int id, const TNamed *n)
Bool_t CreateOutput_Tutorial(const char *tut)
void GetMacroTitle(const char *fullpath, TString &comment, Bool_t &compile)
void writeItem(ostream &out, Int_t numb, const char *ref, const char *name, const char *title, Bool_t isnew)
void writeTutorials(THtml &html)
void scandir(THtml &html, const char *dir, const char *title, TObjLink *toplnk)
void writeTrailer(THtml &html, ostream &out)
Bool_t CreateOutput_Dir(const char *dir)
void MakeTopLinks(TString &links, const char *name, const char *title, const char *upLink, const char *upTitle, TObjLink *lnk, const char *dir)
void writeItemDir(THtml &html, ostream &out, TObjLink *lnk)
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
void WriteHtmlFooter(std::ostream &out, const char *dir, const char *lastUpdate, const char *author, const char *copyright, const char *footer)
Write HTML footer.
void WriteHtmlHeader(std::ostream &out, const char *titleNoSpecial, const char *dir, TClass *cls, const char *header)
Write HTML header.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=0)
Set the value of a resource or create a new resource.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
static void LoadAllLibs()
Load all libraries known to ROOT via the rootmap system.
virtual void CreateAuxiliaryFiles() const
copy CSS, javascript file, etc to the output dir
void Convert(const char *filename, const char *title, const char *dirname="", const char *relpath="../", Int_t includeOutput=kNoOutput, const char *context="")
It converts a single text file to HTML.
virtual TObjLink * FirstLink() const
virtual void AddLast(TObject *obj)
Add object at the end of the list.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual const char * GetTitle() const
Returns title of object.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
static void BuildStyles()
Create some standard styles.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual int MakeDirectory(const char *name)
Make a directory.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e.