예제 #1
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 );
    }