##// END OF EJS Templates
Separate the initialization of the properties of the graph of the update of the units of the graph....
Separate the initialization of the properties of the graph of the update of the units of the graph. The initialization of the properties is carried out when adding a variable in the graph, the update of the units is carried out when loading the data of this variable

File last commit:

r2:451739a45362
r1308:41b7c6aab8be
Show More
IPSIS_S01.tcl
60 lines | 2.6 KiB | application/x-tcl | TclLexer
Ajout de vera++
r2 #!/usr/bin/tclsh
# At most one class per header file
foreach fileName [getSourceFileNames] {
if {[regexp {(?:\\|/)?([^\\/]+?)\.h$} $fileName matchedExpr expectedClassName]} {
set state "waitingForClass"
set alreadyOneClass 0
set firstClassName ""
set bracesCounter 0
set lastIdentifier ""
foreach token [getTokens $fileName 1 0 -1 -1 {class identifier leftbrace rightbrace colon semicolon}] {
set type [lindex $token 3]
if {$type == "identifier"} {
set lastIdentifier [lindex $token 0]
}
if {$state == "waitingForClass" && $type == "class"} {
set state "waitingForBeginingOfClass"
} elseif {$state == "waitingForBeginingOfClass"} {
if {$type == "semicolon"} {
set state "waitingForClass"
} elseif {$type == "leftbrace" || $type == "colon"} {
# Check if this is the first class
if {$alreadyOneClass} {
set line [lindex $token 1]
report $fileName $line "At most one public class can be defined in a header file. (class $lastIdentifier found but class $firstClassName already defined)"
} else {
set alreadyOneClass 1
set firstClassName $lastIdentifier
# Check that the class has the same name than the file
if {$lastIdentifier != $expectedClassName} {
set line [lindex $token 1]
report $fileName $line "The public class should have the same name than the header file. (class $lastIdentifier found but class $expectedClassName expected)"
}
}
if {$type == "leftbrace"} {
set state "waitingForEndOfClass"
} else {
set state "waitingForLeftBrace"
}
}
} elseif {$state == "waitingForLeftBrace" && $type == "leftbrace"} {
set state "waitingForEndOfClass"
} elseif {$state == "waitingForEndOfClass"} {
if {$type == "leftbrace"} {
incr bracesCounter
} elseif {$type == "rightbrace"} {
if {$bracesCounter > 0} {
incr bracesCounter -1
} else {
set state "waitingForClass"
}
}
}
}
}
}