コード例 #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 );
    }
コード例 #2
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 );
    }