From the Tcl manual:
info loaded ?interp?
Returns a list describing all of the packages that have been loaded into interp with the load command. Each list element is a sub-list with two elements consisting of the name of the file from which the package was loaded and the name of the package...
Seems to me that you did some mistake with the switch syntax.
The switch command can use two syntaxes.
The error message said that you used the first.
Here is a correct use of this syntax:
switch -glob -- $mode \
{
start { return ""; # a comment }
run
{
# a comment...
If you mean the original string, the answer is no.
But if you only want the original arguments of the command,
you have access to some global variables:
argc
The number of arguments to tclsh or wish.
argv
Tcl list of arguments to tclsh or wish.
argv0
The script that tclsh or wish started...
If you want objects, may this is more simpler for you:
array set ::objects {}
# create a node
set departement R&D
set node $department.//Alice
set ::objects($node.address) $ip
# add user
lappend ::objects($node.users) $user1
# add application
lappend ::objects($node.appli)...
Is this what you need?
set hexIP 80010101
set a1 [string range $hexIP 0 1]
set a2 [string range $hexIP 2 3]
set decMask [expr 0x$a1].[expr 0x$a2].255.255
puts $decMask
128.1.255.255
HTH
ulis
Not sure to understand:
However, is there no way to nest or recursively decompose variable expansion based on brase or parenthetical grouping and order?
Maybe this can help you?
set cname ::x::y::z::name
set spaces [lrange [split [string map {:: \0} $cname] \0] 1 end-1]
puts $spaces
x...
I think that you need that:
foreach x [namespace children ::xComputer] { puts [set ::xComputer::$x::HomeLAN] }
It seems that Tcl is not able to substituate inside the namespace part of a qualified name.
A last word:
set a
returns the value of the variable a (if a is defined)
More on...
You example is perfect but
$ns at $now getbool
is an extension that I never seen.
Boolean values are 0 and 1 (0: false, 1: true)
To set a boolean value in a procedure:
proc setBoolean {myArg} \
{
...
set boolean 1
return $boolean
}
To wait for a random delay:
set...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.