当前位置: 首页>>代码示例>>C#>>正文


C# TclObject.preserve方法代码示例

本文整理汇总了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 );
    }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:9,代码来源:BgErrorMgr.cs

示例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 );
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:28,代码来源:TclList.cs

示例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 );
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:59,代码来源:InterpAliasCmd.cs

示例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;
 }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:17,代码来源:Interp.cs

示例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 );
//.........这里部分代码省略.........
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:101,代码来源:Interp.cs

示例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();
      }
    }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:26,代码来源:Interp.cs

示例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 );
    }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:26,代码来源:TclList.cs

示例8: ParseResult

 internal ParseResult( StringBuilder sbuf, int ni )
 {
   value = TclString.newInstance( sbuf.ToString() );
   value.preserve();
   nextIndex = ni;
 }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:6,代码来源:ParseResult.cs


注:本文中的tcl.lang.TclObject.preserve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。