internal static void registerChannel( Interp interp, Channel chan )
    {

      if ( interp != null )
      {
        Hashtable chanTable = getInterpChanTable( interp );
        SupportClass.PutElement( chanTable, chan.ChanName, chan );
        chan.refCount++;
      }
    }
    internal static void unregisterChannel( Interp interp, Channel chan )
    {

      Hashtable chanTable = getInterpChanTable( interp );
      SupportClass.HashtableRemove( chanTable, chan.ChanName );

      if ( --chan.refCount <= 0 )
      {
        try
        {
          chan.close();
        }
        catch ( IOException e )
        {
          throw new TclRuntimeError( "TclIO.unregisterChannel() Error: IOException when closing " + chan.ChanName + ": " + e.Message, e );
        }
      }
    }
Example #3
0
 private void put(Channel channel, string s)
 // The String to print.
 {
   try
   {
     channel.write(interp, s);
     channel.flush(interp);
   }
   catch (System.IO.IOException ex)
   {
     System.Console.Error.WriteLine("IOException in Shell.put()");
     SupportClass.WriteStackTrace(ex, System.Console.Error);
   }
   catch (TclException ex)
   {
     System.Console.Error.WriteLine("TclException in Shell.put()");
     SupportClass.WriteStackTrace(ex, System.Console.Error);
   }
 }
Example #4
0
    internal ConsoleThread(Interp i)
    {
      Name = "ConsoleThread";
      interp = i;
      sbuf = new System.Text.StringBuilder(100);

      out_Renamed = TclIO.getStdChannel(StdChannel.STDOUT);
      err = TclIO.getStdChannel(StdChannel.STDERR);
    }