Move pathname and basename utility functions to extra_utility
This makes them generally available to SICS (and it's early)
This commit is contained in:
@@ -35,26 +35,6 @@ namespace eval ::scobj::[set vendor]_[set device] {
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc basename {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return $node
|
||||
} else {
|
||||
incr point
|
||||
return "[string range $node $point end]"
|
||||
}
|
||||
}
|
||||
proc pathname {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return ""
|
||||
} else {
|
||||
incr point -1
|
||||
return "[string range $node 0 $point]"
|
||||
}
|
||||
return "[join [lrange [split $node '/'] 0 end-1] '/']"
|
||||
}
|
||||
|
||||
proc ns {} {
|
||||
return "[namespace current]"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user