本文整理汇总了C#中tcl.lang.Interp.preventAliasLoop方法的典型用法代码示例。如果您正苦于以下问题:C# Interp.preventAliasLoop方法的具体用法?C# Interp.preventAliasLoop怎么用?C# Interp.preventAliasLoop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcl.lang.Interp
的用法示例。
在下文中一共展示了Interp.preventAliasLoop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: create
internal static void create( Interp interp, Interp slaveInterp, Interp masterInterp, TclObject name, TclObject targetName, int objIx, TclObject[] objv )
{
string inString = name.ToString();
InterpAliasCmd alias = new InterpAliasCmd();
alias.name = name;
name.preserve();
alias.slaveInterp = slaveInterp;
alias.targetInterp = masterInterp;
alias.prefix = TclList.newInstance();
alias.prefix.preserve();
TclList.append( interp, alias.prefix, targetName );
TclList.insert( interp, alias.prefix, 1, objv, objIx, objv.Length - 1 );
slaveInterp.createCommand( inString, alias );
alias.slaveCmd = NamespaceCmd.findCommand( slaveInterp, inString, null, 0 );
try
{
interp.preventAliasLoop( slaveInterp, alias.slaveCmd );
}
catch ( TclException e )
{
// Found an alias loop! The last call to Tcl_CreateObjCommand made
// the alias point to itself. Delete the command and its alias
// record. Be careful to wipe out its client data first, so the
// command doesn't try to delete itself.
slaveInterp.deleteCommandFromToken( alias.slaveCmd );
throw;
}
// Make an entry in the alias table. If it already exists delete
// the alias command. Then retry.
if ( slaveInterp.aliasTable.ContainsKey( inString ) )
{
InterpAliasCmd oldAlias = (InterpAliasCmd)slaveInterp.aliasTable[inString];
slaveInterp.deleteCommandFromToken( oldAlias.slaveCmd );
}
alias.aliasEntry = inString;
SupportClass.PutElement( slaveInterp.aliasTable, inString, alias );
// Create the new command. We must do it after deleting any old command,
// because the alias may be pointing at a renamed alias, as in:
//
// interp alias {} foo {} bar # Create an alias "foo"
// rename foo zop # Now rename the alias
// interp alias {} foo {} zop # Now recreate "foo"...
SupportClass.PutElement( masterInterp.targetTable, alias.slaveCmd, slaveInterp );
interp.setResult( name );
}