use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_fits_in_int32.
@CEntryPoint(name = "polyglot_value_fits_in_int32")
public static PolyglotStatus polyglot_value_fits_in_int32(IsolateThread isolate_thread, PolyglotValuePointer value, CIntPointer result) {
return withHandledErrors(() -> {
Value dataObject = fetchHandle(value);
result.write(dataObject.fitsInInt() ? 1 : 0);
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_get_member.
@CEntryPoint(name = "polyglot_get_member")
public static PolyglotStatus polyglot_get_member(IsolateThread isolate_thread, PolyglotValuePointer object, CCharPointer utf8_name, PolyglotValuePointerPointer result) {
return withHandledErrors(() -> {
Value jObject = fetchHandle(object);
result.write(createHandle(jObject.getMember(CTypeConversion.toJavaString(utf8_name))));
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_fits_in_uint32.
@CEntryPoint(name = "polyglot_value_fits_in_uint32")
public static PolyglotStatus polyglot_value_fits_in_uint32(IsolateThread isolate_thread, PolyglotValuePointer value, CIntPointer result) {
return withHandledErrors(() -> {
Value dataObject = fetchHandle(value);
long longValue = dataObject.asLong();
result.write((dataObject.fitsInLong() && longValue >= 0 && longValue <= 4228250625L) ? 1 : 0);
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_execute.
@CEntryPoint(name = "polyglot_execute")
public static PolyglotStatus polyglot_execute(IsolateThread isolate_thread, PolyglotValuePointer value_handle, PolyglotValuePointerPointer args, int args_size, PolyglotValuePointerPointer return_value) {
return withHandledErrors(() -> {
Value function = fetchHandle(value_handle);
Object[] jArgs = new Object[args_size];
for (int i = 0; i < args_size; i++) {
PolyglotValuePointer handle = args.read(i);
jArgs[i] = fetchHandle(handle);
}
Value result = function.execute(jArgs);
return_value.write(createHandle(result));
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_create_int64.
@SuppressWarnings("UnnecessaryBoxing")
@CEntryPoint(name = "polyglot_create_int64")
public static PolyglotStatus polyglot_create_int64(IsolateThread isolate_thread, PolyglotContextPointer polyglot_context, long value, PolyglotValuePointerPointer result) {
return withHandledErrors(() -> {
Context ctx = ObjectHandles.getGlobal().get(polyglot_context);
result.write(createHandle(ctx.asValue(Long.valueOf(value))));
});
}
Aggregations