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*#\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 # Keep doxygen comments within code blocks
84 puts $doxyFile "STRIP_CODE_COMMENTS = NO"
86 set PARAM_INPUT "INPUT ="
87 set PARAM_IMAGEPATH "IMAGE_PATH = $inputDir/resources/ "
89 foreach docFile $DocFilesList {
90 set NEW_IMG_PATH [file normalize [file dirname "$inputDir/$docFile"]]
91 if { [string compare $NEW_IMG_PATH $casroot] != 0 } {
92 if {[file isdirectory "$NEW_IMG_PATH/images"]} {
93 append PARAM_IMAGEPATH " $NEW_IMG_PATH/images"
96 append PARAM_INPUT " " $inputDir/$docFile
98 puts $doxyFile $PARAM_INPUT
99 puts $doxyFile $PARAM_IMAGEPATH
101 if { $generatorMode == "HTML_ONLY"} {
102 # Set a reference to a TAGFILE
103 if { $tagFileDir != "" } {
104 if {[file exists $tagFileDir/OCCT.tag] == 1} {
105 set tagPath [OverviewDoc_GetRelPath $tagFileDir $outDir/html]
106 puts $doxyFile "TAGFILES = $tagFileDir/OCCT.tag=$tagPath/html"
110 puts $doxyFile "GENERATE_LATEX = NO"
111 puts $doxyFile "GENERATE_HTMLHELP = NO"
112 puts $doxyFile "GENERATE_HTML = YES"
113 puts $doxyFile "HTML_COLORSTYLE_HUE = 220"
114 puts $doxyFile "HTML_COLORSTYLE_SAT = 100"
115 puts $doxyFile "HTML_COLORSTYLE_GAMMA = 80"
116 puts $doxyFile "HTML_TIMESTAMP = YES"
117 puts $doxyFile "HTML_DYNAMIC_SECTIONS = YES"
118 puts $doxyFile "HTML_INDEX_NUM_ENTRIES = 100"
119 puts $doxyFile "DISABLE_INDEX = YES"
120 puts $doxyFile "GENERATE_TREEVIEW = YES"
121 puts $doxyFile "ENUM_VALUES_PER_LINE = 8"
122 puts $doxyFile "TREEVIEW_WIDTH = 250"
123 puts $doxyFile "EXTERNAL_PAGES = NO"
124 # HTML Search engine options
125 if { [string tolower $searchMode] == "none" } {
126 puts $doxyFile "SEARCHENGINE = NO"
127 puts $doxyFile "SERVER_BASED_SEARCH = NO"
128 puts $doxyFile "EXTERNAL_SEARCH = NO"
130 puts $doxyFile "SEARCHENGINE = YES"
131 if { [string tolower $searchMode] == "local" } {
132 puts $doxyFile "SERVER_BASED_SEARCH = NO"
133 puts $doxyFile "EXTERNAL_SEARCH = NO"
134 } elseif { [string tolower $searchMode] == "server" } {
135 puts $doxyFile "SERVER_BASED_SEARCH = YES"
136 puts $doxyFile "EXTERNAL_SEARCH = NO"
137 } elseif { [string tolower $searchMode] == "external" } {
138 puts $doxyFile "SERVER_BASED_SEARCH = YES"
139 puts $doxyFile "EXTERNAL_SEARCH = YES"
141 puts "ERROR: Wrong search engine type"
146 puts $doxyFile "SEARCHDATA_FILE = searchdata.xml"
147 puts $doxyFile "SKIP_FUNCTION_MACROS = YES"
149 puts $doxyFile "FORMULA_FONTSIZE = 12"
150 puts $doxyFile "FORMULA_TRANSPARENT = YES"
151 puts $doxyFile "USE_MATHJAX = YES"
152 puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
153 puts $doxyFile "MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest"
155 } elseif { $generatorMode == "CHM_ONLY"} {
156 puts $doxyFile "GENERATE_HTMLHELP = YES"
157 puts $doxyFile "CHM_FILE = ../../overview.chm"
158 puts $doxyFile "HHC_LOCATION = \"$hhcPath\""
159 puts $doxyFile "DISABLE_INDEX = YES"
161 puts $doxyFile "FORMULA_FONTSIZE = 12"
162 puts $doxyFile "FORMULA_TRANSPARENT = YES"
163 puts $doxyFile "USE_MATHJAX = YES"
164 puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
165 puts $doxyFile "MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest"
167 } elseif { $generatorMode == "PDF_ONLY"} {
168 puts $doxyFile "GENERATE_HTMLHELP = NO"
169 puts $doxyFile "GENERATE_HTML = NO"
170 puts $doxyFile "DISABLE_INDEX = YES"
171 puts $doxyFile "GENERATE_TREEVIEW = NO"
172 puts $doxyFile "PREDEFINED = PDF_ONLY"
173 puts $doxyFile "GENERATE_LATEX = YES"
174 puts $doxyFile "COMPACT_LATEX = YES"
175 puts $doxyFile "PDF_HYPERLINKS = YES"
176 puts $doxyFile "USE_PDFLATEX = YES"
177 puts $doxyFile "LATEX_BATCHMODE = YES"
178 puts $doxyFile "LATEX_OUTPUT = latex"
179 puts $doxyFile "LATEX_CMD_NAME = latex"
180 puts $doxyFile "MAKEINDEX_CMD_NAME = makeindex"
186 # Returns the relative path between two directories
187 proc OverviewDoc_GetRelPath {targetFile currentpath} {
188 set cc [file split [file normalize $currentpath]]
189 set tt [file split [file normalize $targetFile]]
191 if {![string equal [lindex $cc 0] [lindex $tt 0]]} {
193 return -code error "$targetFile not on same volume as $currentpath"
195 while {[string equal [lindex $cc 0] [lindex $tt 0]] && [llength $cc] > 0} {
196 # discard matching components from the front
197 set cc [lreplace $cc 0 0]
198 set tt [lreplace $tt 0 0]
201 if {[llength $cc] == 0} {
202 # just the file name, so targetFile is lower down (or in same place)
206 for {set i 0} {$i < [llength $cc]} {incr i} {
209 # stick it all together (the eval is to flatten the targetFile list)
210 return [eval file join $prefix $tt]
213 # Prints Help message
214 proc OverviewDoc_PrintHelpMessage {} {
215 puts "\nUsage : occdoc \[-h\] \[-html\] \[-pdf\] \[-m=<list of files>\] \[-l=<document name>\] \[-v\] \[-s\]"
217 puts " Options are : "
218 puts " -html : To generate HTML files"
219 puts " (cannot be used with -pdf or -chm)"
220 puts " -pdf : To generate PDF files"
221 puts " (cannot be used with -html or chm)"
222 puts " -chm : To generate CHM files"
223 puts " (cannot be used with -html or pdf)"
224 puts " -hhc : To define path to hhc - chm generator"
225 puts " : is used with just -chm option"
226 puts " -m=<modules_list> : Specifies list of documents to generate."
227 puts " If it is not specified, all files, "
228 puts " mentioned in FILES.txt are processed."
229 puts " -l=<document_name> : Specifies the document caption "
230 puts " for a single document"
231 puts " -h : Prints help message"
232 puts " -v : Specifies the Verbose mode"
233 puts " (info on all script actions is shown)"
234 puts " -s=<search_mode> : Specifies the Search mode of HTML documents."
235 puts " Can be: none | local | server | external | "
236 puts " : Can be used only with -html option"
239 # Parses command line arguments
240 proc OverviewDoc_ParseArguments {arguments} {
244 array set args_values {}
246 foreach arg $arguments {
247 if {[regexp {^(-)[a-z]+$} $arg] == 1} {
248 set name [string range $arg 1 [string length $arg]-1]
249 lappend args_names $name
250 set args_values($name) "NULL"
252 } elseif {[regexp {^(-)[a-z]+=.+$} $arg] == 1} {
253 set equal_symbol_position [string first "=" $arg]
254 set name [string range $arg 1 $equal_symbol_position-1]
255 lappend args_names $name
256 set value [string range $arg $equal_symbol_position+1 [string length $arguments]-1]
258 # To parse a list of values for -m parameter
259 if { [string first "," $value] != -1 } {
260 set value [split $value ","];
262 set args_values($name) $value
264 puts "Error in argument $arg"
271 # Loads a list of docfiles from file FILES.txt
272 proc OverviewDoc_LoadFilesList {} {
274 set INPUTDIR [file normalize [file dirname [info script]]]
276 global available_docfiles
277 set available_docfiles {}
279 # Read data from file
280 if { [file exists "$INPUTDIR/FILES.txt"] == 1 } {
281 set FILE [open "$INPUTDIR/FILES.txt" r]
283 set line [string trim [gets $FILE]]
285 # trim possible comments starting with '#'
286 set line [regsub {\#.*} $line {}]
289 lappend available_docfiles $line
303 # Writes new tex file for conversion from tex to pdf for a specific doc
304 proc OverviewDoc_MakeRefmanTex {fileName latexDir docLabel verboseMode} {
306 if {$verboseMode == "YES"} {
307 puts "INFO: Making refman.tex file for $fileName"
309 set DOCNAME "$latexDir/refman.tex"
310 if {[file exists $DOCNAME] == 1} {
311 file delete -force $DOCNAME
313 set texfile [open $DOCNAME w]
315 puts $texfile "\\batchmode"
316 puts $texfile "\\nonstopmode"
317 puts $texfile "\\documentclass\[oneside\]{article}"
318 puts $texfile "\n% Packages required by doxygen"
319 puts $texfile "\\usepackage{calc}"
320 puts $texfile "\\usepackage{doxygen}"
321 puts $texfile "\\usepackage{graphicx}"
322 puts $texfile "\\usepackage\[utf8\]{inputenc}"
323 puts $texfile "\\usepackage{makeidx}"
324 puts $texfile "\\usepackage{multicol}"
325 puts $texfile "\\usepackage{multirow}"
326 puts $texfile "\\usepackage{textcomp}"
327 puts $texfile "\\usepackage{amsmath}"
328 puts $texfile "\\usepackage\[table\]{xcolor}"
329 puts $texfile "\\usepackage{indentfirst}"
331 puts $texfile "% Font selection"
332 puts $texfile "\\usepackage\[T1\]{fontenc}"
333 puts $texfile "\\usepackage{mathptmx}"
334 puts $texfile "\\usepackage\[scaled=.90\]{helvet}"
335 puts $texfile "\\usepackage{courier}"
336 puts $texfile "\\usepackage{amssymb}"
337 puts $texfile "\\usepackage{sectsty}"
338 puts $texfile "\\renewcommand{\\familydefault}{\\sfdefault}"
339 puts $texfile "\\allsectionsfont{%"
340 puts $texfile " \\fontseries{bc}\\selectfont%"
341 puts $texfile " \\color{darkgray}%"
343 puts $texfile "\\renewcommand{\\DoxyLabelFont}{%"
344 puts $texfile " \\fontseries{bc}\\selectfont%"
345 puts $texfile " \\color{darkgray}%"
348 puts $texfile "% Page & text layout"
349 puts $texfile "\\usepackage{geometry}"
350 puts $texfile "\\geometry{%"
351 puts $texfile " a4paper,%"
352 puts $texfile " top=2.5cm,%"
353 puts $texfile " bottom=2.5cm,%"
354 puts $texfile " left=2.5cm,%"
355 puts $texfile " right=2.5cm%"
357 puts $texfile "\\tolerance=750"
358 puts $texfile "\\hfuzz=15pt"
359 puts $texfile "\\hbadness=750"
360 puts $texfile "\\setlength{\\emergencystretch}{15pt}"
361 puts $texfile "\\setlength{\\parindent}{0cm}";#0.75cm
362 puts $texfile "\\setlength{\\parskip}{0.2cm}"; #0.2
363 puts $texfile "\\makeatletter"
364 puts $texfile "\\renewcommand{\\paragraph}{%"
365 puts $texfile " \@startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{%"
366 puts $texfile "\\normalfont\\normalsize\\bfseries\\SS@parafont%"
369 puts $texfile "\\renewcommand{\\subparagraph}{%"
370 puts $texfile " \\@startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{%"
371 puts $texfile "\\normalfont\\normalsize\\bfseries\\SS@subparafont%"
374 puts $texfile "\\makeatother"
376 puts $texfile "% Headers & footers"
377 puts $texfile "\\usepackage{fancyhdr}"
378 puts $texfile "\\pagestyle{fancyplain}"
379 puts $texfile "\\fancyhead\[LE\]{\\fancyplain{}{\\bfseries\\thepage}}"
380 puts $texfile "\\fancyhead\[CE\]{\\fancyplain{}{}}"
381 puts $texfile "\\fancyhead\[RE\]{\\fancyplain{}{\\bfseries\\leftmark}}"
382 puts $texfile "\\fancyhead\[LO\]{\\fancyplain{}{\\bfseries\\rightmark}}"
383 puts $texfile "\\fancyhead\[CO\]{\\fancyplain{}{}}"
384 puts $texfile "\\fancyhead\[RO\]{\\fancyplain{}{\\bfseries\\thepage}}"
385 puts $texfile "\\fancyfoot\[LE\]{\\fancyplain{}{}}"
386 puts $texfile "\\fancyfoot\[CE\]{\\fancyplain{}{}}"
387 puts $texfile "\\fancyfoot\[RE\]{\\fancyplain{}{\\bfseries\\scriptsize (c) Open CASCADE 2001\-2013}}"
388 puts $texfile "\\fancyfoot\[LO\]{\\fancyplain{}{\\bfseries\\scriptsize (c) Open CASCADE 2001\-2013}}"
389 puts $texfile "\\fancyfoot\[CO\]{\\fancyplain{}{}}"
390 puts $texfile "\\fancyfoot\[RO\]{\\fancyplain{}{}}"
391 puts $texfile "\\renewcommand{\\footrulewidth}{0.4pt}"
392 puts $texfile "\\renewcommand{\\sectionmark}\[1\]{%"
393 puts $texfile " \\markright{\\thesection\\ #1}%"
396 puts $texfile "% Indices & bibliography"
397 puts $texfile "\\usepackage{natbib}"
398 puts $texfile "\\usepackage\[titles\]{tocloft}"
399 puts $texfile "\\renewcommand{\\cftsecleader}{\\cftdotfill{\\cftdotsep}}"
400 puts $texfile "\\setcounter{tocdepth}{3}"
401 puts $texfile "\\setcounter{secnumdepth}{5}"
402 puts $texfile "\\makeindex"
404 puts $texfile "% Hyperlinks (required, but should be loaded last)"
405 puts $texfile "\\usepackage{ifpdf}"
406 puts $texfile "\\ifpdf"
407 puts $texfile " \\usepackage\[pdftex,pagebackref=true\]{hyperref}"
408 puts $texfile "\\else"
409 puts $texfile " \\usepackage\[ps2pdf,pagebackref=true\]{hyperref}"
411 puts $texfile "\\hypersetup{%"
412 puts $texfile " colorlinks=true,%"
413 puts $texfile " linkcolor=black,%"
414 puts $texfile " citecolor=black,%"
415 puts $texfile " urlcolor=blue,%"
416 puts $texfile " unicode%"
419 puts $texfile "% Custom commands"
420 puts $texfile "\\newcommand{\\clearemptydoublepage}{%"
421 puts $texfile " \\newpage{\\pagestyle{empty}\\cleardoublepage}%"
424 puts $texfile "%===== C O N T E N T S =====\n"
425 puts $texfile "\\begin{document}"
427 puts $texfile "% Titlepage & ToC"
428 puts $texfile "\\hypersetup{pageanchor=false}"
429 puts $texfile "\\pagenumbering{roman}"
430 puts $texfile "\\begin{titlepage}"
431 puts $texfile "\\vspace*{7cm}"
432 puts $texfile "\\begin{center}%"
433 puts $texfile "\\includegraphics\[width=0.75\\textwidth, height=0.2\\textheight\]{../../../dox/resources/occt_logo.png}\\\\"; #\\\\\\\\
434 puts $texfile "{\\Large Open C\\-A\\-S\\-C\\-A\\-D\\-E Technology \\\\\[1ex\]\\Large [OverviewDoc_DetectCasVersion $latexDir/../../../] }\\\\"
435 puts $texfile "\\vspace*{1cm}"
436 puts $texfile "{\\Large $docLabel}\\\\"
437 puts $texfile "\\vspace*{1cm}"
438 # puts $texfile "{\\large Generated by Doxygen 1.8.4}\\\\"
439 puts $texfile "\\vspace*{0.5cm}"
440 puts $texfile "{\\small \\today}\\"
441 puts $texfile "\\end{center}"
442 puts $texfile "\\end{titlepage}"
443 puts $texfile "\\clearpage"
444 puts $texfile "\\pagenumbering{roman}"
445 puts $texfile "\\tableofcontents"
446 puts $texfile "\\newpage"
447 puts $texfile "\\pagenumbering{arabic}"
448 puts $texfile "\\hypersetup{pageanchor=true}"
450 puts $texfile "\\let\\stdsection\\section"
451 puts $texfile " \\renewcommand\\section{\\pagebreak\\stdsection}"
452 puts $texfile "\\hypertarget{$fileName}{}"
453 puts $texfile "\\input{$fileName}"
455 puts $texfile "% Index"
456 puts $texfile "\\newpage"
457 puts $texfile "\\phantomsection"
458 puts $texfile "\\addcontentsline{toc}{part}{Index}"
459 puts $texfile "\\printindex\n"
460 puts $texfile "\\end{document}"
465 # Postprocesses generated TeX files
466 proc OverviewDoc_ProcessTex {{texFiles {}} {latexDir} verboseMode} {
468 foreach TEX $texFiles {
469 if {$verboseMode == "YES"} {
470 puts "INFO: Preprocessing file $TEX"
473 if {![file exists $TEX]} {
474 puts "file $TEX doesn't exist"
478 set IN_F [open "$TEX" r]
479 set TMPFILENAME "$latexDir/temp.tex"
481 set OUT_F [open $TMPFILENAME w]
484 set line [gets $IN_F]
485 if { [string first "\\includegraphics" $line] != -1 } {
486 # Center images in TeX files
487 set line "\\begin{center}\n $line\n\\end{center}"
488 } elseif { [string first "\\subsection" $line] != -1 } {
489 # Replace \subsection with \section tag
490 regsub -all "\\\\subsection" $line "\\\\section" line
491 } elseif { [string first "\\subsubsection" $line] != -1 } {
492 # Replace \subsubsection with \subsection tag
493 regsub -all "\\\\subsubsection" $line "\\\\subsection" line
494 } elseif { [string first "\\paragraph" $line] != -1 } {
495 # Replace \paragraph with \subsubsection tag
496 regsub -all "\\\\paragraph" $line "\\\\subsubsection" line
506 file delete -force $TEX
507 file rename $TMPFILENAME $TEX
511 # Main procedure for documents compilation
512 proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchMode hhcPath} {
514 set INDIR [file normalize [file dirname [info script]]]
515 set CASROOT [file normalize [file dirname "$INDIR/../../"]]
516 set OUTDIR $CASROOT/doc
517 set PDFDIR $OUTDIR/overview/pdf
518 set HTMLDIR $OUTDIR/overview/html
519 set LATEXDIR $OUTDIR/overview/latex
520 set TAGFILEDIR $OUTDIR/refman
521 set DOXYFILE $OUTDIR/OCCT.cfg
523 # Create or clean the output folders
524 if {[file exists $OUTDIR] == 0} {
527 if {[file exists $HTMLDIR] == 0} {
530 if {[file exists $PDFDIR] == 0} {
534 if {[file exists $LATEXDIR]} {
535 #file delete {*}[glob -nocomplain $LATEXDIR/*.*]
536 file delete -force $LATEXDIR
540 # Run tools to compile documents
541 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating Doxyfile..."
543 OverviewDoc_MakeDoxyfile $CASROOT "$OUTDIR/overview" $TAGFILEDIR $DOXYFILE $generatorMode $docfiles $verboseMode $searchMode $hhcPath
546 if { $generatorMode == "HTML_ONLY"} {
547 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating HTML files..."
548 } elseif { $generatorMode == "CHM_ONLY" } {
549 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating CHM file..."
551 set RESULT [catch {exec doxygen $DOXYFILE > $OUTDIR/doxygen_out.log} DOX_ERROR]
553 if {[llength [split $DOX_ERROR "\n"]] > 1} {
554 if {$verboseMode == "YES"} {
555 puts "See Doxygen log in $OUTDIR/doxygen_warnings_and_errors.log"
557 set DOX_ERROR_FILE [open "$OUTDIR/doxygen_warnings_and_errors.log" "w"]
558 puts $DOX_ERROR_FILE $DOX_ERROR
559 close $DOX_ERROR_FILE
564 # Close the Doxygen application
567 # Start PDF generation routine
568 if { $generatorMode == "PDF_ONLY" } {
569 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating PDF files..."
571 set OS $::tcl_platform(platform)
572 if { $OS == "unix" } {
574 } elseif { $OS == "windows" } {
578 # Prepare a list of TeX files, generated by Doxygen
581 set TEXFILES [glob $LATEXDIR -type f -directory $LATEXDIR -tails "*.tex" ]
582 set REFMAN_IDX [lsearch $TEXFILES "refman.tex"]
583 set TEXFILES [lreplace $TEXFILES $REFMAN_IDX $REFMAN_IDX]
586 set IDX [lsearch $TEXFILES "$LATEXDIR"]
587 while { $IDX != -1} {
588 set TEXFILES [lreplace $TEXFILES $IDX $IDX]
589 set IDX [lsearch $TEXFILES "$LATEXDIR"]
592 if {$verboseMode == "YES"} {
593 puts "Preprocessing generated TeX files..."
595 OverviewDoc_ProcessTex $TEXFILES $LATEXDIR $verboseMode
597 if {$verboseMode == "YES"} {
598 puts "Generating PDF files from TeX files..."
600 foreach TEX $TEXFILES {
601 # Rewrite existing REFMAN.tex file...
602 set TEX [string range $TEX 0 [ expr "[string length $TEX] - 5"]]
603 OverviewDoc_MakeRefmanTex $TEX $LATEXDIR $docLabel $verboseMode
605 if {$verboseMode == "YES"} {
606 puts "INFO: Generating PDF file from $TEX"
607 # ...and use it to generate PDF from TeX...
608 puts "Executing $LATEXDIR/make$PREFIX..."
610 set RESULT [catch {eval exec [auto_execok $LATEXDIR/make$PREFIX] > "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR]
612 if {[llength [split $LaTeX_ERROR "\n"]] > 1} {
613 if {$verboseMode == "YES"} {
614 puts "See Latex log in $OUTDIR/pdflatex_warnings_and_errors.log"
616 set LaTeX_ERROR_FILE [open "$OUTDIR/pdflatex_warnings_and_errors.log" "w"]
617 puts $LaTeX_ERROR_FILE $LaTeX_ERROR
618 close $LaTeX_ERROR_FILE
624 # ...and place it to the specific folder
625 if { [file exists $PDFDIR/$TEX.pdf] == 1 } {
626 file delete -force $PDFDIR/$TEX.pdf
629 if {![file exists "$LATEXDIR/refman.pdf"]} {
630 puts "Error: file $LATEXDIR/refman.pdf does not exist"
634 file rename $LATEXDIR/refman.pdf "$PDFDIR/$TEX.pdf"
639 puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed"
640 if { $generatorMode == "HTML_ONLY" } {
641 puts "View generated HTML documentation by opening: "
642 set RESFILE $OUTDIR/overview/html/index.html
645 if { $generatorMode == "PDF_ONLY" } {
646 puts "PDF files are generated in: "
647 puts "$OUTDIR/overview/pdf folder"
651 # A command for User Documentation compilation
654 set GEN_MODE "HTML_ONLY"
657 set DOCLABEL "Default OCCT Document"
659 set SEARCH_MODE "none"
662 global available_docfiles
668 # Load list of docfiles
669 if { [OverviewDoc_LoadFilesList] != 0 } {
670 puts "ERROR: File FILES.txt was not found"
675 if {[OverviewDoc_ParseArguments $args] == 1} {
679 foreach arg_n $args_names {
681 OverviewDoc_PrintHelpMessage
683 } elseif {$arg_n == "html"} {
684 set GEN_MODE "HTML_ONLY"
685 } elseif {$arg_n == "chm"} {
686 set GEN_MODE "CHM_ONLY"
688 if {"$tcl_platform(platform)" == "windows" && [lsearch $args_names hhc] == -1} {
689 if { [info exist env(ProgramFiles\(x86\))] } {
690 set hhcPath "$env(ProgramFiles\(x86\))\\HTML Help Workshop\\hhc.exe"
691 puts "Info: hhc found: $hhcPath"
692 } elseif { [info exist env(ProgramFiles)] } {
693 set hhcPath "$env(ProgramFiles)\\HTML Help Workshop\\hhc.exe"
694 puts "Info: hhc found: $hhcPath"
697 if { ! [file exists $hhcPath] } {
698 puts "Error: HTML Help Compiler is not found in standard location [file dirname $hhcPath]; use option -hhc"
703 } elseif {$arg_n == "hhc"} {
705 if { $tcl_platform(platform) != "windows" } {
709 if {$args_values(hhc) != "NULL"} {
710 set hhcPath $args_values(hhc)
711 if { [file isdirectory $hhcPath] } {
712 set hhcPath [file join ${hhcPath} hhc.exe]
714 if { ! [file exists $hhcPath] } {
715 puts "Error: HTML Help Compiler is not found in $hhcPath"
719 puts "Error in argument hhc"
723 } elseif {$arg_n == "pdf"} {
724 set GEN_MODE "PDF_ONLY"
725 } elseif {$arg_n == "v"} {
727 } elseif {$arg_n == "m"} {
728 if {$args_values(m) != "NULL"} {
729 set DOCFILES $args_values(m)
731 puts "Error in argument m"
735 # Check if all chosen docfiles are correct
736 foreach docfile $DOCFILES {
737 if { [lsearch $available_docfiles $docfile] == -1 } {
738 puts "File \"$docfile\" is not presented in the list of available docfiles"
739 puts "Please, specify the correct docfile name"
742 puts "File $docfile is presented in FILES.TXT"
745 } elseif {$arg_n == "l"} {
746 if { [llength $DOCFILES] <= 1 } {
747 if {$args_values(l) != "NULL"} {
748 set DOCLABEL $args_values(l)
750 puts "Error in argument l"
754 } elseif {$arg_n == "s"} {
755 if {$args_values(s) != "NULL"} {
756 set SEARCH_MODE $args_values(s)
758 puts "Error in argument s"
762 puts "\nWrong argument: $arg_n"
763 OverviewDoc_PrintHelpMessage
768 # Specify verbose mode
769 if { $GEN_MODE != "PDF_ONLY" && [llength $DOCFILES] > 1 } {
773 # If we don't specify list for docfiles with -m argument,
774 # we assume that we have to generate all docfiles
775 if { [llength $DOCFILES] == 0 } {
776 set DOCFILES $available_docfiles
779 # Start main activities
780 OverviewDoc_Main $DOCFILES $GEN_MODE $DOCLABEL $VERB_MODE $SEARCH_MODE $hhcPath