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


C# TclObject.invalidateStringRep方法代码示例

本文整理汇总了C#中tcl.lang.TclObject.invalidateStringRep方法的典型用法代码示例。如果您正苦于以下问题:C# TclObject.invalidateStringRep方法的具体用法?C# TclObject.invalidateStringRep怎么用?C# TclObject.invalidateStringRep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tcl.lang.TclObject的用法示例。


在下文中一共展示了TclObject.invalidateStringRep方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: set

        // The new value for the object.
        public static void set( TclObject tobj, double d )
        {
            tobj.invalidateStringRep();
              InternalRep rep = tobj.InternalRep;

              if ( rep is TclDouble )
              {
            TclDouble tdouble = (TclDouble)rep;
            tdouble.value = d;
              }
              else
              {
            tobj.InternalRep = new TclDouble( d );
              }
        }
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:16,代码来源:TclDouble.cs

示例2: set

    /// <summary> Changes the object value of the object.
    /// 
    /// </summary>
    /// <param name="interp">current interpreter.
    /// </param>
    /// <param name="tobj">the object to operate on.
    /// @paran i the new object value.
    /// </param>
    public static void set( TclObject tobj, object o )
    {
      tobj.invalidateStringRep();
      InternalRep rep = tobj.InternalRep;
      TclObj tint;

      if ( rep is TclObj )
      {
        tint = (TclObj)rep;
        tint.value = o;
      }
      else
      {
        tobj.InternalRep = new TclObj( o );
      }
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:24,代码来源:TCLObj.cs

示例3: set

    /// <summary> Changes the long value of the object.
    /// 
    /// </summary>
    /// <param name="interp">current interpreter.
    /// </param>
    /// <param name="tobj">the object to operate on.
    /// @paran i the new long value.
    /// </param>
    public static void set( TclObject tobj, long i )
    {
      tobj.invalidateStringRep();
      InternalRep rep = tobj.InternalRep;
      TclLong tlong;

      if ( rep is TclLong )
      {
        tlong = (TclLong)rep;
        tlong.value = i;
      }
      else
      {
        tobj.InternalRep = new TclLong( i );
      }
    }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:24,代码来源:TclLong.cs

示例4: setLength

		/// <summary> 
		/// This method changes the length of the byte array for this
		/// object.  Once the caller has set the length of the array, it
		/// is acceptable to directly modify the bytes in the array up until
		/// Tcl_GetStringFromObj() has been called on this object.
		/// 
		/// Results:
		/// The new byte array of the specified length.
		/// 
		/// Side effects:
		/// Allocates enough memory for an array of bytes of the requested
		/// size.  When growing the array, the old array is copied to the
		/// new array; new bytes are undefined.  When shrinking, the
		/// old array is truncated to the specified length.
		/// </summary>
		
		public static byte[] setLength(Interp interp, TclObject tobj, int length)
		{
			if (tobj.Shared)
			{
				throw new TclRuntimeError("TclByteArray.setLength() called with shared object");
			}
			setByteArrayFromAny(interp, tobj);
			TclByteArray tbyteArray = (TclByteArray) tobj.InternalRep;
			
			if (length > tbyteArray.bytes.Length)
			{
				byte[] newBytes = new byte[length];
				Array.Copy(tbyteArray.bytes, 0, newBytes, 0, tbyteArray.used);
				tbyteArray.bytes = newBytes;
			}
			tobj.invalidateStringRep();
			tbyteArray.used = length;
			return tbyteArray.bytes;
		}
开发者ID:plainprogrammer,项目名称:csharp-sqlite,代码行数:35,代码来源:TclByteArray.cs

示例5: sort

    /// <summary> Sorts the list according to the sort mode and (optional) sort command.
    /// The resulting list will contain no duplicates, if argument unique is
    /// specifed as true.
    /// If tobj is not a list object, an attempt will be made to
    /// convert it to a list.
    /// 
    /// </summary>
    /// <param name="interp">the current interpreter.
    /// </param>
    /// <param name="tobj">the list to sort.
    /// </param>
    /// <param name="sortMode">the sorting mode.
    /// </param>
    /// <param name="sortIncreasing">true if to sort the elements in increasing order.
    /// </param>
    /// <param name="command">the command to compute the order of two elements.
    /// </param>
    /// <param name="unique">true if the result should contain no duplicates.
    /// </param>
    /// <exception cref=""> TclException if tobj is not a valid list.
    /// </exception>

    internal static void sort( Interp interp, TclObject tobj, int sortMode, int sortIndex, bool sortIncreasing, string command, bool unique )
    {
      setListFromAny( interp, tobj );
      tobj.invalidateStringRep();
      TclList tlist = (TclList)tobj.InternalRep;

      int size = tlist.vector.Count;

      if ( size <= 1 )
      {
        return;
      }

      TclObject[] objArray = new TclObject[size];
      for ( int i = 0 ; i < size ; i++ )
      {
        objArray[i] = (TclObject)tlist.vector[i];
      }

      QSort s = new QSort();
      int newsize = s.sort( interp, objArray, sortMode, sortIndex, sortIncreasing, command, unique );

      for ( int i = 0 ; i < size   ; i++ )
      {
        if ( i < newsize )
        {
          tlist.vector[i] = objArray[i];
          objArray[i] = null;
        }
        else tlist.vector.RemoveAt( newsize  );
      }
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:54,代码来源:TclList.cs

示例6: replace

    /// <summary> This procedure replaces zero or more elements of the list
    /// referenced by tobj with the objects from an TclObject array.
    /// If tobj is not a list object, an attempt will be made to
    /// convert it to a list.
    /// 
    /// </summary>
    /// <param name="interp">current interpreter.
    /// </param>
    /// <param name="tobj">the TclObject to use as a list.
    /// </param>
    /// <param name="index">the starting index of the replace operation. <=0 means
    /// the beginning of the list. >= TclList.getLength(tobj) means
    /// the end of the list.
    /// </param>
    /// <param name="count">the number of elements to delete from the list. <=0 means
    /// no elements should be deleted and the operation is equivalent to
    /// an insertion operation.
    /// </param>
    /// <param name="elements">the element(s) to insert.
    /// </param>
    /// <param name="from">insert elements starting from elements[from] (inclusive)
    /// </param>
    /// <param name="to">insert elements up to elements[to] (inclusive)
    /// </param>
    /// <exception cref=""> TclException if tobj is not a valid list.
    /// </exception>
    public static void replace( Interp interp, TclObject tobj, int index, int count, TclObject[] elements, int from, int to )
    {
      if ( tobj.Shared )
      {
        throw new TclRuntimeError( "TclList.replace() called with shared object" );
      }
      setListFromAny( interp, tobj );
      tobj.invalidateStringRep();
      TclList tlist = (TclList)tobj.InternalRep;

      int size = tlist.vector.Count;
      int i;

      if ( index >= size )
      {
        // Append to the end of the list. There is no need for deleting
        // elements.
        index = size;
      }
      else
      {
        if ( index < 0 )
        {
          index = 0;
        }
        if ( count > size - index )
        {
          count = size - index;
        }
        for ( i = 0 ; i < count ; i++ )
        {
          TclObject obj = (TclObject)tlist.vector[index];
          obj.release();
          tlist.vector.RemoveAt( index );
        }
      }
      for ( i = from ; i <= to ; i++ )
      {
        elements[i].preserve();
        tlist.vector.Insert( index++, elements[i] );
      }
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:68,代码来源:TclList.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;

      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

示例8: 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

示例9: empty

		/// <summary> This procedure clears out an existing TclObject so
		/// that it has a string representation of "".
		/// </summary>
		
		public static void  empty(TclObject tobj)
		{
			StringFromAny = tobj;
			
			TclString tstr = (TclString) tobj.InternalRep;
			if (tstr.sbuf == null)
			{
				tstr.sbuf = new System.Text.StringBuilder();
			}
			else
			{
				tstr.sbuf.Length = 0;
			}
			tobj.invalidateStringRep();
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:19,代码来源:TclString.cs

示例10: append

		/// <summary> Appends an array of characters to a TclObject Object.
		/// Tcl_AppendUnicodeToObj() in Tcl 8.0.
		/// 
		/// </summary>
		/// <param name="tobj">the TclObject to append a string to.
		/// </param>
		/// <param name="charArr">array of characters.
		/// </param>
		/// <param name="offset">index of first character to append.
		/// </param>
		/// <param name="length">number of characters to append.
		/// </param>
		public static void  append(TclObject tobj, char[] charArr, int offset, int length)
		{
			StringFromAny = tobj;
			
			TclString tstr = (TclString) tobj.InternalRep;
			if (tstr.sbuf == null)
			{
				tstr.sbuf = new System.Text.StringBuilder(tobj.ToString());
			}
			tobj.invalidateStringRep();
			tstr.sbuf.Append(charArr, offset, length);
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:24,代码来源:TclString.cs

示例11: set

    /// <summary> Changes the integer value of the object.
    /// 
    /// </summary>
    /// <param name="interp">current interpreter.
    /// </param>
    /// <param name="tobj">the object to operate on.
    /// @paran i the new integer value.
    /// </param>
    public static void set( TclObject tobj, int i )
    {
      tobj.invalidateStringRep();
      InternalRep rep = tobj.InternalRep;
      TclInteger tint;

      if ( rep is TclInteger )
      {
        tint = (TclInteger)rep;
        tint.value = i;
      }
      else
      {
        tobj.InternalRep = new TclInteger( i );
      }
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:24,代码来源:TclInteger.cs

示例12: doReadChars


//.........这里部分代码省略.........
            {
              System.Diagnostics.Debug.WriteLine( "calling readBytes " + toRead );
              copiedNow = readBytes( obj, toRead, offset );
            }
            else
            {
              System.Diagnostics.Debug.WriteLine( "calling readChars " + toRead );
              copiedNow = readChars( obj, toRead );
            }

            // If the current buffer is empty recycle it.

            buf = inQueueHead;
            System.Diagnostics.Debug.WriteLine( "after read* buf.nextRemoved is " + buf.nextRemoved );
            System.Diagnostics.Debug.WriteLine( "after read* buf.nextAdded is " + buf.nextAdded );

            if ( buf.nextRemoved == buf.nextAdded )
            {
              System.Diagnostics.Debug.WriteLine( "recycling empty buffer" );
              ChannelBuffer next;

              next = buf.next;
              recycleBuffer( buf, false );
              inQueueHead = next;
              if ( next == null )
              {
                System.Diagnostics.Debug.WriteLine( "inQueueTail set to null" );
                inQueueTail = null;
              }
              else
              {
                System.Diagnostics.Debug.WriteLine( "inQueueTail is not null" );
              }
            }
          }
          if ( copiedNow < 0 )
          {
            System.Diagnostics.Debug.WriteLine( "copiedNow < 0" );
            if ( eofCond )
            {
              System.Diagnostics.Debug.WriteLine( "eofCond" );
              break;
            }
            if ( blocked )
            {
              System.Diagnostics.Debug.WriteLine( "blocked" );
              if ( !blocking )
              {
                break;
              }
              blocked = false;
            }
            result = Input;
            if ( result != 0 )
            {
              System.Diagnostics.Debug.WriteLine( "non-zero result" );
              if ( result == TclPosixException.EAGAIN )
              {
                break;
              }
              copied = -1;
              goto done_brk; //goto done
            }
          }
          else
          {
            copied += copiedNow;
            System.Diagnostics.Debug.WriteLine( "copied incremented to " + copied );
            toRead -= copiedNow;
            System.Diagnostics.Debug.WriteLine( "toRead decremented to " + toRead );
          }
        }

        blocked = false;

        if ( (System.Object)encoding == null )
        {
          TclByteArray.setLength( null, obj, offset.i );
          System.Diagnostics.Debug.WriteLine( "set byte array length to " + offset.i );
        }
      }

done_brk:
      ;
      // end done: block

      //done:
      updateInterest();

#if DEBUG
				System.Diagnostics.Debug.WriteLine("returning copied = " + copied);
				
				System.Diagnostics.Debug.WriteLine("returning string \"" + obj + "\"");
				obj.invalidateStringRep();
				
				System.Diagnostics.Debug.WriteLine("returning string \"" + obj + "\"");
#endif

      return copied;
    }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:101,代码来源:TclInputStream.cs


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