Re: Tcl C extn - Scoping in extended cmds - how to?
- From: David Gravereaux <davygrvy@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 08:54:10 -0700
arijit79@xxxxxxxxx wrote:
...
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
}
As no one has answered your technical request yet, here is my 2 cents.
Here's my guess at proc semantics stolen from old code of mine. No warranty
given.. no compilers used to test this:
#include "tclInt.h"
Tcl_ObjCmdProc FieldObjCmd;
int
FieldObjCmd (xxx)
{
# check for objc count
# do what you need with the first arg, i'm not sure.
{
Tcl_Namespace *nsPtr = Tcl_FindNamespace(interp, "::", 0L, 0);
CallFrame frame;
Proc proc;
Tcl_PushCallFrame(interp, (Tcl_CallFrame *)&frame, nsPtr, 1);
proc.numCompiledLocals = 0;
proc.firstLocalPtr = 0;
proc.lastLocalPtr = 0;
frame.procPtr = &proc;
result = Tcl_EvalObj(interp, objv[2]);
Tcl_PopCallFrame(interp);
if (result == TCL_ERROR) {....}
}
}
{
...
Tcl_CreateObjCommand(interp, "field", FieldObjCmd, NULL, NULL);
...
}
--
"All this modern technology just makes people try to do everything at once."
-Hobbes
Attachment:
signature.asc
Description: OpenPGP digital signature
- References:
- Tcl C extn - Scoping in extended cmds - how to?
- From: arijit79
- Tcl C extn - Scoping in extended cmds - how to?
- Prev by Date: Re: top level windows query
- Next by Date: Re: Expect _AND_ Tcl intro/tutorial needed
- Previous by thread: Re: Tcl C extn - Scoping in extended cmds - how to?
- Next by thread: top level windows query
- Index(es):
Relevant Pages
|