use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_fits_in_int8.
@CEntryPoint(name = "polyglot_value_fits_in_int8")
public static PolyglotStatus polyglot_value_fits_in_int8(IsolateThread isolate_thread, PolyglotValuePointer value, CIntPointer result) {
return withHandledErrors(() -> {
Value dataObject = fetchHandle(value);
result.write(dataObject.fitsInByte() ? 1 : 0);
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_has_member.
@CEntryPoint(name = "polyglot_has_member")
public static PolyglotStatus polyglot_has_member(IsolateThread isolate_thread, PolyglotValuePointer object, CCharPointer utf8_name, CIntPointer result) {
return withHandledErrors(() -> {
Value jObject = fetchHandle(object);
result.write(jObject.hasMember(CTypeConversion.toJavaString(utf8_name)) ? 1 : 0);
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_fits_in_double.
@CEntryPoint(name = "polyglot_value_fits_in_double")
public static PolyglotStatus polyglot_value_fits_in_double(IsolateThread isolate_thread, PolyglotValuePointer value, CIntPointer result) {
return withHandledErrors(() -> {
Value dataObject = fetchHandle(value);
result.write(dataObject.fitsInDouble() ? 1 : 0);
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_export_symbol.
@CEntryPoint(name = "polyglot_export_symbol")
public static PolyglotStatus polyglot_export_symbol(IsolateThread isolate_thread, PolyglotContextPointer context, CCharPointer symbol_name, PolyglotValuePointer value) {
return withHandledErrors(() -> {
Context jContext = ObjectHandles.getGlobal().get(context);
String symbolName = CTypeConversion.toJavaString(symbol_name);
jContext.getPolyglotBindings().putMember(symbolName, fetchHandle(value));
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_as_uint8.
@CEntryPoint(name = "polyglot_value_as_uint8")
public static PolyglotStatus polyglot_value_as_uint8(IsolateThread isolate_thread, PolyglotValuePointer value, CCharPointer result) {
return withHandledErrors(() -> {
Value valueObject = fetchHandle(value);
int intValue = valueObject.asInt();
if (intValue < 0 || intValue > 255) {
throw reportError("Value " + Long.toHexString(intValue) + "does not fit in unsigned char", polyglot_generic_failure);
}
result.write((byte) intValue);
});
}
Aggregations