Exemple #1
0
    internal static void hide( Interp interp, Interp slaveInterp, int objIx, TclObject[] objv )
    {
      if ( interp._isSafe )
      {
        throw new TclException( interp, "permission denied: " + "safe interpreter cannot hide commands" );
      }

      int nameIdx = objv.Length - objIx == 1 ? objIx : objIx + 1;

      try
      {

        slaveInterp.hideCommand( objv[objIx].ToString(), objv[nameIdx].ToString() );
      }
      catch ( TclException e )
      {
        interp.transferResult( slaveInterp, e.GetCompletionCode() );
        throw;
      }
    }
Exemple #2
0
    internal static void invokeHidden( Interp interp, Interp slaveInterp, bool global, int objIx, TclObject[] objv )
    {
      TCL.CompletionCode result;

      if ( interp._isSafe )
      {
        throw new TclException( interp, "not allowed to " + "invoke hidden commands from safe interpreter" );
      }

      slaveInterp.preserve();
      slaveInterp.allowExceptions();

      TclObject[] localObjv = new TclObject[objv.Length - objIx];
      for ( int i = 0; i < objv.Length - objIx; i++ )
      {
        localObjv[i] = objv[i + objIx];
      }

      try
      {
        if ( global )
        {
          slaveInterp.invokeGlobal( localObjv, Interp.INVOKE_HIDDEN );
        }
        else
        {
          slaveInterp.invoke( localObjv, Interp.INVOKE_HIDDEN );
        }
        result = slaveInterp._returnCode;
      }
      catch ( TclException e )
      {
        result = e.GetCompletionCode();
      }

      slaveInterp.release();
      interp.transferResult( slaveInterp, result );
    }
Exemple #3
0
    internal static void eval( Interp interp, Interp slaveInterp, int objIx, TclObject[] objv )
    {
      TCL.CompletionCode result;

      slaveInterp.preserve();
      slaveInterp.allowExceptions();

      try
      {
        if ( objIx + 1 == objv.Length )
        {
          slaveInterp.Eval( objv[objIx], 0 );
        }
        else
        {
          TclObject obj = TclList.NewInstance();
          for ( int ix = objIx; ix < objv.Length; ix++ )
          {
            TclList.Append( interp, obj, objv[ix] );
          }
          obj.Preserve();
          slaveInterp.Eval( obj, 0 );
          obj.Release();
        }
        result = slaveInterp._returnCode;
      }
      catch ( TclException e )
      {
        result = e.GetCompletionCode();
      }

      slaveInterp.release();
      interp.transferResult( slaveInterp, result );
    }