1 # -----------------------------------------------------------------------
2 # Script name: CompileDocs.tcl
3 # This script compiles OCCT documents from *.md files to HTML pages
5 # -----------------------------------------------------------------------
7 # get OCCT version from file Standard_Version.hxx (if available)
8 proc OverviewDoc_DetectCasVersion {theCasRoot} {
11 if { [file exist $theCasRoot/src/Standard/Standard_Version.hxx] } {
12 set fh [open $theCasRoot/src/Standard/Standard_Version.hxx]
13 set fh_loaded [read $fh]
15 regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
16 regexp {#\s*define\s+OCC_VERSION_DEVELOPMENT\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver_add
17 if { "$occt_ver_add" != "" } { set occt_ver ${occt_ver}.$occt_ver_add }
22 # Generates Doxygen configuration file for Overview documentation
23 proc OverviewDoc_MakeDoxyfile {casDir outDir tagFileDir {doxyFileName} {generatorMode ""} DocFilesList verboseMode searchMode hhcPath} {
25 set doxyFile [open $doxyFileName "w"]
27 set inputDir $casDir/dox
30 puts $doxyFile "DOXYFILE_ENCODING = UTF-8"
31 puts $doxyFile "PROJECT_NAME = \"Open CASCADE Technology\""
32 puts $doxyFile "PROJECT_NUMBER = [OverviewDoc_DetectCasVersion $casDir]"
33 puts $doxyFile "PROJECT_BRIEF = "
34 puts $doxyFile "PROJECT_LOGO = $inputDir/resources/occ_logo.png"
36 puts $doxyFile "OUTPUT_DIRECTORY = $outDir"
37 puts $doxyFile "CREATE_SUBDIRS = NO"
38 puts $doxyFile "OUTPUT_LANGUAGE = English"
39 puts $doxyFile "ABBREVIATE_BRIEF = \"The \$name class\" \
40 \"The \$name widget\" \
51 puts $doxyFile "FULL_PATH_NAMES = YES"
52 puts $doxyFile "INHERIT_DOCS = YES"
53 puts $doxyFile "TAB_SIZE = 4"
54 puts $doxyFile "MARKDOWN_SUPPORT = YES"
55 puts $doxyFile "EXTRACT_ALL = YES"
56 puts $doxyFile "CASE_SENSE_NAMES = NO"
57 puts $doxyFile "INLINE_INFO = YES"
58 puts $doxyFile "SORT_MEMBER_DOCS = YES"
59 puts $doxyFile "WARNINGS = YES"
60 puts $doxyFile "WARN_IF_UNDOCUMENTED = YES"
61 puts $doxyFile "WARN_IF_DOC_ERROR = YES"
62 puts $doxyFile "WARN_NO_PARAMDOC = NO"
63 puts $doxyFile "WARN_FORMAT = \"\$file:\$line: \$text\""
64 puts $doxyFile "INPUT_ENCODING = UTF-8"
65 puts $doxyFile "FILE_PATTERNS = *.md *.dox "
66 puts $doxyFile "RECURSIVE = YES"
67 puts $doxyFile "SOURCE_BROWSER = NO"
68 puts $doxyFile "INLINE_SOURCES = YES"
69 puts $doxyFile "COLS_IN_ALPHA_INDEX = 5"
72 puts $doxyFile "GENERATE_DOCSET = NO"
73 puts $doxyFile "GENERATE_CHI = NO"
74 puts $doxyFile "GENERATE_QHP = NO"
75 puts $doxyFile "GENERATE_ECLIPSEHELP = NO"
76 puts $doxyFile "GENERATE_RTF = NO"
77 puts $doxyFile "GENERATE_MAN = NO"
78 puts $doxyFile "GENERATE_XML = NO"
79 puts $doxyFile "GENERATE_DOCBOOK = NO"
80 puts $doxyFile "GENERATE_AUTOGEN_DEF = NO"
81 puts $doxyFile "GENERATE_PERLMOD = NO"
83 set PARAM_INPUT "INPUT ="
84 set PARAM_IMAGEPATH "IMAGE_PATH = $inputDir/resources/ "
86 foreach docFile $DocFilesList {
87 set NEW_IMG_PATH [file normalize [file dirname "$inputDir/$docFile"]]
88 if { [string compare $NEW_IMG_PATH $casroot] != 0 } {
89 if {[file isdirectory "$NEW_IMG_PATH/images"]} {
90 append PARAM_IMAGEPATH " $NEW_IMG_PATH/images"
93 append PARAM_INPUT " " $inputDir/$docFile
95 puts $doxyFile $PARAM_INPUT
96 puts $doxyFile $PARAM_IMAGEPATH
98 if { $generatorMode == "HTML_ONLY"} {
99 # Set a reference to a TAGFILE
100 if { $tagFileDir != "" } {
101 if {[file exists $tagFileDir/OCCT.tag] == 1} {
102 set tagPath [OverviewDoc_GetRelPath $tagFileDir $outDir/html]
103 puts $doxyFile "TAGFILES = $tagFileDir/OCCT.tag=$tagPath/html"
107 puts $doxyFile "GENERATE_LATEX = NO"
108 puts $doxyFile "GENERATE_HTMLHELP = NO"
109 puts $doxyFile "GENERATE_HTML = YES"
110 puts $doxyFile "HTML_COLORSTYLE_HUE = 220"
111 puts $doxyFile "HTML_COLORSTYLE_SAT = 100"
112 puts $doxyFile "HTML_COLORSTYLE_GAMMA = 80"
113 puts $doxyFile "HTML_TIMESTAMP = YES"
114 puts $doxyFile "HTML_DYNAMIC_SECTIONS = YES"
115 puts $doxyFile "HTML_INDEX_NUM_ENTRIES = 100"
116 puts $doxyFile "DISABLE_INDEX = YES"
117 puts $doxyFile "GENERATE_TREEVIEW = YES"
118 puts $doxyFile "ENUM_VALUES_PER_LINE = 8"
119 puts $doxyFile "TREEVIEW_WIDTH = 250"
120 puts $doxyFile "EXTERNAL_PAGES = NO"
121 # HTML Search engine options
122 if { [string tolower $searchMode] == "none" } {
123 puts $doxyFile "SEARCHENGINE = NO"
124 puts $doxyFile "SERVER_BASED_SEARCH = NO"
125 puts $doxyFile "EXTERNAL_SEARCH = NO"
127 puts $doxyFile "SEARCHENGINE = YES"
128 if { [string tolower $searchMode] == "local" } {
129 puts $doxyFile "SERVER_BASED_SEARCH = NO"
130 puts $doxyFile "EXTERNAL_SEARCH = NO"
131 } elseif { [string tolower $searchMode] == "server" } {
132 puts $doxyFile "SERVER_BASED_SEARCH = YES"
133 puts $doxyFile "EXTERNAL_SEARCH = NO"
134 } elseif { [string tolower $searchMode] == "external" } {
135 puts $doxyFile "SERVER_BASED_SEARCH = YES"
136 puts $doxyFile "EXTERNAL_SEARCH = YES"
138 puts "ERROR: Wrong search engine type"
143 puts $doxyFile "SEARCHDATA_FILE = searchdata.xml"
144 puts $doxyFile "SKIP_FUNCTION_MACROS = YES"
146 puts $doxyFile "FORMULA_FONTSIZE = 12"
147 puts $doxyFile "FORMULA_TRANSPARENT = YES"
148 puts $doxyFile "USE_MATHJAX = YES"
149 puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
150 puts $doxyFile "MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest"
152 } elseif { $generatorMode == "CHM_ONLY"} {
153 puts $doxyFile "GENERATE_HTMLHELP = YES"
154 puts $doxyFile "CHM_FILE = ../../overview.chm"
155 puts $doxyFile "HHC_LOCATION = \"$hhcPath\""
156 puts $doxyFile "DISABLE_INDEX = YES"
158 puts $doxyFile "FORMULA_FONTSIZE = 12"
159 puts $doxyFile "FORMULA_TRANSPARENT = YES"
160 puts $doxyFile "USE_MATHJAX = YES"
161 puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
162 puts $doxyFile "MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest"
164 } elseif { $generatorMode == "PDF_ONLY"} {
165 puts $doxyFile "GENERATE_HTMLHELP = NO"
166 puts $doxyFile "GENERATE_HTML = NO"
167 puts $doxyFile "DISABLE_INDEX = YES"
168 puts $doxyFile "GENERATE_TREEVIEW = NO"
169 puts $doxyFile "PREDEFINED = PDF_ONLY"
170 puts $doxyFile "GENERATE_LATEX = YES"
171 puts $doxyFile "COMPACT_LATEX = YES"
172 puts $doxyFile "PDF_HYPERLINKS = YES"
173 puts $doxyFile "USE_PDFLATEX = YES"
174 puts $doxyFile "LATEX_BATCHMODE = YES"
175 puts $doxyFile "LATEX_OUTPUT = latex"
176 puts $doxyFile "LATEX_CMD_NAME = latex"
177 puts $doxyFile "MAKEINDEX_CMD_NAME = makeindex"
183 # Returns the relative path between two directories
184 proc OverviewDoc_GetRelPath {targetFile currentpath} {
185 set cc [file split [file normalize $currentpath]]
186 set tt [file split [file normalize $targetFile]]
188 if {![string equal [lindex $cc 0] [lindex $tt 0]]} {
190 return -code error "$targetFile not on same volume as $currentpath"
192 while {[string equal [lindex $cc 0] [lindex $tt 0]] && [llength $cc] > 0} {
193 # discard matching components from the front
194 set cc [lreplace $cc 0 0]
195 set tt [lreplace $tt 0 0]
198 if {[llength $cc] == 0} {
199 # just the file name, so targetFile is lower down (or in same place)
203 for {set i 0} {$i < [llength $cc]} {incr i} {
206 # stick it all together (the eval is to flatten the targetFile list)
207 return [eval file join $prefix $tt]
210 # Prints Help message
211 proc OverviewDoc_PrintHelpMessage {} {
212 puts "\nUsage : occdoc \[-h\] \[-html\] \[-pdf\] \[-m=<list of files>\] \[-l=<document name>\] \[-v\] \[-s\]"
214 puts " Options are : "
215 puts " -html : To generate HTML files"
216 puts " (cannot be used with -pdf or -chm)"
217 puts " -pdf : To generate PDF files"
218 puts " (cannot be used with -html or chm)"
219 puts " -chm : To generate CHM files"
220 puts " (cannot be used with -html or pdf)"
221 puts " -hhc : To define path to hhc - chm generator"
222 puts " : is used with just -chm option"
223 puts " -m=<modules_list> : Specifies list of documents to generate."
224 puts " If it is not specified, all files, "
225 puts " mentioned in FILES.txt are processed."
226 puts " -l=<document_name> : Specifies the document caption "
227 puts " for a single document"
228 puts " -h : Prints help message"
229 puts " -v : Specifies the Verbose mode"
230 puts " (info on all script actions is shown)"
231 puts " -s=<search_mode> : Specifies the Search mode of HTML documents."
232 puts " Can be: none | local | server | external | "
233 puts " : Can be used only with -html option"
236 # Parses command line arguments
237 proc OverviewDoc_ParseArguments {arguments} {
241 array set args_values {}
243 foreach arg $arguments {
244 if {[regexp {^(-)[a-z]+$} $arg] == 1} {
245 set name [string range $arg 1 [string length $arg]-1]
246 lappend args_names $name
247 set args_values($name) "NULL"
249 } elseif {[regexp {^(-)[a-z]+=.+$} $arg] == 1} {
250 set equal_symbol_position [string first "=" $arg]
251 set name [string range $arg 1 $equal_symbol_position-1]
252 lappend args_names $name
253 set value [string range $arg $equal_symbol_position+1 [string length $arguments]-1]
255 # To parse a list of values for -m parameter
256 if { [string first "," $value] != -1 } {
257 set value [split $value ","];
259 set args_values($name) $value
261 puts "Error in argument $arg"
268 # Loads a list of docfiles from file FILES.txt
269 proc OverviewDoc_LoadFilesList {} {
271 set INPUTDIR [file normalize [file dirname [info script]]]
273 global available_docfiles
274 set available_docfiles {}
276 # Read data from file
277 if { [file exists "$INPUTDIR/FILES.txt"] == 1 } {
278 set FILE [open "$INPUTDIR/FILES.txt" r]
280 set line [string trim [gets $FILE]]
282 # trim possible comments starting with '#'
283 set line [regsub {\#.*} $line {}]
286 lappend available_docfiles $line
300 # Writes new tex file for conversion from tex to pdf for a specific doc
301 proc OverviewDoc_MakeRefmanTex {fileName latexDir docLabel verboseMode} {
303 if {$verboseMode == "YES"} {
304 puts "INFO: Making refman.tex file for $fileName"
306 set DOCNAME "$latexDir/refman.tex"
307 if {[file exists $DOCNAME] == 1} {
308 file delete -force $DOCNAME
310 set texfile [open $DOCNAME w]
312 puts $texfile "\\batchmode"
313 puts $texfile "\\nonstopmode"
314 puts $texfile "\\documentclass\[oneside\]{article}"
315 puts $texfile "\n% Packages required by doxygen"
316 puts $texfile "\\usepackage{calc}"
317 puts $texfile "\\usepackage{doxygen}"
318 puts $texfile "\\usepackage{graphicx}"
319 puts $texfile "\\usepackage\[utf8\]{inputenc}"
320 puts $texfile "\\usepackage{makeidx}"
321 puts $texfile "\\usepackage{multicol}"
322 puts $texfile "\\usepackage{multirow}"
323 puts $texfile "\\usepackage{textcomp}"
324 puts $texfile "\\usepackage{amsmath}"
325 puts $texfile "\\usepackage\[table\]{xcolor}"
326 puts $texfile "\\usepackage{indentfirst}"
328 puts $texfile "% Font selection"
329 puts $texfile "\\usepackage\[T1\]{fontenc}"
330 puts $texfile "\\usepackage{mathptmx}"
331 puts $texfile "\\usepackage\[scaled=.90\]{helvet}"
332 puts $texfile "\\usepackage{courier}"
333 puts $texfile "\\usepackage{amssymb}"
334 puts $texfile "\\usepackage{sectsty}"
335 puts $texfile "\\renewcommand{\\familydefault}{\\sfdefault}"
336 puts $texfile "\\allsectionsfont{%"
337 puts $texfile " \\fontseries{bc}\\selectfont%"
338 puts $texfile " \\color{darkgray}%"
340 puts $texfile "\\renewcommand{\\DoxyLabelFont}{%"
341 puts $texfile " \\fontseries{bc}\\selectfont%"
342 puts $texfile " \\color{darkgray}%"
345 puts $texfile "% Page & text layout"
346 puts $texfile "\\usepackage{geometry}"
347 puts $texfile "\\geometry{%"
348 puts $texfile " a4paper,%"
349 puts $texfile " top=2.5cm,%"
350 puts $texfile " bottom=2.5cm,%"
351 puts $texfile " left=2.5cm,%"
352 puts $texfile " right=2.5cm%"
354 puts $texfile "\\tolerance=750"
355 puts $texfile "\\hfuzz=15pt"
356 puts $texfile "\\hbadness=750"
357 puts $texfile "\\setlength{\\emergencystretch}{15pt}"
358 puts $texfile "\\setlength{\\parindent}{0cm}";#0.75cm
359 puts $texfile "\\setlength{\\parskip}{0.2cm}"; #0.2
360 puts $texfile "\\makeatletter"
361 puts $texfile "\\renewcommand{\\paragraph}{%"
362 puts $texfile " \@startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{%"
363 puts $texfile "\\normalfont\\normalsize\\bfseries\\SS@parafont%"
366 puts $texfile "\\renewcommand{\\subparagraph}{%"
367 puts $texfile " \\@startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{%"
368 puts $texfile "\\normalfont\\normalsize\\bfseries\\SS@subparafont%"
371 puts $texfile "\\makeatother"
373 puts $texfile "% Headers & footers"
374 puts $texfile "\\usepackage{fancyhdr}"
375 puts $texfile "\\pagestyle{fancyplain}"
376 puts $texfile "\\fancyhead\[LE\]{\\fancyplain{}{\\bfseries\\thepage}}"
377 puts $texfile "\\fancyhead\[CE\]{\\fancyplain{}{}}"
378 puts $texfile "\\fancyhead\[RE\]{\\fancyplain{}{\\bfseries\\leftmark}}"
379 puts $texfile "\\fancyhead\[LO\]{\\fancyplain{}{\\bfseries\\rightmark}}"
380 puts $texfile "\\fancyhead\[CO\]{\\fancyplain{}{}}"
381 puts $texfile "\\fancyhead\[RO\]{\\fancyplain{}{\\bfseries\\thepage}}"
382 puts $texfile "\\fancyfoot\[LE\]{\\fancyplain{}{}}"
383 puts $texfile "\\fancyfoot\[CE\]{\\fancyplain{}{}}"
384 puts $texfile "\\fancyfoot\[RE\]{\\fancyplain{}{\\bfseries\\scriptsize (c) Open CASCADE 2001\-2013}}"
385 puts $texfile "\\fancyfoot\[LO\]{\\fancyplain{}{\\bfseries\\scriptsize (c) Open CASCADE 2001\-2013}}"
386 puts $texfile "\\fancyfoot\[CO\]{\\fancyplain{}{}}"
387 puts $texfile "\\fancyfoot\[RO\]{\\fancyplain{}{}}"
388 puts $texfile "\\renewcommand{\\footrulewidth}{0.4pt}"
389 puts $texfile "\\renewcommand{\\sectionmark}\[1\]{%"
390 puts $texfile " \\markright{\\thesection\\ #1}%"
393 puts $texfile "% Indices & bibliography"
394 puts $texfile "\\usepackage{natbib}"
395 puts $texfile "\\usepackage\[titles\]{tocloft}"
396 puts $texfile "\\renewcommand{\\cftsecleader}{\\cftdotfill{\\cftdotsep}}"
397 puts $texfile "\\setcounter{tocdepth}{3}"
398 puts $texfile "\\setcounter{secnumdepth}{5}"
399 puts $texfile "\\makeindex"
401 puts $texfile "% Hyperlinks (required, but should be loaded last)"
402 puts $texfile "\\usepackage{ifpdf}"
403 puts $texfile "\\ifpdf"
404 puts $texfile " \\usepackage\[pdftex,pagebackref=true\]{hyperref}"
405 puts $texfile "\\else"
406 puts $texfile " \\usepackage\[ps2pdf,pagebackref=true\]{hyperref}"
408 puts $texfile "\\hypersetup{%"
409 puts $texfile " colorlinks=true,%"
410 puts $texfile " linkcolor=black,%"
411 puts $texfile " citecolor=black,%"
412 puts $texfile " urlcolor=blue,%"
413 puts $texfile " unicode%"
416 puts $texfile "% Custom commands"
417 puts $texfile "\\newcommand{\\clearemptydoublepage}{%"
418 puts $texfile " \\newpage{\\pagestyle{empty}\\cleardoublepage}%"
421 puts $texfile "%===== C O N T E N T S =====\n"
422 puts $texfile "\\begin{document}"
424 puts $texfile "% Titlepage & ToC"
425 puts $texfile "\\hypersetup{pageanchor=false}"
426 puts $texfile "\\pagenumbering{roman}"
427 puts $texfile "\\begin{titlepage}"
428 puts $texfile "\\vspace*{7cm}"
429 puts $texfile "\\begin{center}%"
430 puts $texfile "\\includegraphics\[width=0.75\\textwidth, height=0.2\\textheight\]{../../../dox/resources/occt_logo.png}\\\\"; #\\\\\\\\
431 puts $texfile "{\\Large Open C\\-A\\-S\\-C\\-A\\-D\\-E Technology \\\\\[1ex\]\\Large [OverviewDoc_DetectCasVersion $latexDir/../../../] }\\\\"
432 puts $texfile "\\vspace*{1cm}"
433 puts $texfile "{\\Large $docLabel}\\\\"
434 puts $texfile "\\vspace*{1cm}"
435 puts $texfile "{\\large Generated by Doxygen 1.8.4}\\\\"
436 puts $texfile "\\vspace*{0.5cm}"
437 puts $texfile "{\\small \\today}\\"
438 puts $texfile "\\end{center}"
439 puts $texfile "\\end{titlepage}"
440 puts $texfile "\\clearpage"
441 puts $texfile "\\pagenumbering{roman}"
442 puts $texfile "\\tableofcontents"
443 puts $texfile "\\newpage"
444 puts $texfile "\\pagenumbering{arabic}"
445 puts $texfile "\\hypersetup{pageanchor=true}"
447 puts $texfile "\\let\\stdsection\\section"
448 puts $texfile " \\renewcommand\\section{\\pagebreak\\stdsection}"
449 puts $texfile "\\hypertarget{$fileName}{}"
450 puts $texfile "\\input{$fileName}"
452 puts $texfile "% Index"
453 puts $texfile "\\newpage"
454 puts $texfile "\\phantomsection"
455 puts $texfile "\\addcontentsline{toc}{part}{Index}"
456 puts $texfile "\\printindex\n"
457 puts $texfile "\\end{document}"
462 # Postprocesses generated TeX files
463 proc OverviewDoc_ProcessTex {{texFiles {}} {latexDir} verboseMode} {
465 foreach TEX $texFiles {
466 if {$verboseMode == "YES"} {
467 puts "INFO: Preprocessing file $TEX"
470 if {![file exists $TEX]} {
471 puts "file $TEX doesn't exist"
475 set IN_F [open "$TEX" r]
476 set TMPFILENAME "$latexDir/temp.tex"
478 set OUT_F [open $TMPFILENAME w]
481 set line [gets $IN_F]
482 if { [string first "\\includegraphics" $line] != -1 } {
483 # Center images in TeX files
484 set line "\\begin{center}\n $line\n\\end{center}"
485 } elseif { [string first "\\subsection" $line] != -1 } {
486 # Replace \subsection with \section tag
487 regsub -all "\\\\subsection" $line "\\\\section" line
488 } elseif { [string first "\\subsubsection" $line] != -1 } {
489 # Replace \subsubsection with \subsection tag
490 regsub -all "\\\\subsubsection" $line "\\\\subsection" line
491 } elseif { [string first "\\paragraph" $line] != -1 } {
492 # Replace \paragraph with \subsubsection tag
493 regsub -all "\\\\paragraph" $line "\\\\subsubsection" line
503 file delete -force $TEX
504 file rename $TMPFILENAME $TEX
508 # Main procedure for documents compilation
509 proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchMode hhcPath} {
511 set INDIR [file normalize [file dirname [info script]]]
512 set CASROOT [file normalize [file dirname "$INDIR/../../"]]
513 set OUTDIR $CASROOT/doc
514 set PDFDIR $OUTDIR/overview/pdf
515 set HTMLDIR $OUTDIR/overview/html
516 set LATEXDIR $OUTDIR/overview/latex
517 set TAGFILEDIR $OUTDIR/refman
518 set DOXYFILE $OUTDIR/OCCT.cfg
520 # Create or clean the output folders
521 if {[file exists $OUTDIR] == 0} {
524 if {[file exists $HTMLDIR] == 0} {
527 if {[file exists $PDFDIR] == 0} {
531 if {[file exists $LATEXDIR]} {
532 #file delete {*}[glob -nocomplain $LATEXDIR/*.*]
533 file delete -force $LATEXDIR
537 # Run tools to compile documents
538 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating Doxyfile..."
540 OverviewDoc_MakeDoxyfile $CASROOT "$OUTDIR/overview" $TAGFILEDIR $DOXYFILE $generatorMode $docfiles $verboseMode $searchMode $hhcPath
543 if { $generatorMode == "HTML_ONLY"} {
544 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating HTML files..."
545 } elseif { $generatorMode == "CHM_ONLY" } {
546 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating CHM file..."
548 set RESULT [catch {exec doxygen $DOXYFILE > $OUTDIR/doxygen_out.log} DOX_ERROR]
550 if {[llength [split $DOX_ERROR "\n"]] > 1} {
551 if {$verboseMode == "YES"} {
552 puts "See Doxygen log in $OUTDIR/doxygen_warnings_and_errors.log"
554 set DOX_ERROR_FILE [open "$OUTDIR/doxygen_warnings_and_errors.log" "w"]
555 puts $DOX_ERROR_FILE $DOX_ERROR
556 close $DOX_ERROR_FILE
561 # Close the Doxygen application
564 # Start PDF generation routine
565 if { $generatorMode == "PDF_ONLY" } {
566 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating PDF files..."
568 set OS $::tcl_platform(platform)
569 if { $OS == "unix" } {
571 } elseif { $OS == "windows" } {
575 # Prepare a list of TeX files, generated by Doxygen
578 set TEXFILES [glob $LATEXDIR -type f -directory $LATEXDIR -tails "*.tex" ]
579 set REFMAN_IDX [lsearch $TEXFILES "refman.tex"]
580 set TEXFILES [lreplace $TEXFILES $REFMAN_IDX $REFMAN_IDX]
583 set IDX [lsearch $TEXFILES "$LATEXDIR"]
584 while { $IDX != -1} {
585 set TEXFILES [lreplace $TEXFILES $IDX $IDX]
586 set IDX [lsearch $TEXFILES "$LATEXDIR"]
589 if {$verboseMode == "YES"} {
590 puts "Preprocessing generated TeX files..."
592 OverviewDoc_ProcessTex $TEXFILES $LATEXDIR $verboseMode
594 if {$verboseMode == "YES"} {
595 puts "Generating PDF files from TeX files..."
597 foreach TEX $TEXFILES {
598 # Rewrite existing REFMAN.tex file...
599 set TEX [string range $TEX 0 [ expr "[string length $TEX] - 5"]]
600 OverviewDoc_MakeRefmanTex $TEX $LATEXDIR $docLabel $verboseMode
602 if {$verboseMode == "YES"} {
603 puts "INFO: Generating PDF file from $TEX"
604 # ...and use it to generate PDF from TeX...
605 puts "Executing $LATEXDIR/make$PREFIX..."
607 set RESULT [catch {eval exec [auto_execok $LATEXDIR/make$PREFIX] > "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR]
609 if {[llength [split $LaTeX_ERROR "\n"]] > 1} {
610 if {$verboseMode == "YES"} {
611 puts "See Latex log in $OUTDIR/pdflatex_warnings_and_errors.log"
613 set LaTeX_ERROR_FILE [open "$OUTDIR/pdflatex_warnings_and_errors.log" "w"]
614 puts $LaTeX_ERROR_FILE $LaTeX_ERROR
615 close $LaTeX_ERROR_FILE
621 # ...and place it to the specific folder
622 if { [file exists $PDFDIR/$TEX.pdf] == 1 } {
623 file delete -force $PDFDIR/$TEX.pdf
626 if {![file exists "$LATEXDIR/refman.pdf"]} {
627 puts "Error: file $LATEXDIR/refman.pdf does not exist"
631 file rename $LATEXDIR/refman.pdf "$PDFDIR/$TEX.pdf"
636 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed"
637 if { $generatorMode == "HTML_ONLY" } {
638 puts "View generated HTML documentation by opening: "
639 set RESFILE $OUTDIR/overview/html/index.html
642 if { $generatorMode == "PDF_ONLY" } {
643 puts "PDF files are generated in: "
644 puts "$OUTDIR/overview/pdf folder"
648 # A command for User Documentation compilation
651 set GEN_MODE "HTML_ONLY"
654 set DOCLABEL "Default OCCT Document"
656 set SEARCH_MODE "none"
659 global available_docfiles
665 # Load list of docfiles
666 if { [OverviewDoc_LoadFilesList] != 0 } {
667 puts "ERROR: File FILES.txt was not found"
672 if {[OverviewDoc_ParseArguments $args] == 1} {
676 foreach arg_n $args_names {
678 OverviewDoc_PrintHelpMessage
680 } elseif {$arg_n == "html"} {
681 set GEN_MODE "HTML_ONLY"
682 } elseif {$arg_n == "chm"} {
683 set GEN_MODE "CHM_ONLY"
685 if {"$tcl_platform(platform)" == "windows" && [lsearch $args_names hhc] == -1} {
686 if { [info exist env(ProgramFiles\(x86\))] } {
687 set hhcPath "$env(ProgramFiles\(x86\))\\HTML Help Workshop\\hhc.exe"
688 puts "Info: hhc found: $hhcPath"
689 } elseif { [info exist env(ProgramFiles)] } {
690 set hhcPath "$env(ProgramFiles)\\HTML Help Workshop\\hhc.exe"
691 puts "Info: hhc found: $hhcPath"
694 if { ! [file exists $hhcPath] } {
695 puts "Error: HTML Help Compiler is not found in standard location [file dirname $hhcPath]; use option -hhc"
700 } elseif {$arg_n == "hhc"} {
702 if { $tcl_platform(platform) != "windows" } {
706 if {$args_values(hhc) != "NULL"} {
707 set hhcPath $args_values(hhc)
708 if { [file isdirectory $hhcPath] } {
709 set hhcPath [file join ${hhcPath} hhc.exe]
711 if { ! [file exists $hhcPath] } {
712 puts "Error: HTML Help Compiler is not found in $hhcPath"
716 puts "Error in argument hhc"
720 } elseif {$arg_n == "pdf"} {
721 set GEN_MODE "PDF_ONLY"
722 } elseif {$arg_n == "v"} {
724 } elseif {$arg_n == "m"} {
725 if {$args_values(m) != "NULL"} {
726 set DOCFILES $args_values(m)
728 puts "Error in argument m"
732 # Check if all chosen docfiles are correct
733 foreach docfile $DOCFILES {
734 if { [lsearch $available_docfiles $docfile] == -1 } {
735 puts "File \"$docfile\" is not presented in the list of available docfiles"
736 puts "Please, specify the correct docfile name"
739 puts "File $docfile is presented in FILES.TXT"
742 } elseif {$arg_n == "l"} {
743 if { [llength $DOCFILES] <= 1 } {
744 if {$args_values(l) != "NULL"} {
745 set DOCLABEL $args_values(l)
747 puts "Error in argument l"
751 } elseif {$arg_n == "s"} {
752 if {$args_values(s) != "NULL"} {
753 set SEARCH_MODE $args_values(s)
755 puts "Error in argument s"
759 puts "\nWrong argument: $arg_n"
760 OverviewDoc_PrintHelpMessage
765 # Specify verbose mode
766 if { $GEN_MODE != "PDF_ONLY" && [llength $DOCFILES] > 1 } {
770 # If we don't specify list for docfiles with -m argument,
771 # we assume that we have to generate all docfiles
772 if { [llength $DOCFILES] == 0 } {
773 set DOCFILES $available_docfiles
776 # Start main activities
777 OverviewDoc_Main $DOCFILES $GEN_MODE $DOCLABEL $VERB_MODE $SEARCH_MODE $hhcPath