11diff --git a/src/main/java/org/graalvm/polyglot/nativeapi/PolyglotNativeAPI.java b/src/main/java/org/graalvm/polyglot/nativeapi/PolyglotNativeAPI.java
2- index 1ed21c307..496663aec 100644
2+ index 1ed21c307..7301ff355 100644
33--- a/src/main/java/org/graalvm/polyglot/nativeapi/PolyglotNativeAPI.java
44+++ b/src/main/java/org/graalvm/polyglot/nativeapi/PolyglotNativeAPI.java
55@@ -28,23 +28,60 @@ import static org.graalvm.polyglot.nativeapi.types.PolyglotNativeAPITypes.Polygl
@@ -189,7 +189,7 @@ index 1ed21c307..496663aec 100644
189189 @CEntryPoint(name = "poly_context_builder_build", exceptionHandler = ExceptionHandler.class, documentation = {
190190 "Builds a <code>context</code> from a <code>context_builder</code>. The same builder can be used to ",
191191 "produce multiple <code>poly_context</code> instances.",
192- @@ -808,6 +935,138 @@ public final class PolyglotNativeAPI {
192+ @@ -808,6 +935,160 @@ public final class PolyglotNativeAPI {
193193 return poly_ok;
194194 }
195195
@@ -215,6 +215,28 @@ index 1ed21c307..496663aec 100644
215215+ return poly_ok;
216216+ }
217217+
218+ + @CEntryPoint(name = "poly_create_source", exceptionHandler = ExceptionHandler.class, documentation = {
219+ + "Creates a Source object.",
220+ + "",
221+ + "@param language_id_utf8 0 terminated and UTF-8 encoded language identifier.",
222+ + "@param name_utf8 0 terminated and UTF-8 encoded name given to the evaluate source code.",
223+ + "@param source_utf8 0 terminated and UTF-8 encoded source code to be evaluated.",
224+ + "@param result <code>poly_value</code> that is the Source Builder object.",
225+ + "@return poly_ok if all works, poly_generic_error if there is a failure.",
226+ + })
227+ + public static PolyglotStatus poly_create_source(PolyglotIsolateThread thread, @CConst CCharPointer language_id_utf8, @CConst CCharPointer path_utf8,
228+ + PolyglotValuePointer result) throws Exception {
229+ + resetErrorState();
230+ + nullCheck(language_id_utf8, "language_id_utf8");
231+ + nullCheck(path_utf8, "path_utf8");
232+ + String languageName = CTypeConversion.utf8ToJavaString(language_id_utf8);
233+ + String jPath = CTypeConversion.utf8ToJavaString(path_utf8);
234+ +
235+ + Source source = Source.newBuilder(languageName, new File(jPath)).build();
236+ + result.write(createHandle(source));
237+ + return poly_ok;
238+ + }
239+ +
218240+ @CEntryPoint(name = "poly_create_source_builder", exceptionHandler = ExceptionHandler.class, documentation = {
219241+ "Creates a Source object.",
220242+ "",
@@ -328,7 +350,7 @@ index 1ed21c307..496663aec 100644
328350 @CEntryPoint(name = "poly_context_get_engine", exceptionHandler = ExceptionHandler.class, documentation = {
329351 "Returns the engine this context belongs to.",
330352 "",
331- @@ -954,6 +1213 ,36 @@ public final class PolyglotNativeAPI {
353+ @@ -954,6 +1235 ,36 @@ public final class PolyglotNativeAPI {
332354 return poly_ok;
333355 }
334356
@@ -365,7 +387,7 @@ index 1ed21c307..496663aec 100644
365387 @CEntryPoint(name = "poly_value_put_member", exceptionHandler = ExceptionHandler.class, documentation = {
366388 "Sets the value of a member with the `identifier_utf8`.",
367389 "",
368- @@ -975,6 +1264 ,25 @@ public final class PolyglotNativeAPI {
390+ @@ -975,6 +1286 ,25 @@ public final class PolyglotNativeAPI {
369391 return poly_ok;
370392 }
371393
@@ -391,7 +413,7 @@ index 1ed21c307..496663aec 100644
391413 @CEntryPoint(name = "poly_value_has_member", exceptionHandler = ExceptionHandler.class, documentation = {
392414 "Returns `true` if such a member exists for the given `identifier_utf8`. If the value has no members ",
393415 "then it returns `false`.",
394- @@ -1174,86 +1482 ,1769 @@ public final class PolyglotNativeAPI {
416+ @@ -1174,86 +1504 ,1769 @@ public final class PolyglotNativeAPI {
395417 return poly_ok;
396418 }
397419
@@ -2212,7 +2234,7 @@ index 1ed21c307..496663aec 100644
22122234 @CEntryPoint(name = "poly_create_array", exceptionHandler = ExceptionHandler.class, documentation = {
22132235 "Creates a polyglot array from the C array of polyglot values.",
22142236 "",
2215- @@ -1396,6 +3387 ,60 @@ public final class PolyglotNativeAPI {
2237+ @@ -1396,6 +3409 ,60 @@ public final class PolyglotNativeAPI {
22162238 return poly_ok;
22172239 }
22182240
@@ -2273,7 +2295,7 @@ index 1ed21c307..496663aec 100644
22732295 @CEntryPoint(name = "poly_value_is_null", exceptionHandler = ExceptionHandler.class, documentation = {
22742296 "Returns `true` if this value is `null` like.",
22752297 "",
2276- @@ -1668,6 +3713 ,71 @@ public final class PolyglotNativeAPI {
2298+ @@ -1668,6 +3735 ,71 @@ public final class PolyglotNativeAPI {
22772299 return poly_ok;
22782300 }
22792301
@@ -2345,7 +2367,7 @@ index 1ed21c307..496663aec 100644
23452367 @CEntryPoint(name = "poly_value_to_string_utf8", exceptionHandler = ExceptionHandler.class, documentation = {
23462368 "Writes a <code>toString</code> representation of a <code>poly_value</code> as a 0 terminated and UTF-8 encoded string.",
23472369 "",
2348- @@ -1985,14 +4095 ,14 @@ public final class PolyglotNativeAPI {
2370+ @@ -1985,14 +4117 ,14 @@ public final class PolyglotNativeAPI {
23492371 for (int i = 0; i < arguments.length; i++) {
23502372 handleArgs[i] = createHandle(arguments[i]);
23512373 }
@@ -2366,7 +2388,7 @@ index 1ed21c307..496663aec 100644
23662388 } finally {
23672389 threadLocals.get().callbackException = null;
23682390 getHandles().popFramesIncluding(frame);
2369- @@ -2003,6 +4113 ,81 @@ public final class PolyglotNativeAPI {
2391+ @@ -2003,6 +4135 ,81 @@ public final class PolyglotNativeAPI {
23702392 return poly_ok;
23712393 }
23722394
@@ -2448,7 +2470,7 @@ index 1ed21c307..496663aec 100644
24482470 @CEntryPoint(name = "poly_get_callback_info", exceptionHandler = ExceptionHandler.class, documentation = {
24492471 "Retrieves details about the call within a callback (e.g., the arguments from a given callback info).",
24502472 "",
2451- @@ -2020,20 +4205 ,43 @@ public final class PolyglotNativeAPI {
2473+ @@ -2020,20 +4227 ,43 @@ public final class PolyglotNativeAPI {
24522474 nullCheck(data, "data");
24532475 PolyglotCallbackInfoInternal callbackInfo = fetchHandle(callback_info);
24542476 UnsignedWord numberOfArguments = WordFactory.unsigned(callbackInfo.arguments.length);
@@ -2501,7 +2523,7 @@ index 1ed21c307..496663aec 100644
25012523 @CEntryPoint(name = "poly_throw_exception", exceptionHandler = ExceptionHandler.class, documentation = {
25022524 "Raises an exception in a C callback.",
25032525 "",
2504- @@ -2052,6 +4260 ,25 @@ public final class PolyglotNativeAPI {
2526+ @@ -2052,6 +4282 ,25 @@ public final class PolyglotNativeAPI {
25052527 return poly_ok;
25062528 }
25072529
@@ -2527,7 +2549,7 @@ index 1ed21c307..496663aec 100644
25272549 @CEntryPoint(name = "poly_delete_reference", exceptionHandler = ExceptionHandler.class, documentation = {
25282550 "Deletes a poly_reference. After this point, the reference must not be used anymore.",
25292551 "",
2530- @@ -2171,6 +4398 ,26 @@ public final class PolyglotNativeAPI {
2552+ @@ -2171,6 +4420 ,26 @@ public final class PolyglotNativeAPI {
25312553 return poly_ok;
25322554 }
25332555
@@ -2554,7 +2576,7 @@ index 1ed21c307..496663aec 100644
25542576 @CEntryPoint(name = "poly_exception_is_internal_error", exceptionHandler = ExceptionHandler.class, documentation = {
25552577 "Checks if this exception was caused by an internal implementation error.",
25562578 "",
2557- @@ -2649,6 +4896 ,61 @@ public final class PolyglotNativeAPI {
2579+ @@ -2649,6 +4918 ,61 @@ public final class PolyglotNativeAPI {
25582580 }
25592581 }
25602582
@@ -2627,5 +2649,5 @@ index a227d9c9e..58a723a15 100644
26272649- return createIsolate(params, isolate, thread) == 0 ? Poly.ok() : Poly.generic_failure();
26282650+ return createIsolate(params, isolate, thread);
26292651 }
2630-
2652+
26312653 @Uninterruptible(reason = UNINTERRUPTIBLE_REASON)
0 commit comments