本文整理汇总了C#中tcl.lang.TclObject.preserve方法的典型用法代码示例。如果您正苦于以下问题:C# TclObject.preserve方法的具体用法?C# TclObject.preserve怎么用?C# TclObject.preserve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcl.lang.TclObject
的用法示例。
在下文中一共展示了TclObject.preserve方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BgErrorMgr
internal BgErrorMgr( Interp i )
{
InitBlock();
interp = i;
bgerrorCmdObj = TclString.newInstance( "bgerror" );
bgerrorCmdObj.preserve();
errors = new ArrayList( 10 );
}
示例2: append
/// <summary> Tcl_ListObjAppendElement -> TclList.append()
///
/// Appends a TclObject element to a list object.
///
/// </summary>
/// <param name="interp">current interpreter.
/// </param>
/// <param name="tobj">the TclObject to append an element to.
/// </param>
/// <param name="elemObj">the element to append to the object.
/// </param>
/// <exception cref=""> TclException if tobj cannot be converted into a list.
/// </exception>
public static void append( Interp interp, TclObject tobj, TclObject elemObj )
{
if ( tobj.Shared )
{
throw new TclRuntimeError( "TclList.append() called with shared object" );
}
setListFromAny( interp, tobj );
tobj.invalidateStringRep();
TclList tlist = (TclList)tobj.InternalRep;
if ( !String.IsNullOrEmpty( elemObj.stringRep ) && elemObj.stringRep[0] == '{' ) elemObj = TclString.newInstance( elemObj.stringRep.Substring( 1, elemObj.stringRep.Length - 2 ) );
elemObj.preserve();
tlist.vector.Add( elemObj );
}
示例3: 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 );
}
示例4: resetResult
public void resetResult()
{
if ( m_result != m_nullResult )
{
m_result.release();
m_result = TclString.newInstance( "" ); //m_nullResult;
m_result.preserve();
if ( !m_nullResult.Shared )
{
throw new TclRuntimeError( "m_nullResult is not shared" );
}
}
errAlreadyLogged = false;
errInProgress = false;
errCodeSet = false;
returnCode = TCL.CompletionCode.OK;
}
示例5: Interp
public Interp()
{
InitBlock();
//freeProc = null;
errorLine = 0;
// An empty result is used pretty often. We will use a shared
// TclObject instance to represent the empty result so that we
// don't need to create a new TclObject instance every time the
// interpreter result is set to empty.
m_nullResult = TclString.newInstance( "" );
m_nullResult.preserve(); // Increment refCount to 1
m_nullResult.preserve(); // Increment refCount to 2 (shared)
m_result = TclString.newInstance( "" ); //m_nullResult; // correcponds to iPtr->objResultPtr
m_result.preserve();
expr = new Expression();
nestLevel = 0;
maxNestingDepth = 1000;
frame = null;
varFrame = null;
returnCode = TCL.CompletionCode.OK;
errorInfo = null;
errorCode = null;
packageTable = new Hashtable();
packageUnknown = null;
cmdCount = 0;
termOffset = 0;
resolvers = null;
evalFlags = 0;
scriptFile = null;
flags = 0;
isSafe = false;
assocData = null;
globalNs = null; // force creation of global ns below
globalNs = NamespaceCmd.createNamespace( this, null, null );
if ( globalNs == null )
{
throw new TclRuntimeError( "Interp(): can't create global namespace" );
}
// Init things that are specific to the Jacl implementation
workingDir = new FileInfo( System.Environment.CurrentDirectory );
noEval = 0;
notifier = Notifier.getNotifierForThread( System.Threading.Thread.CurrentThread );
notifier.preserve();
randSeedInit = false;
deleted = false;
errInProgress = false;
errAlreadyLogged = false;
errCodeSet = false;
dbg = initDebugInfo();
slaveTable = new Hashtable();
targetTable = new Hashtable();
aliasTable = new Hashtable();
// init parser variables
Parser.init( this );
TclParse.init( this );
// Initialize the Global (static) channel table and the local
// interp channel table.
interpChanTable = TclIO.getInterpChanTable( this );
// Sets up the variable trace for tcl_precision.
Util.setupPrecisionTrace( this );
// Create the built-in commands.
createCommands();
try
{
// Set up tcl_platform, tcl_version, tcl_library and other
// global variables.
setVar( "tcl_platform", "platform", "windows", TCL.VarFlag.GLOBAL_ONLY );
setVar( "tcl_platform", "byteOrder", "bigEndian", TCL.VarFlag.GLOBAL_ONLY );
setVar( "tcl_platform", "os", Environment.OSVersion.Platform.ToString(), TCL.VarFlag.GLOBAL_ONLY );
setVar( "tcl_platform", "osVersion", Environment.OSVersion.Version.ToString(), TCL.VarFlag.GLOBAL_ONLY );
setVar( "tcl_platform", "machine", Util.tryGetSystemProperty( "os.arch", "?" ), TCL.VarFlag.GLOBAL_ONLY );
setVar( "tcl_version", TCL_VERSION, TCL.VarFlag.GLOBAL_ONLY );
//.........这里部分代码省略.........
示例6: setResult
public void setResult( TclObject r )
// A Tcl Object to be set as the result.
{
if ( r == null )
{
throw new System.NullReferenceException( "Interp.setResult() called with null TclObject argument." );
}
if ( r == m_result )
{
// Setting to current value (including m_nullResult) is a no-op.
return;
}
if ( m_result != m_nullResult )
{
m_result.release();
}
m_result = r;
if ( m_result != m_nullResult )
{
m_result.preserve();
}
}
示例7: append
/// <summary> Tcl_ListObjAppendElement -> TclList.append()
///
/// Appends a TclObject element to a list object.
///
/// </summary>
/// <param name="interp">current interpreter.
/// </param>
/// <param name="tobj">the TclObject to append an element to.
/// </param>
/// <param name="elemObj">the element to append to the object.
/// </param>
/// <exception cref=""> TclException if tobj cannot be converted into a list.
/// </exception>
public static void append( Interp interp, TclObject tobj, TclObject elemObj )
{
if ( tobj.Shared )
{
throw new TclRuntimeError( "TclList.append() called with shared object" );
}
setListFromAny( interp, tobj );
tobj.invalidateStringRep();
TclList tlist = (TclList)tobj.InternalRep;
elemObj.preserve();
tlist.vector.Add( elemObj );
}
示例8: ParseResult
internal ParseResult( StringBuilder sbuf, int ni )
{
value = TclString.newInstance( sbuf.ToString() );
value.preserve();
nextIndex = ni;
}