public RFactorToStringVectorClosure( RFactor factor, RAbstractStringVector levels, boolean withNames) { super(factor.getVector()); this.levels = levels; this.withNames = withNames; if (this.levels == null) { RError.warning(RError.NO_NODE, RError.Message.IS_NA_TO_NON_VECTOR, "NULL"); } }
@Specialization public Object callNamedFunctionWithPackage( String name, RArgsValuesAndNames args, String packageName) { controlVisibility(); SymbolInfo symbolInfo = DLL.findSymbolInfo(name, packageName); if (symbolInfo == null) { errorProfile.enter(); throw RError.error(this, Message.C_SYMBOL_NOT_IN_TABLE, name); } return RFFIFactory.getRFFI() .getCallRFFI() .invokeCall(symbolInfo.address, symbolInfo.symbol, args.getArguments()); }
@Specialization public Object callNamedFunctionWithPackage( String name, RArgsValuesAndNames args, String packageName) { controlVisibility(); SymbolInfo symbolInfo = DLL.findSymbolInfo(name, packageName); if (symbolInfo == null) { errorProfile.enter(); throw RError.error(this, Message.C_SYMBOL_NOT_IN_TABLE, name); } Object list = encodeArgumentPairList(args, symbolInfo.symbol); // TODO: provide proper values for the CALL, OP and RHO parameters return RFFIFactory.getRFFI() .getCallRFFI() .invokeCall(symbolInfo.address, symbolInfo.symbol, new Object[] {CALL, OP, list, RHO}); }
@Specialization protected RList c( String f, RArgsValuesAndNames args, byte naok, byte dup, @SuppressWarnings("unused") RMissing rPackage, @SuppressWarnings("unused") RMissing encoding, // @Cached("create()") BranchProfile errorProfile) { controlVisibility(); SymbolInfo symbolInfo = DLL.findRegisteredSymbolinInDLL(f, null, ""); if (symbolInfo == null) { errorProfile.enter(); throw RError.error(this, RError.Message.C_SYMBOL_NOT_IN_TABLE, f); } return DotC.dispatch( this, symbolInfo.address, symbolInfo.symbol, naok, dup, args.getArguments()); }
protected RuntimeException fallback(Object fobj) { String name = null; if (fobj instanceof RList) { name = lookupName((RList) fobj); name = name == UNKNOWN_EXTERNAL_BUILTIN ? null : name; if (name != null && lookupBuiltin((RList) fobj) != null) { /* * if we reach this point, then the cache saw a different value for f. the lists * that contain the information about native calls are never expected to change. */ throw RInternalError.shouldNotReachHere( "fallback reached for " + getRBuiltin().name() + " " + name); } } throw RError.nyi( this, getRBuiltin().name() + " specialization failure: " + (name == null ? "<unknown>" : name)); }