Skip to content
Snippets Groups Projects
Commit adf0bf74 authored by Florian Angerer's avatar Florian Angerer
Browse files

Add node for 'eSoftVersion'.

parent 41e330d9
No related branches found
No related tags found
No related merge requests found
......@@ -395,6 +395,7 @@ public class BasePackage extends RBuiltinPackage {
add(DynLoadFunctions.GetLoadedDLLs.class, DynLoadFunctionsFactory.GetLoadedDLLsNodeGen::create);
add(DynLoadFunctions.GetSymbolInfo.class, DynLoadFunctionsFactory.GetSymbolInfoNodeGen::create);
add(DynLoadFunctions.IsLoaded.class, DynLoadFunctionsFactory.IsLoadedNodeGen::create);
add(DynLoadFunctions.ExtSoftVersion.class, DynLoadFunctionsFactory.ExtSoftVersionNodeGen::create);
add(EncodeString.class, EncodeStringNodeGen::create);
add(EncodingFunctions.Encoding.class, EncodingFunctionsFactory.EncodingNodeGen::create);
add(EncodingFunctions.SetEncoding.class, EncodingFunctionsFactory.SetEncodingNodeGen::create);
......
......@@ -22,7 +22,6 @@
*/
package com.oracle.truffle.r.nodes.builtin.base;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.asStringVector;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.instanceOf;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.logicalValue;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.notEmpty;
......@@ -35,6 +34,8 @@ import static com.oracle.truffle.r.runtime.builtins.RBehavior.READS_STATE;
import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
......@@ -48,6 +49,7 @@ import com.oracle.truffle.r.runtime.data.RDataFactory;
import com.oracle.truffle.r.runtime.data.RExternalPtr;
import com.oracle.truffle.r.runtime.data.RList;
import com.oracle.truffle.r.runtime.data.RNull;
import com.oracle.truffle.r.runtime.data.RStringVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
import com.oracle.truffle.r.runtime.ffi.DLL;
import com.oracle.truffle.r.runtime.ffi.DLL.DLLException;
......@@ -218,4 +220,33 @@ public class DynLoadFunctions {
return DLL.isDLLInfo(externalPtr);
}
}
@RBuiltin(name = "eSoftVersion", kind = INTERNAL, parameterNames = {}, behavior = READS_STATE)
public abstract static class ExtSoftVersion extends RBuiltinNode.Arg0 {
static {
Casts.noCasts(ExtSoftVersion.class);
}
@Specialization
@TruffleBoundary
protected RStringVector getSymbolInfo() {
String[] data = new String[]{"zlib", "bzlib", "xz", "PCRE", "ICU", "TRE", "iconv"};
RStringVector names = RDataFactory.createStringVector(data, true);
Map<String, String> versionFunctionTable = new HashMap<>();
versionFunctionTable.put("zlib", "zlibVersion");
versionFunctionTable.put("bzlib", "BZ2_bzlibVersion");
versionFunctionTable.put("xz", "lzma_version_string");
versionFunctionTable.put("PCRE", "pcre_version");
versionFunctionTable.put("TRE", "tre_version");
// TODO
// ICU -> empty
// TRE mandatory
// iconv -> unknown
return RDataFactory.createStringVector(0);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment