本文整理汇总了C#中tcl.lang.Interp.getObjCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Interp.getObjCommand方法的具体用法?C# Interp.getObjCommand怎么用?C# Interp.getObjCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcl.lang.Interp
的用法示例。
在下文中一共展示了Interp.getObjCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: evalObjv
public static void evalObjv( Interp interp, TclObject[] objv, int length, int flags )
{
Command cmd;
WrappedCommand wCmd = null;
TclObject[] newObjv;
int i;
CallFrame savedVarFrame; //Saves old copy of interp.varFrame
// in case TCL.EVAL_GLOBAL was set.
interp.resetResult();
if ( objv.Length == 0 )
{
return;
}
// If the interpreter was deleted, return an error.
if ( interp.deleted )
{
interp.setResult( "attempt to call eval in deleted interpreter" );
interp.setErrorCode( TclString.newInstance( "CORE IDELETE {attempt to call eval in deleted interpreter}" ) );
throw new TclException( TCL.CompletionCode.ERROR );
}
// Check depth of nested calls to eval: if this gets too large,
// it's probably because of an infinite loop somewhere.
if ( interp.nestLevel >= interp.maxNestingDepth )
{
throw new TclException( interp, "too many nested calls to eval (infinite loop?)" );
}
interp.nestLevel++;
try
{
// Find the procedure to execute this command. If there isn't one,
// then see if there is a command "unknown". If so, create a new
// word array with "unknown" as the first word and the original
// command words as arguments. Then call ourselves recursively
// to execute it.
cmd = interp.getCommand( objv[0].ToString() );
if ( cmd == null )
wCmd = interp.getObjCommand( objv[0].ToString() );
// See if we are running as a slave interpretor, and this is a windows command
if ( cmd == null && wCmd == null && interp.slave != null )
{
wCmd = interp.slave.masterInterp.getObjCommand( objv[0].ToString() );
}
if ( cmd == null && wCmd == null )
{
newObjv = new TclObject[objv.Length + 1];
for ( i = ( objv.Length - 1 ); i >= 0; i-- )
{
newObjv[i + 1] = objv[i];
}
newObjv[0] = TclString.newInstance( "unknown" );
newObjv[0].preserve();
cmd = interp.getCommand( "unknown" );
if ( cmd == null )
{
Debug.Assert( false, "invalid command name \"" + objv[0].ToString() + "\"" );
throw new TclException( interp, "invalid command name \"" + objv[0].ToString() + "\"" );
}
else
{
evalObjv( interp, newObjv, length, 0 );
}
newObjv[0].release();
return;
}
// Finally, invoke the Command's cmdProc.
interp.cmdCount++;
savedVarFrame = interp.varFrame;
if ( ( flags & TCL.EVAL_GLOBAL ) != 0 )
{
interp.varFrame = null;
}
int rc = 0;
if ( cmd != null )
{
if ( cmd.cmdProc( interp, objv ) == TCL.CompletionCode.EXIT )
throw new TclException( TCL.CompletionCode.EXIT );
}
else
{
rc = wCmd.objProc( wCmd.objClientData, interp, objv.Length, objv );
if ( rc != 0 )
{
if ( rc == TCL.TCL_RETURN )
throw new TclException( TCL.CompletionCode.RETURN );
throw new TclException( TCL.CompletionCode.ERROR );
}
}
interp.varFrame = savedVarFrame;
//.........这里部分代码省略.........