/* * TclObj.java * * Copyright (c) 1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL * WARRANTIES. * * Included in SQLite3 port to C# for use in testharness only; 2008 Noah B Hart * * RCS @(#) $Id: TclObj.java,v 1.5 2000/10/29 06:00:42 mdejong Exp $ * */ using System; namespace tcl.lang { /// This class implements the object type in Tcl. public class TclObj : InternalRep { /// Internal representation of a object value. private object value; /// Construct a TclObj representation with the given object value. private TclObj( object o ) { value = o; } /// Returns a dupilcate of the current object. /// the TclObject that contains this internalRep. /// public InternalRep duplicate() { return new TclObj( value ); } /// Implement this no-op for the InternalRep interface. public void dispose() { value = null; } /// Called to query the string representation of the Tcl object. This /// method is called only by TclObject.toString() when /// TclObject.stringRep is null. /// /// /// the string representation of the Tcl object. /// public override string ToString() { return value.ToString(); } /// Tcl_NewIntObj -> TclObj.newInstance /// /// Creates a new instance of a TclObject with a TclObj internal /// representation. /// /// /// initial value of the object object. /// /// the TclObject with the given object value. /// public static TclObject newInstance( object o ) { return new TclObject( new TclObj( o ) ); } /// Changes the object value of the object. /// /// /// current interpreter. /// /// the object to operate on. /// @paran i the new object value. /// 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 ); } } } }