]> OCCT Git - occt-wok.git/commitdiff
OCC22124 Necessety to obtain current version of OCCT in different automatic scripts
authorinv <inv@opencascade.com>
Fri, 10 Dec 2010 12:40:44 +0000 (12:40 +0000)
committerinv <inv@opencascade.com>
Fri, 10 Dec 2010 12:40:44 +0000 (12:40 +0000)
src/WOKTclLib/FILES
src/WOKTclLib/OCCTDocumentation.tcl
src/WOKTclLib/OCCTGetVersion.tcl [new file with mode: 0755]

index f0cbb9368bf0ec862bfa5e259111a7c225e0c60a..3413b2760ae01ecb950438a072bd5ec251c21efe 100755 (executable)
@@ -169,3 +169,4 @@ srcinc:::woksh.el
 srcinc:::wok-comm.el
 srcinc:::OCCTDocumentation.tcl
 srcinc:::OS.tcl
+srcinc:::OCCTGetVersion.tcl
index bec122cd0cbd20b7f70c75343743b10cba4ab6b0..d6b2326c840691ebb29b70d18da008f88ad1baee 100755 (executable)
@@ -50,29 +50,7 @@ proc OCCDoc_MakeDoxyfile {outDir {modules {}} {graphvizPath {}} {useSearch YES}
     set filelist $hdrlist
 
     # get OCCT version number
-    set occt_version ""
-    set verfile [woklocate -p "Standard:source:Standard_Version.hxx"]
-    if { "$verfile" != "" && [file readable $verfile] } {
-       set vfd [open $verfile "r"]
-       set vmajor ""
-       set vminor ""
-       set vpatch ""
-       set vbuild ""
-       while { [gets $vfd line] >= 0 } {
-           if { [regexp {^[ \t]*\#define[ \t]*OCC_VERSION_MAJOR[ \t]*([0-9]+)} $line str num] } {
-               set vmajor $num
-           } elseif { [regexp {^[ \t]*\#define[ \t]*OCC_VERSION_MINOR[ \t]*([0-9]+)} $line str num] } {
-               set vminor $num
-           } elseif { [regexp {^[ \t]*\#define[ \t]*OCC_VERSION_MAINTENANCE[ \t]*([0-9]+)} $line str num] ||
-                        [regexp {^[ \t]*\#define[ \t]*OCC_VERSION_PATCH[ \t]*([0-9]+)} $line str num] } {
-               set vpatch $num
-           } elseif { [regexp {^[ \t]*\#define[ \t]*OCC_VERSION_BUILD[ \t]*([0-9]+)} $line str num] } {
-               set vbuild .$num
-           }
-       }
-       close $vfd
-        set occt_version $vmajor.$vminor.$vpatch$vbuild
-    }
+    set occt_version [OCCTGetVersion]
 
     set filename "$outDir/$name.Doxyfile"
     msgprint -i -c "WOKStep_DocGenerate:Execute" "Generating Doxygen file for $title in $filename"
diff --git a/src/WOKTclLib/OCCTGetVersion.tcl b/src/WOKTclLib/OCCTGetVersion.tcl
new file mode 100755 (executable)
index 0000000..ededb46
--- /dev/null
@@ -0,0 +1,30 @@
+# Get current OCCT version
+proc OCCTGetVersion {} {
+    set OCCTVersion ""
+    set OCCTVersionFile [woklocate -p "Standard:source:Standard_Version.hxx"]
+    if {$OCCTVersionFile != "" && [file readable $OCCTVersionFile]} {
+       set v_major ""
+       set v_minor ""
+       set v_patch ""
+       set v_build ""
+       set vfd [open $OCCTVersionFile {RDONLY}]
+       while {[gets $vfd line] >= 0} {
+           if {[regexp {^[ \t]*\#define[ \t]*OCC_VERSION_MAJOR[ \t]*([0-9]+)} $line str num]} {
+               set v_major $num
+           } elseif {[regexp {^[ \t]*\#define[ \t]*OCC_VERSION_MINOR[ \t]*([0-9]+)} $line str num]} {
+               set v_minor $num
+           } elseif {[regexp {^[ \t]*\#define[ \t]*OCC_VERSION_MAINTENANCE[ \t]*([0-9]+)} $line str num]} {
+               set v_patch $num
+           } elseif {[regexp {^[ \t]*\#define[ \t]*OCC_VERSION_BUILD[ \t]*([0-9]+)} $line str num]} {
+               set v_build $num
+           }
+       }
+       close $vfd
+       if {$v_build != 0 && $v_build != ""} {
+           set OCCTVersion $v_major.$v_minor.$v_patch.$v_build
+       } else {
+           set OCCTVersion $v_major.$v_minor.$v_patch
+       }
+    }
+    return $OCCTVersion
+}