Tcl C extn - Scoping in extended cmds - how to?
- From: arijit79@xxxxxxxxx
- Date: Thu, 28 Jun 2007 01:56:07 -0700
Hi,
I am using Tcl C extension to create extended commands like this:
set var 1
block b {
register r {
field f {
bits 8
}
}
}
Where "block", "register", "field", "bits", etc are my extended
commands.
Now, when I do command extensions like this using
"Tcl_CreateCommand(interp, ...)", the scope actually remains the same
i.e. inside the "field" in the above example, I am actually able to
access $var. In other words, the following becomes possible.
set var 1
field f {
echo $var //This works fine...In Tcl proc scoping semantics,
it is not allowed unless upvar or global is used.
bits 8
}
But I actually want my commands to have Tcl proc semantics as far as
scoping is concerned, so that the above code becomes invalid and the
following (pure Tcl way) should only be allowed.
set var 1
field f {
upvar $var local_var
echo $local_var
bits 8
}
So, I just wanted to know if there is some way by which I can
configure my extended Tcl commands to follow the "proc" semantics as
far as scoping is concerned.
Thanks for your time and willingness to help,
Arijit
.
- Follow-Ups:
- Re: Tcl C extn - Scoping in extended cmds - how to?
- From: David Gravereaux
- Re: Tcl C extn - Scoping in extended cmds - how to?
- From: MartinLemburg@UGS
- Re: Tcl C extn - Scoping in extended cmds - how to?
- From: Jonathan Bromley
- Re: Tcl C extn - Scoping in extended cmds - how to?
- Prev by Date: Re: Daily Build
- Next by Date: Re: Tcl C extn - Scoping in extended cmds - how to?
- Previous by thread: Daily Build
- Next by thread: Re: Tcl C extn - Scoping in extended cmds - how to?
- Index(es):
Relevant Pages
|