The R Project SVN R

Rev

Rev 27383 | Rev 31887 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27383 Rev 28176
Line 714... Line 714...
714
    dims = getAttrib(x, R_DimSymbol);
714
    dims = getAttrib(x, R_DimSymbol);
715
    ndims = length(dims);
715
    ndims = length(dims);
716
    if(nsubs > 1 && nsubs != ndims)
716
    if(nsubs > 1 && nsubs != ndims)
717
	errorcall(call, "incorrect number of subscripts");
717
	errorcall(call, "incorrect number of subscripts");
718
 
718
 
-
 
719
    /* split out ENVSXP for now */
-
 
720
    if( TYPEOF(x) == ENVSXP ) {
-
 
721
      if( nsubs != 1 || !isString(CAR(subs)) || length(CAR(subs)) != 1 )
-
 
722
	error("wrong arguments for subsetting an environment");
-
 
723
      ans = findVarInFrame(x, install(CHAR(STRING_ELT(CAR(subs),
-
 
724
						      0))));
-
 
725
      UNPROTECT(1);
-
 
726
      if(ans == R_UnboundValue )
-
 
727
        return(R_NilValue);
-
 
728
      return(ans);
-
 
729
    }
-
 
730
    
-
 
731
    /* back to the regular program */
719
    if (!(isVector(x) || isList(x) || isLanguage(x)))
732
    if (!(isVector(x) || isList(x) || isLanguage(x)))
720
	errorcall(call, R_MSG_ob_nonsub);
733
	errorcall(call, R_MSG_ob_nonsub);
721
 
734
 
722
    if(nsubs == 1) { /* vector indexing */
735
    if(nsubs == 1) { /* vector indexing */
723
	SEXP thesub = CAR(subs);
736
	SEXP thesub = CAR(subs);
Line 951... Line 964...
951
		SET_NAMED(y, NAMED(x));
964
		SET_NAMED(y, NAMED(x));
952
	    return y;
965
	    return y;
953
	}
966
	}
954
	return R_NilValue;
967
	return R_NilValue;
955
    }
968
    }
-
 
969
    else if( isEnvironment(x) ){
-
 
970
      UNPROTECT(2);
-
 
971
      y = findVarInFrame(x, install(CHAR(input)));
-
 
972
      if( y != R_UnboundValue )
-
 
973
	return(y);
-
 
974
      return R_NilValue;
-
 
975
    }
956
    UNPROTECT(2);
976
    UNPROTECT(2);
957
    return R_NilValue;
977
    return R_NilValue;
958
}
978
}