use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_is_null.
@CEntryPoint(name = "polyglot_value_is_null")
public static PolyglotStatus polyglot_value_is_null(IsolateThread isolate_thread, PolyglotValuePointer object, CIntPointer result) {
return withHandledErrors(() -> {
Value value = fetchHandle(object);
result.write(value.isNull() ? 1 : 0);
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_create_uint32.
@SuppressWarnings("UnnecessaryBoxing")
@CEntryPoint(name = "polyglot_create_uint32")
public static PolyglotStatus polyglot_create_uint32(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))));
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_value_as_int32.
@CEntryPoint(name = "polyglot_value_as_int32")
public static PolyglotStatus polyglot_value_as_int32(IsolateThread isolate_thread, PolyglotValuePointer value, CIntPointer result) {
return withHandledErrors(() -> {
Value valueObject = fetchHandle(value);
result.write(valueObject.asInt());
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_create_context.
@CEntryPoint(name = "polyglot_create_context", documentation = { "Creates a context within an polyglot engine.", "Context holds all of the program data. Each context is by default isolated from all other contexts", "with respect to program data and evaluation semantics." })
public static PolyglotStatus polyglot_create_context(IsolateThread isolate_thread, PolyglotEnginePointer engine_handle, PolyglotContextPointerPointer context) {
return withHandledErrors(() -> {
Engine engine = ObjectHandles.getGlobal().get(engine_handle);
Context c = Context.newBuilder().engine(engine).build();
context.write(createHandle(c));
});
}
use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.
the class PolyglotNativeAPI method polyglot_create_string_utf8.
@CEntryPoint(name = "polyglot_create_string_utf8")
public static PolyglotStatus polyglot_create_string_utf8(IsolateThread isolate_thread, PolyglotContextPointer polyglot_context, CCharPointer value, UnsignedWord length, PolyglotValuePointerPointer result) {
return withHandledErrors(() -> {
Context ctx = ObjectHandles.getGlobal().get(polyglot_context);
result.write(createHandle(ctx.asValue(CTypeConversion.toJavaString(value, length))));
});
}
Aggregations