##// 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_F13.tcl
73 lines | 3.0 KiB | application/x-tcl | TclLexer
#!/usr/bin/tclsh
# namespace names should be recalled at the end of the namespace
# namespace mynamespace {
# } // mynamespace
proc createNamespaceDict {} {
return [dict create state "waitingForIdentifier" identifier "" bracesCounter 0]
}
foreach fileName [getSourceFileNames] {
set namespaces [list]
foreach token [getTokens $fileName 1 0 -1 -1 {namespace identifier leftbrace rightbrace semicolon cppcomment}] {
set type [lindex $token 3]
set namespacesToKeep [list]
foreach n $namespaces {
set keepNamespace 1
dict with n {
if {$state == "waitingForIdentifier" && $type == "identifier"} {
set state "waitingForLeftBrace"
set identifier [lindex $token 0]
} elseif {$state == "waitingForLeftBrace"} {
if {$type == "semicolon"} {
# Wasn't a namespace, remove the dict
set keepNamespace 0
} elseif {$type == "leftbrace"} {
set bracesCounter 0
set state "waitingForRightBrace"
}
} elseif {$state == "waitingForRightBrace"} {
if {$type == "leftbrace"} {
incr bracesCounter
} elseif {$type == "rightbrace"} {
if {$bracesCounter > 0} {
incr bracesCounter -1
} else {
set state "waitingForComment"
}
}
} elseif {$state == "waitingForComment"} {
if {$type == "cppcomment"} {
set commentValue [lindex $token 0]
# Check that the comment report the namespace name
if {![regexp "\\m$identifier\\M" $commentValue]} {
set line [lindex $token 1]
set commentValue [string trim $commentValue]
report $fileName $line "The namespace $identifier should have been recalled in the comment here (// $identifier). Comment found: $commentValue"
}
} else {
# There should have been a comment here
set line [lindex $token 1]
report $fileName $line "The namespace $identifier should have been recalled in a comment here (// $identifier)"
}
# Namespace processed, remove it from the list
set keepNamespace 0
}
}
if {$keepNamespace} {
lappend namespacesToKeep $n
}
}
set namespaces $namespacesToKeep
# If the token is a namespace keyword, add a namespace dict for the next
# foreach
if {$type == "namespace"} {
lappend namespaces [createNamespaceDict]
}
}
}