File: begin

package info (click to toggle)
oce 0.15-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 302,472 kB
  • ctags: 210,903
  • sloc: cpp: 1,165,052; ansic: 75,256; sh: 11,901; tcl: 4,488; python: 2,867; makefile: 337; perl: 37; csh: 12
file content (72 lines) | stat: -rwxr-xr-x 1,642 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
pload TOPTEST
pload DCAF

cpulimit 300

set ValidatorCheck 0

if { [info exists env(CSF_ValidatorPath)] != 0 } {
    if {[file exists $env(CSF_ValidatorPath)]} {
	set ValidatorCheck 1
	set Validator $env(CSF_ValidatorPath)
    }
}

if { [info exists imagedir] == 0 } {
    set imagedir .
}

if { [info exists test_image ] == 0 } {
    set test_image photo
}

set WorkDirectory $imagedir

set os "ALL"
if {[array get env os_type] != ""} {
    set os $env(os_type)
}

if { [regexp "indows" $os] } {
    if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
	set Java "java"
    } else {
	puts "Warning: environment variable PATH doesn't contain path to Java"
    }
} else {
    catch {set Java $env(JAVAHOME)/bin/java}
}

set SchemaFile    ""

proc SaveToFile { aD aFile } {
    upvar $aD D 
    global FileSuffix ValidatorCheck
    catch {[file delete ${aFile}]}
    SaveAs D $aFile
    if { [file exists $aFile] } {
	if { $FileSuffix == "xml" && $ValidatorCheck} {
	    ValidateXml $aFile
	} else {
	    puts "Validation of XML file by XSD schema is not provided."
	}
    } else {
	puts "Error : There is no ${aFile} file"
    }
    catch {[file attributes ${aFile} -permissions 0777]}
}

proc ValidateXml { aFile } {
    global Validator Java SchemaFile 
    if { ![info exists Java] } {
	puts "Error : Java is not exists"
	return
    }
    set isValidInfo ""
    set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
    set isValid [catch {set isValidInfo [eval $ValCommand]}]
    puts $isValidInfo
    if { ![regexp "the document is valid" ${isValidInfo}] } {
	puts "Error : File is not valid"
    }
}