tigerbeetle 0.0.34 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/ext/tb_client/extconf.rb +13 -13
- data/ext/tb_client/tigerbeetle/LICENSE +177 -0
- data/ext/tb_client/tigerbeetle/build.zig +2327 -0
- data/ext/tb_client/tigerbeetle/src/aof.zig +1000 -0
- data/ext/tb_client/tigerbeetle/src/build_multiversion.zig +808 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp/protocol.zig +1283 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp/spec.zig +1704 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp/types.zig +341 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp.zig +1450 -0
- data/ext/tb_client/tigerbeetle/src/cdc/runner.zig +1659 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/samples/main.c +406 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/context.zig +1084 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/echo_client.zig +286 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/packet.zig +158 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/signal.zig +229 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/signal_fuzz.zig +110 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client.h +386 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client.zig +34 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client_exports.zig +281 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client_header.zig +312 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client_header_test.zig +138 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/test.zig +466 -0
- data/ext/tb_client/tigerbeetle/src/clients/docs_samples.zig +157 -0
- data/ext/tb_client/tigerbeetle/src/clients/docs_types.zig +90 -0
- data/ext/tb_client/tigerbeetle/src/clients/dotnet/ci.zig +203 -0
- data/ext/tb_client/tigerbeetle/src/clients/dotnet/docs.zig +79 -0
- data/ext/tb_client/tigerbeetle/src/clients/dotnet/dotnet_bindings.zig +542 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/ci.zig +109 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/docs.zig +86 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/go_bindings.zig +370 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/pkg/native/tb_client.h +386 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/ci.zig +167 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/docs.zig +126 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/java_bindings.zig +996 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/client.zig +748 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/jni.zig +3238 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/jni_tests.zig +1718 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/jni_thread_cleaner.zig +190 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/ci.zig +104 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/docs.zig +75 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/node.zig +522 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/node_bindings.zig +267 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/src/c.zig +3 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/src/translate.zig +379 -0
- data/ext/tb_client/tigerbeetle/src/clients/python/ci.zig +131 -0
- data/ext/tb_client/tigerbeetle/src/clients/python/docs.zig +63 -0
- data/ext/tb_client/tigerbeetle/src/clients/python/python_bindings.zig +588 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/assets/tb_client.h +386 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/ci.zig +73 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/docs.zig +106 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/rust_bindings.zig +305 -0
- data/ext/tb_client/tigerbeetle/src/config.zig +296 -0
- data/ext/tb_client/tigerbeetle/src/constants.zig +790 -0
- data/ext/tb_client/tigerbeetle/src/copyhound.zig +202 -0
- data/ext/tb_client/tigerbeetle/src/counting_allocator.zig +72 -0
- data/ext/tb_client/tigerbeetle/src/direction.zig +11 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/build.zig +158 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/content.zig +156 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/docs.zig +252 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/file_checker.zig +313 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/html.zig +87 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/page_writer.zig +63 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/redirects.zig +47 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/search_index_writer.zig +28 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/service_worker_writer.zig +61 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/single_page_writer.zig +169 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/website.zig +46 -0
- data/ext/tb_client/tigerbeetle/src/ewah.zig +445 -0
- data/ext/tb_client/tigerbeetle/src/ewah_benchmark.zig +128 -0
- data/ext/tb_client/tigerbeetle/src/ewah_fuzz.zig +171 -0
- data/ext/tb_client/tigerbeetle/src/fuzz_tests.zig +179 -0
- data/ext/tb_client/tigerbeetle/src/integration_tests.zig +662 -0
- data/ext/tb_client/tigerbeetle/src/io/common.zig +155 -0
- data/ext/tb_client/tigerbeetle/src/io/darwin.zig +1093 -0
- data/ext/tb_client/tigerbeetle/src/io/linux.zig +1880 -0
- data/ext/tb_client/tigerbeetle/src/io/test.zig +1005 -0
- data/ext/tb_client/tigerbeetle/src/io/windows.zig +1598 -0
- data/ext/tb_client/tigerbeetle/src/io.zig +34 -0
- data/ext/tb_client/tigerbeetle/src/iops.zig +134 -0
- data/ext/tb_client/tigerbeetle/src/list.zig +236 -0
- data/ext/tb_client/tigerbeetle/src/lsm/binary_search.zig +848 -0
- data/ext/tb_client/tigerbeetle/src/lsm/binary_search_benchmark.zig +179 -0
- data/ext/tb_client/tigerbeetle/src/lsm/cache_map.zig +424 -0
- data/ext/tb_client/tigerbeetle/src/lsm/cache_map_fuzz.zig +420 -0
- data/ext/tb_client/tigerbeetle/src/lsm/compaction.zig +2117 -0
- data/ext/tb_client/tigerbeetle/src/lsm/composite_key.zig +182 -0
- data/ext/tb_client/tigerbeetle/src/lsm/forest.zig +1119 -0
- data/ext/tb_client/tigerbeetle/src/lsm/forest_fuzz.zig +1102 -0
- data/ext/tb_client/tigerbeetle/src/lsm/forest_table_iterator.zig +200 -0
- data/ext/tb_client/tigerbeetle/src/lsm/groove.zig +1495 -0
- data/ext/tb_client/tigerbeetle/src/lsm/k_way_merge.zig +739 -0
- data/ext/tb_client/tigerbeetle/src/lsm/k_way_merge_benchmark.zig +166 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest.zig +754 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_level.zig +1294 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_level_fuzz.zig +510 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_log.zig +1263 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_log_fuzz.zig +628 -0
- data/ext/tb_client/tigerbeetle/src/lsm/node_pool.zig +247 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_buffer.zig +116 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_builder.zig +543 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_fuzz.zig +938 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_lookup.zig +293 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_merge.zig +362 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_range.zig +99 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_state.zig +17 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_tree.zig +1036 -0
- data/ext/tb_client/tigerbeetle/src/lsm/schema.zig +617 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scratch_memory.zig +84 -0
- data/ext/tb_client/tigerbeetle/src/lsm/segmented_array.zig +1500 -0
- data/ext/tb_client/tigerbeetle/src/lsm/segmented_array_benchmark.zig +149 -0
- data/ext/tb_client/tigerbeetle/src/lsm/segmented_array_fuzz.zig +7 -0
- data/ext/tb_client/tigerbeetle/src/lsm/set_associative_cache.zig +865 -0
- data/ext/tb_client/tigerbeetle/src/lsm/table.zig +607 -0
- data/ext/tb_client/tigerbeetle/src/lsm/table_memory.zig +843 -0
- data/ext/tb_client/tigerbeetle/src/lsm/table_value_iterator.zig +105 -0
- data/ext/tb_client/tigerbeetle/src/lsm/timestamp_range.zig +40 -0
- data/ext/tb_client/tigerbeetle/src/lsm/tree.zig +630 -0
- data/ext/tb_client/tigerbeetle/src/lsm/tree_fuzz.zig +933 -0
- data/ext/tb_client/tigerbeetle/src/lsm/zig_zag_merge.zig +557 -0
- data/ext/tb_client/tigerbeetle/src/message_buffer.zig +469 -0
- data/ext/tb_client/tigerbeetle/src/message_bus.zig +1214 -0
- data/ext/tb_client/tigerbeetle/src/message_bus_fuzz.zig +936 -0
- data/ext/tb_client/tigerbeetle/src/message_pool.zig +343 -0
- data/ext/tb_client/tigerbeetle/src/multiversion.zig +2195 -0
- data/ext/tb_client/tigerbeetle/src/queue.zig +390 -0
- data/ext/tb_client/tigerbeetle/src/repl/completion.zig +201 -0
- data/ext/tb_client/tigerbeetle/src/repl/parser.zig +1356 -0
- data/ext/tb_client/tigerbeetle/src/repl/terminal.zig +496 -0
- data/ext/tb_client/tigerbeetle/src/repl.zig +1034 -0
- data/ext/tb_client/tigerbeetle/src/scripts/amqp.zig +973 -0
- data/ext/tb_client/tigerbeetle/src/scripts/cfo.zig +1866 -0
- data/ext/tb_client/tigerbeetle/src/scripts/changelog.zig +304 -0
- data/ext/tb_client/tigerbeetle/src/scripts/ci.zig +227 -0
- data/ext/tb_client/tigerbeetle/src/scripts/client_readmes.zig +658 -0
- data/ext/tb_client/tigerbeetle/src/scripts/devhub.zig +466 -0
- data/ext/tb_client/tigerbeetle/src/scripts/release.zig +1058 -0
- data/ext/tb_client/tigerbeetle/src/scripts.zig +105 -0
- data/ext/tb_client/tigerbeetle/src/shell.zig +1195 -0
- data/ext/tb_client/tigerbeetle/src/stack.zig +260 -0
- data/ext/tb_client/tigerbeetle/src/state_machine/auditor.zig +911 -0
- data/ext/tb_client/tigerbeetle/src/state_machine/workload.zig +2079 -0
- data/ext/tb_client/tigerbeetle/src/state_machine.zig +4872 -0
- data/ext/tb_client/tigerbeetle/src/state_machine_fuzz.zig +288 -0
- data/ext/tb_client/tigerbeetle/src/state_machine_tests.zig +3128 -0
- data/ext/tb_client/tigerbeetle/src/static_allocator.zig +82 -0
- data/ext/tb_client/tigerbeetle/src/stdx/bit_set.zig +157 -0
- data/ext/tb_client/tigerbeetle/src/stdx/bounded_array.zig +292 -0
- data/ext/tb_client/tigerbeetle/src/stdx/debug.zig +65 -0
- data/ext/tb_client/tigerbeetle/src/stdx/flags.zig +1414 -0
- data/ext/tb_client/tigerbeetle/src/stdx/mlock.zig +92 -0
- data/ext/tb_client/tigerbeetle/src/stdx/prng.zig +677 -0
- data/ext/tb_client/tigerbeetle/src/stdx/radix.zig +336 -0
- data/ext/tb_client/tigerbeetle/src/stdx/ring_buffer.zig +511 -0
- data/ext/tb_client/tigerbeetle/src/stdx/sort_test.zig +112 -0
- data/ext/tb_client/tigerbeetle/src/stdx/stdx.zig +1160 -0
- data/ext/tb_client/tigerbeetle/src/stdx/testing/low_level_hash_vectors.zig +142 -0
- data/ext/tb_client/tigerbeetle/src/stdx/testing/snaptest.zig +361 -0
- data/ext/tb_client/tigerbeetle/src/stdx/time_units.zig +275 -0
- data/ext/tb_client/tigerbeetle/src/stdx/unshare.zig +295 -0
- data/ext/tb_client/tigerbeetle/src/stdx/vendored/aegis.zig +436 -0
- data/ext/tb_client/tigerbeetle/src/stdx/windows.zig +48 -0
- data/ext/tb_client/tigerbeetle/src/stdx/zipfian.zig +402 -0
- data/ext/tb_client/tigerbeetle/src/storage.zig +489 -0
- data/ext/tb_client/tigerbeetle/src/storage_fuzz.zig +180 -0
- data/ext/tb_client/tigerbeetle/src/testing/bench.zig +146 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/grid_checker.zig +53 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/journal_checker.zig +61 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/manifest_checker.zig +76 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/message_bus.zig +110 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/network.zig +412 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/state_checker.zig +331 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/storage_checker.zig +458 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster.zig +1198 -0
- data/ext/tb_client/tigerbeetle/src/testing/exhaustigen.zig +128 -0
- data/ext/tb_client/tigerbeetle/src/testing/fixtures.zig +181 -0
- data/ext/tb_client/tigerbeetle/src/testing/fuzz.zig +144 -0
- data/ext/tb_client/tigerbeetle/src/testing/id.zig +97 -0
- data/ext/tb_client/tigerbeetle/src/testing/io.zig +317 -0
- data/ext/tb_client/tigerbeetle/src/testing/marks.zig +126 -0
- data/ext/tb_client/tigerbeetle/src/testing/packet_simulator.zig +533 -0
- data/ext/tb_client/tigerbeetle/src/testing/reply_sequence.zig +154 -0
- data/ext/tb_client/tigerbeetle/src/testing/state_machine.zig +389 -0
- data/ext/tb_client/tigerbeetle/src/testing/storage.zig +1247 -0
- data/ext/tb_client/tigerbeetle/src/testing/table.zig +249 -0
- data/ext/tb_client/tigerbeetle/src/testing/time.zig +98 -0
- data/ext/tb_client/tigerbeetle/src/testing/tmp_tigerbeetle.zig +212 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/constants.zig +26 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/faulty_network.zig +580 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/java_driver/ci.zig +39 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/logged_process.zig +214 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/rust_driver/ci.zig +34 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/supervisor.zig +766 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/workload.zig +543 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/zig_driver.zig +181 -0
- data/ext/tb_client/tigerbeetle/src/tidy.zig +1448 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/benchmark_driver.zig +227 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/benchmark_load.zig +1069 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/cli.zig +1422 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/inspect.zig +1658 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/inspect_integrity.zig +518 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/libtb_client.zig +36 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/main.zig +646 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle.zig +958 -0
- data/ext/tb_client/tigerbeetle/src/time.zig +236 -0
- data/ext/tb_client/tigerbeetle/src/trace/event.zig +745 -0
- data/ext/tb_client/tigerbeetle/src/trace/statsd.zig +462 -0
- data/ext/tb_client/tigerbeetle/src/trace.zig +556 -0
- data/ext/tb_client/tigerbeetle/src/unit_tests.zig +321 -0
- data/ext/tb_client/tigerbeetle/src/vopr.zig +1785 -0
- data/ext/tb_client/tigerbeetle/src/vortex.zig +101 -0
- data/ext/tb_client/tigerbeetle/src/vsr/checkpoint_trailer.zig +473 -0
- data/ext/tb_client/tigerbeetle/src/vsr/checksum.zig +208 -0
- data/ext/tb_client/tigerbeetle/src/vsr/checksum_benchmark.zig +43 -0
- data/ext/tb_client/tigerbeetle/src/vsr/client.zig +768 -0
- data/ext/tb_client/tigerbeetle/src/vsr/client_replies.zig +532 -0
- data/ext/tb_client/tigerbeetle/src/vsr/client_sessions.zig +338 -0
- data/ext/tb_client/tigerbeetle/src/vsr/clock.zig +1019 -0
- data/ext/tb_client/tigerbeetle/src/vsr/fault_detector.zig +279 -0
- data/ext/tb_client/tigerbeetle/src/vsr/free_set.zig +1381 -0
- data/ext/tb_client/tigerbeetle/src/vsr/free_set_fuzz.zig +315 -0
- data/ext/tb_client/tigerbeetle/src/vsr/grid.zig +1460 -0
- data/ext/tb_client/tigerbeetle/src/vsr/grid_blocks_missing.zig +757 -0
- data/ext/tb_client/tigerbeetle/src/vsr/grid_scrubber.zig +797 -0
- data/ext/tb_client/tigerbeetle/src/vsr/journal.zig +2586 -0
- data/ext/tb_client/tigerbeetle/src/vsr/marzullo.zig +308 -0
- data/ext/tb_client/tigerbeetle/src/vsr/message_header.zig +1777 -0
- data/ext/tb_client/tigerbeetle/src/vsr/multi_batch.zig +715 -0
- data/ext/tb_client/tigerbeetle/src/vsr/multi_batch_fuzz.zig +185 -0
- data/ext/tb_client/tigerbeetle/src/vsr/repair_budget.zig +333 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica.zig +12355 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica_format.zig +416 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica_reformat.zig +165 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica_test.zig +2910 -0
- data/ext/tb_client/tigerbeetle/src/vsr/routing.zig +1075 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock.zig +1603 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock_fuzz.zig +484 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock_quorums.zig +405 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock_quorums_fuzz.zig +355 -0
- data/ext/tb_client/tigerbeetle/src/vsr/sync.zig +29 -0
- data/ext/tb_client/tigerbeetle/src/vsr.zig +1727 -0
- data/lib/tb_client/shared_lib.rb +12 -5
- data/lib/tigerbeetle/client.rb +1 -1
- data/lib/tigerbeetle/platforms.rb +9 -0
- data/lib/tigerbeetle/version.rb +2 -2
- data/tigerbeetle.gemspec +22 -5
- metadata +242 -3
- data/ext/tb_client/pkg.tar.gz +0 -0
|
@@ -0,0 +1,3238 @@
|
|
|
1
|
+
///! Based on Java Native Interface Specification and Java Invocation API.
|
|
2
|
+
///! https://docs.oracle.com/en/java/javase/17/docs/specs/jni.
|
|
3
|
+
///!
|
|
4
|
+
///! We don't rely on @import("jni.h") to translate the JNI declarations by several factors:
|
|
5
|
+
///! - Ability to rewrite it using our naming convention and idiomatic Zig pointers
|
|
6
|
+
///! such as ?*, [*], [*:0], ?[*].
|
|
7
|
+
///! - Great stability of the JNI specification makes manual implementation a viable option.
|
|
8
|
+
///! - Licensing issues redistributing the jni.h file (or even translating it).
|
|
9
|
+
///! - To avoid duplicated function definitions by using comptime generated signatures
|
|
10
|
+
///! when calling the function table.
|
|
11
|
+
///! - To mitigate the risk of human error by using explicit vtable indexes instead of a
|
|
12
|
+
///! struct of function pointers sensitive to the fields ordering.
|
|
13
|
+
///!
|
|
14
|
+
///! Additionally, each function is unit tested against a real JVM to validate if they are
|
|
15
|
+
///! calling the correct vtable entry with the expected arguments.
|
|
16
|
+
|
|
17
|
+
// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getversion.
|
|
18
|
+
pub const jni_version_1_1: JInt = 0x00010001;
|
|
19
|
+
pub const jni_version_1_2: JInt = 0x00010002;
|
|
20
|
+
pub const jni_version_1_4: JInt = 0x00010004;
|
|
21
|
+
pub const jni_version_1_6: JInt = 0x00010006;
|
|
22
|
+
pub const jni_version_1_8: JInt = 0x00010008;
|
|
23
|
+
pub const jni_version_9: JInt = 0x00090000;
|
|
24
|
+
pub const jni_version_10: JInt = 0x000a0000;
|
|
25
|
+
|
|
26
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#return-codes.
|
|
27
|
+
pub const JNIResultType = enum(JInt) {
|
|
28
|
+
/// Success.
|
|
29
|
+
ok = 0,
|
|
30
|
+
|
|
31
|
+
/// Unknown error.
|
|
32
|
+
unknown = -1,
|
|
33
|
+
|
|
34
|
+
/// Thread detached from the VM.
|
|
35
|
+
thread_detached = -2,
|
|
36
|
+
|
|
37
|
+
/// JNI version error.
|
|
38
|
+
bad_version = -3,
|
|
39
|
+
|
|
40
|
+
/// Not enough memory.
|
|
41
|
+
out_of_memory = -4,
|
|
42
|
+
|
|
43
|
+
/// VM already created.
|
|
44
|
+
vm_already_exists = -5,
|
|
45
|
+
|
|
46
|
+
/// Invalid arguments.
|
|
47
|
+
invalid_arguments = -6,
|
|
48
|
+
|
|
49
|
+
/// Non exhaustive enum.
|
|
50
|
+
_,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Primitive types:
|
|
54
|
+
// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/types.html#primitive-types.
|
|
55
|
+
|
|
56
|
+
pub const JBoolean = enum(u8) { jni_true = 1, jni_false = 0 };
|
|
57
|
+
pub const JByte = i8;
|
|
58
|
+
pub const JChar = u16;
|
|
59
|
+
pub const JShort = i16;
|
|
60
|
+
pub const JInt = i32;
|
|
61
|
+
pub const JLong = i64;
|
|
62
|
+
pub const JFloat = f32;
|
|
63
|
+
pub const JDouble = f64;
|
|
64
|
+
pub const JSize = JInt;
|
|
65
|
+
|
|
66
|
+
// Reference types:
|
|
67
|
+
// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/types.html#reference-types.
|
|
68
|
+
|
|
69
|
+
pub const JObject = ?*opaque {};
|
|
70
|
+
pub const JClass = JObject;
|
|
71
|
+
pub const JThrowable = JObject;
|
|
72
|
+
pub const JString = JObject;
|
|
73
|
+
pub const JArray = JObject;
|
|
74
|
+
pub const JBooleanArray = JArray;
|
|
75
|
+
pub const JByteArray = JArray;
|
|
76
|
+
pub const JCharArray = JArray;
|
|
77
|
+
pub const JShortArray = JArray;
|
|
78
|
+
pub const JIntArray = JArray;
|
|
79
|
+
pub const JLongArray = JArray;
|
|
80
|
+
pub const JFloatArray = JArray;
|
|
81
|
+
pub const JDoubleArray = JArray;
|
|
82
|
+
pub const JObjectArray = JArray;
|
|
83
|
+
pub const JWeakReference = JObject;
|
|
84
|
+
|
|
85
|
+
// Method and field IDs:
|
|
86
|
+
// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/types.html#field-and-method-ids.
|
|
87
|
+
|
|
88
|
+
pub const JFieldID = ?*opaque {};
|
|
89
|
+
pub const JMethodID = ?*opaque {};
|
|
90
|
+
|
|
91
|
+
/// This union is used as the element type in argument arrays.
|
|
92
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/types.html#the-value-type.
|
|
93
|
+
pub const JValue = extern union {
|
|
94
|
+
object: JObject,
|
|
95
|
+
boolean: JBoolean,
|
|
96
|
+
byte: JByte,
|
|
97
|
+
char: JChar,
|
|
98
|
+
short: JShort,
|
|
99
|
+
int: JInt,
|
|
100
|
+
long: JLong,
|
|
101
|
+
float: JFloat,
|
|
102
|
+
double: JDouble,
|
|
103
|
+
|
|
104
|
+
pub fn to_jvalue(value: anytype) JValue {
|
|
105
|
+
return switch (@TypeOf(value)) {
|
|
106
|
+
JBoolean => .{ .boolean = value },
|
|
107
|
+
JByte => .{ .byte = value },
|
|
108
|
+
JChar => .{ .char = value },
|
|
109
|
+
JShort => .{ .short = value },
|
|
110
|
+
JInt => .{ .int = value },
|
|
111
|
+
JLong => .{ .long = value },
|
|
112
|
+
JFloat => .{ .float = value },
|
|
113
|
+
JDouble => .{ .double = value },
|
|
114
|
+
JObject => .{ .object = value },
|
|
115
|
+
else => unreachable,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/// Mode has no effect if elems is not a copy of the elements in array.
|
|
121
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
122
|
+
pub const JArrayReleaseMode = enum(JInt) {
|
|
123
|
+
/// Copy back the content and free the elems buffer.
|
|
124
|
+
default = 0,
|
|
125
|
+
|
|
126
|
+
/// Copy back the content but do not free the elems buffer.
|
|
127
|
+
commit = 1,
|
|
128
|
+
|
|
129
|
+
/// Free the buffer without copying back the possible changes.
|
|
130
|
+
abort = 2,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getobjectreftype.
|
|
134
|
+
pub const JObjectRefType = enum(JInt) {
|
|
135
|
+
invalid = 0,
|
|
136
|
+
local = 1,
|
|
137
|
+
global = 2,
|
|
138
|
+
weak_global = 3,
|
|
139
|
+
_,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#registernatives.
|
|
143
|
+
pub const JNINativeMethod = extern struct {
|
|
144
|
+
name: [*:0]const u8,
|
|
145
|
+
signature: [*:0]const u8,
|
|
146
|
+
fn_ptr: ?*anyopaque,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
pub const JNIEnv = opaque {
|
|
150
|
+
/// Each function is accessible at a fixed offset through the JNIEnv argument.
|
|
151
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#interface-function-table.
|
|
152
|
+
const FunctionTable = enum(usize) {
|
|
153
|
+
/// Index 4: GetVersion
|
|
154
|
+
get_version = 4,
|
|
155
|
+
|
|
156
|
+
/// Index 5: DefineClass
|
|
157
|
+
define_class = 5,
|
|
158
|
+
|
|
159
|
+
/// Index 6: FindClass
|
|
160
|
+
find_class = 6,
|
|
161
|
+
|
|
162
|
+
/// Index 7: FromReflectedMethod
|
|
163
|
+
from_reflected_method = 7,
|
|
164
|
+
|
|
165
|
+
/// Index 8: FromReflectedField
|
|
166
|
+
from_feflected_field = 8,
|
|
167
|
+
|
|
168
|
+
/// Index 9: ToReflectedMethod
|
|
169
|
+
to_reflected_method = 9,
|
|
170
|
+
|
|
171
|
+
/// Index 10: GetSuperclass
|
|
172
|
+
get_super_class = 10,
|
|
173
|
+
|
|
174
|
+
/// Index 11: IsAssignableFrom
|
|
175
|
+
is_assignable_from = 11,
|
|
176
|
+
|
|
177
|
+
/// Index 12: ToReflectedField
|
|
178
|
+
to_reflected_field = 12,
|
|
179
|
+
|
|
180
|
+
/// Index 13: Throw
|
|
181
|
+
throw = 13,
|
|
182
|
+
|
|
183
|
+
/// Index 14: ThrowNew
|
|
184
|
+
throw_new = 14,
|
|
185
|
+
|
|
186
|
+
/// Index 15: ExceptionOccurred
|
|
187
|
+
exception_occurred = 15,
|
|
188
|
+
|
|
189
|
+
/// Index 16: ExceptionDescribe
|
|
190
|
+
exception_describe = 16,
|
|
191
|
+
|
|
192
|
+
/// Index 17: ExceptionClear
|
|
193
|
+
exception_clear = 17,
|
|
194
|
+
|
|
195
|
+
/// Index 18: FatalError
|
|
196
|
+
fatal_error = 18,
|
|
197
|
+
|
|
198
|
+
/// Index 19: PushLocalFrame
|
|
199
|
+
push_local_frame = 19,
|
|
200
|
+
|
|
201
|
+
/// Index 20: PopLocalFrame
|
|
202
|
+
pop_local_frame = 20,
|
|
203
|
+
|
|
204
|
+
/// Index 21: NewGlobalRef
|
|
205
|
+
new_global_ref = 21,
|
|
206
|
+
|
|
207
|
+
/// Index 22: DeleteGlobalRef
|
|
208
|
+
delete_global_ref = 22,
|
|
209
|
+
|
|
210
|
+
/// Index 23: DeleteLocalRef
|
|
211
|
+
delete_local_ref = 23,
|
|
212
|
+
|
|
213
|
+
/// Index 24: IsSameObject
|
|
214
|
+
is_same_object = 24,
|
|
215
|
+
|
|
216
|
+
/// Index 25: NewLocalRef
|
|
217
|
+
new_local_ref = 25,
|
|
218
|
+
|
|
219
|
+
/// Index 26: EnsureLocalCapacity
|
|
220
|
+
ensure_local_capacity = 26,
|
|
221
|
+
|
|
222
|
+
/// Index 27: AllocObject
|
|
223
|
+
alloc_object = 27,
|
|
224
|
+
|
|
225
|
+
/// Index 28: NewObject
|
|
226
|
+
/// Index 29: NewObjectV
|
|
227
|
+
/// Index 30: NewObjectA
|
|
228
|
+
new_object = 30,
|
|
229
|
+
|
|
230
|
+
/// Index 31: GetObjectClass
|
|
231
|
+
get_object_class = 31,
|
|
232
|
+
|
|
233
|
+
/// Index 32: IsInstanceOf
|
|
234
|
+
is_instance_of = 32,
|
|
235
|
+
|
|
236
|
+
/// Index 33: GetMethodID
|
|
237
|
+
get_method_id = 33,
|
|
238
|
+
|
|
239
|
+
/// Index 34: CallObjectMethod (omitted)
|
|
240
|
+
/// Index 35: CallObjectMethodV (omitted)
|
|
241
|
+
/// Index 36: CallObjectMethodA
|
|
242
|
+
call_object_method = 36,
|
|
243
|
+
|
|
244
|
+
/// Index 37: CallBooleanMethod (omitted)
|
|
245
|
+
/// Index 38: CallBooleanMethodV (omitted)
|
|
246
|
+
/// Index 39: CallBooleanMethodA
|
|
247
|
+
call_boolean_method = 39,
|
|
248
|
+
|
|
249
|
+
/// Index 40: CallByteMethod (omitted)
|
|
250
|
+
/// Index 41: CallByteMethodV (omitted)
|
|
251
|
+
/// Index 42: CallByteMethodA
|
|
252
|
+
call_byte_method = 42,
|
|
253
|
+
|
|
254
|
+
/// Index 43: CallCharMethod (omitted)
|
|
255
|
+
/// Index 44: CallCharMethodV (omitted)
|
|
256
|
+
/// Index 45: CallCharMethodA
|
|
257
|
+
call_char_method = 45,
|
|
258
|
+
|
|
259
|
+
/// Index 46: CallShortMethod (omitted)
|
|
260
|
+
/// Index 47: CallShortMethodV (omitted)
|
|
261
|
+
/// Index 48: CallShortMethodA
|
|
262
|
+
call_short_method = 48,
|
|
263
|
+
|
|
264
|
+
/// Index 49: CallIntMethod (omitted)
|
|
265
|
+
/// Index 50: CallIntMethodV (omitted)
|
|
266
|
+
/// Index 51: CallIntMethodA
|
|
267
|
+
call_int_method = 51,
|
|
268
|
+
|
|
269
|
+
/// Index 52: CallLongMethod (omitted)
|
|
270
|
+
/// Index 53: CallLongMethodV (omitted)
|
|
271
|
+
/// Index 54: CallLongMethodA
|
|
272
|
+
call_long_method = 54,
|
|
273
|
+
|
|
274
|
+
/// Index 55: CallFloatMethod (omitted)
|
|
275
|
+
/// Index 56: CallFloatMethodV (omitted)
|
|
276
|
+
/// Index 57: CallFloatMethodA
|
|
277
|
+
call_float_method = 57,
|
|
278
|
+
|
|
279
|
+
/// Index 58: CallDoubleMethod (omitted)
|
|
280
|
+
/// Index 59: CallDoubleMethodV (omitted)
|
|
281
|
+
/// Index 60: CallDoubleMethodA
|
|
282
|
+
call_double_method = 60,
|
|
283
|
+
|
|
284
|
+
/// Index 61: CallVoidMethod (omitted)
|
|
285
|
+
/// Index 62: CallVoidMethodV (omitted)
|
|
286
|
+
/// Index 63: CallVoidMethodA
|
|
287
|
+
call_void_method = 63,
|
|
288
|
+
|
|
289
|
+
/// Index 64: CallNonvirtualObjectMethod (omitted)
|
|
290
|
+
/// Index 65: CallNonvirtualObjectMethodV (omitted)
|
|
291
|
+
/// Index 66: CallNonvirtualObjectMethodA (omitted)
|
|
292
|
+
call_nonvirtual_object_method = 66,
|
|
293
|
+
|
|
294
|
+
/// Index 67: CallNonvirtualBooleanMethod (omitted)
|
|
295
|
+
/// Index 68: CallNonvirtualBooleanMethodV (omitted)
|
|
296
|
+
/// Index 69: CallNonvirtualBooleanMethodA (omitted)
|
|
297
|
+
call_nonvirtual_boolean_method = 69,
|
|
298
|
+
|
|
299
|
+
/// Index 70: CallNonvirtualByteMethod (omitted)
|
|
300
|
+
/// Index 71: CallNonvirtualByteMethodV (omitted)
|
|
301
|
+
/// Index 72: CallNonvirtualByteMethodA (omitted)
|
|
302
|
+
call_nonvirtual_byte_method = 72,
|
|
303
|
+
|
|
304
|
+
/// Index 73: CallNonvirtualCharMethod (omitted)
|
|
305
|
+
/// Index 74: CallNonvirtualCharMethodV (omitted)
|
|
306
|
+
/// Index 75: CallNonvirtualCharMethodA (omitted)
|
|
307
|
+
call_nonvirtual_char_method = 75,
|
|
308
|
+
|
|
309
|
+
/// Index 76: CallNonvirtualShortMethod (omitted)
|
|
310
|
+
/// Index 77: CallNonvirtualShortMethodV (omitted)
|
|
311
|
+
/// Index 78: CallNonvirtualShortMethodA (omitted)
|
|
312
|
+
call_nonvirtual_short_method = 78,
|
|
313
|
+
|
|
314
|
+
/// Index 79: CallNonvirtualIntMethod (omitted)
|
|
315
|
+
/// Index 80: CallNonvirtualIntMethodV (omitted)
|
|
316
|
+
/// Index 81: CallNonvirtualIntMethodA (omitted)
|
|
317
|
+
call_nonvirtual_int_method = 81,
|
|
318
|
+
|
|
319
|
+
/// Index 82: CallNonvirtualLongMethod (omitted)
|
|
320
|
+
/// Index 83: CallNonvirtualLongMethodV (omitted)
|
|
321
|
+
/// Index 84: CallNonvirtualLongMethodA (omitted)
|
|
322
|
+
call_nonvirtual_long_method = 84,
|
|
323
|
+
|
|
324
|
+
/// Index 85: CallNonvirtualFloatMethod (omitted)
|
|
325
|
+
/// Index 86: CallNonvirtualFloatMethodV (omitted)
|
|
326
|
+
/// Index 87: CallNonvirtualFloatMethodA (omitted)
|
|
327
|
+
call_nonvirtual_float_method = 87,
|
|
328
|
+
|
|
329
|
+
/// Index 88: CallNonvirtualDoubleMethod (omitted)
|
|
330
|
+
/// Index 89: CallNonvirtualDoubleMethodV (omitted)
|
|
331
|
+
/// Index 90: CallNonvirtualDoubleMethodA (omitted)
|
|
332
|
+
call_nonvirtual_double_method = 90,
|
|
333
|
+
|
|
334
|
+
/// Index 91: CallNonvirtualVoidMethod (omitted)
|
|
335
|
+
/// Index 92: CallNonvirtualVoidMethodV (omitted)
|
|
336
|
+
/// Index 93: CallNonvirtualVoidMethodA (omitted)
|
|
337
|
+
call_nonvirtual_void_method = 93,
|
|
338
|
+
|
|
339
|
+
/// Index 94: GetFieldID
|
|
340
|
+
get_field_id = 94,
|
|
341
|
+
|
|
342
|
+
/// Index 95: GetObjectField
|
|
343
|
+
get_object_field = 95,
|
|
344
|
+
|
|
345
|
+
/// Index 96: GetBooleanField
|
|
346
|
+
get_boolean_field = 96,
|
|
347
|
+
|
|
348
|
+
/// Index 97: GetByteField
|
|
349
|
+
get_byte_field = 97,
|
|
350
|
+
|
|
351
|
+
/// Index 98: GetCharField
|
|
352
|
+
get_char_field = 98,
|
|
353
|
+
|
|
354
|
+
/// Index 99: GetShortField
|
|
355
|
+
get_short_field = 99,
|
|
356
|
+
|
|
357
|
+
/// Index 100: GetIntField
|
|
358
|
+
get_int_field = 100,
|
|
359
|
+
|
|
360
|
+
/// Index 101: GetLongField
|
|
361
|
+
get_long_field = 101,
|
|
362
|
+
|
|
363
|
+
/// Index 102: GetFloatField
|
|
364
|
+
get_float_field = 102,
|
|
365
|
+
|
|
366
|
+
/// Index 103: GetDoubleField
|
|
367
|
+
get_double_field = 103,
|
|
368
|
+
|
|
369
|
+
/// Index 104: SetObjectField
|
|
370
|
+
set_object_field = 104,
|
|
371
|
+
|
|
372
|
+
/// Index 105: SetBooleanField
|
|
373
|
+
set_boolean_field = 105,
|
|
374
|
+
|
|
375
|
+
/// Index 106: SetByteField
|
|
376
|
+
set_byte_field = 106,
|
|
377
|
+
|
|
378
|
+
/// Index 107: SetCharField
|
|
379
|
+
set_char_field = 107,
|
|
380
|
+
|
|
381
|
+
/// Index 108: SetShortField
|
|
382
|
+
set_short_field = 108,
|
|
383
|
+
|
|
384
|
+
/// Index 109: SetIntField
|
|
385
|
+
set_int_field = 109,
|
|
386
|
+
|
|
387
|
+
/// Index 110: SetLongField
|
|
388
|
+
set_long_field = 110,
|
|
389
|
+
|
|
390
|
+
/// Index 111: SetFloatField
|
|
391
|
+
set_float_field = 111,
|
|
392
|
+
|
|
393
|
+
/// Index 112: SetDoubleField
|
|
394
|
+
set_double_field = 112,
|
|
395
|
+
|
|
396
|
+
/// Index 113: GetStaticMethodID
|
|
397
|
+
get_static_method_id = 113,
|
|
398
|
+
|
|
399
|
+
/// Index 114: CallStaticObjectMethod (omitted)
|
|
400
|
+
/// Index 115: CallStaticObjectMethodV (omitted)
|
|
401
|
+
/// Index 116: CallStaticObjectMethodA
|
|
402
|
+
call_static_object_method = 116,
|
|
403
|
+
|
|
404
|
+
/// Index 117: CallStaticBooleanMethod (omitted)
|
|
405
|
+
/// Index 118: CallStaticBooleanMethodV (omitted)
|
|
406
|
+
/// Index 119: CallStaticBooleanMethodA
|
|
407
|
+
call_static_boolean_method = 119,
|
|
408
|
+
|
|
409
|
+
/// Index 120: CallStaticBooleanMethod (omitted)
|
|
410
|
+
/// Index 121: CallStaticBooleanMethodV (omitted)
|
|
411
|
+
/// Index 122: CallStaticBooleanMethodA
|
|
412
|
+
call_static_byte_method = 122,
|
|
413
|
+
|
|
414
|
+
/// Index 123: CallStaticCharMethod (omitted)
|
|
415
|
+
/// Index 124: CallStaticCharMethodV (omitted)
|
|
416
|
+
/// Index 125: CallStaticCharMethodA
|
|
417
|
+
call_static_char_method = 125,
|
|
418
|
+
|
|
419
|
+
/// Index 126: CallStaticCharMethod (omitted)
|
|
420
|
+
/// Index 127: CallStaticCharMethodV (omitted)
|
|
421
|
+
/// Index 128: CallStaticCharMethodA
|
|
422
|
+
call_static_short_method = 128,
|
|
423
|
+
|
|
424
|
+
/// Index 129: CallStaticIntMethod (omitted)
|
|
425
|
+
/// Index 130: CallStaticIntMethodV (omitted)
|
|
426
|
+
/// Index 131: CallStaticIntMethodA
|
|
427
|
+
call_static_int_method = 131,
|
|
428
|
+
|
|
429
|
+
/// Index 132: CallStaticLongMethod (omitted)
|
|
430
|
+
/// Index 133: CallStaticLongMethodV (omitted)
|
|
431
|
+
/// Index 134: CallStaticLongMethodA
|
|
432
|
+
call_static_long_method = 134,
|
|
433
|
+
|
|
434
|
+
/// Index 135: CallStaticFloatMethod (omitted)
|
|
435
|
+
/// Index 136: CallStaticFloatMethodV (omitted)
|
|
436
|
+
/// Index 137: CallStaticFloatMethodA
|
|
437
|
+
call_static_float_method = 137,
|
|
438
|
+
|
|
439
|
+
/// Index 138: CallStaticDoubleMethod (omitted)
|
|
440
|
+
/// Index 139: CallStaticDoubleMethodV (omitted)
|
|
441
|
+
/// Index 140: CallStaticDoubleMethodA
|
|
442
|
+
call_static_double_method = 140,
|
|
443
|
+
|
|
444
|
+
/// Index 141: CallStaticVoidMethod (omitted)
|
|
445
|
+
/// Index 142: CallStaticVoidMethodV (omitted)
|
|
446
|
+
/// Index 143: CallStaticVoidMethodA
|
|
447
|
+
call_static_void_method = 143,
|
|
448
|
+
|
|
449
|
+
/// Index 144: GetStaticFieldID
|
|
450
|
+
get_static_field_id = 144,
|
|
451
|
+
|
|
452
|
+
/// Index 145: GetStaticObjectField
|
|
453
|
+
get_static_object_field = 145,
|
|
454
|
+
|
|
455
|
+
/// Index 146: GetStaticBooleanField
|
|
456
|
+
get_static_boolean_field = 146,
|
|
457
|
+
|
|
458
|
+
/// Index 147: GetStaticByteField
|
|
459
|
+
get_static_byte_field = 147,
|
|
460
|
+
|
|
461
|
+
/// Index 148: GetStaticCharField
|
|
462
|
+
get_static_char_field = 148,
|
|
463
|
+
|
|
464
|
+
/// Index 149: GetStaticShortField
|
|
465
|
+
get_static_short_field = 149,
|
|
466
|
+
|
|
467
|
+
/// Index 150: GetStaticIntField
|
|
468
|
+
get_static_int_field = 150,
|
|
469
|
+
|
|
470
|
+
/// Index 151: GetStaticLongField
|
|
471
|
+
get_static_long_field = 151,
|
|
472
|
+
|
|
473
|
+
/// Index 152: GetStaticFloatField
|
|
474
|
+
/// Returns the value of a static field of an object.
|
|
475
|
+
get_static_float_field = 152,
|
|
476
|
+
|
|
477
|
+
/// Index 153: GetStaticDoubleField
|
|
478
|
+
get_static_double_field = 153,
|
|
479
|
+
|
|
480
|
+
/// Index 154: SetStaticObjectField
|
|
481
|
+
set_static_object_field = 154,
|
|
482
|
+
|
|
483
|
+
/// Index 155: SetStaticBooleanField
|
|
484
|
+
set_static_boolean_field = 155,
|
|
485
|
+
|
|
486
|
+
/// Index 156: SetStaticByteField
|
|
487
|
+
/// Sets the value of a static field of an object.
|
|
488
|
+
set_static_byte_field = 156,
|
|
489
|
+
|
|
490
|
+
/// Index 157: SetStaticCharField
|
|
491
|
+
set_static_char_field = 157,
|
|
492
|
+
|
|
493
|
+
/// Index 158: SetStaticShortField
|
|
494
|
+
set_static_short_field = 158,
|
|
495
|
+
|
|
496
|
+
/// Index 159: SetStaticIntField
|
|
497
|
+
set_static_int_field = 159,
|
|
498
|
+
|
|
499
|
+
/// Index 160: SetStaticLongField
|
|
500
|
+
set_static_long_field = 160,
|
|
501
|
+
|
|
502
|
+
/// Index 161: SetStaticFloatField
|
|
503
|
+
set_static_float_field = 161,
|
|
504
|
+
|
|
505
|
+
/// Index 162: SetStaticDoubleField
|
|
506
|
+
set_static_double_field = 162,
|
|
507
|
+
|
|
508
|
+
/// Index 163: NewString
|
|
509
|
+
new_string = 163,
|
|
510
|
+
|
|
511
|
+
/// Index 164: GetStringLength
|
|
512
|
+
get_string_length = 164,
|
|
513
|
+
|
|
514
|
+
/// Index 165: GetStringChars
|
|
515
|
+
get_string_chars = 165,
|
|
516
|
+
|
|
517
|
+
/// Index 166: ReleaseStringChars
|
|
518
|
+
release_string_chars = 166,
|
|
519
|
+
|
|
520
|
+
/// Index 167: NewStringUTF
|
|
521
|
+
new_string_utf = 167,
|
|
522
|
+
|
|
523
|
+
/// Index 168: GetStringUTFLength
|
|
524
|
+
get_string_utf_length = 168,
|
|
525
|
+
|
|
526
|
+
/// Index 169: GetStringUTFChars
|
|
527
|
+
get_string_utf_chars = 169,
|
|
528
|
+
|
|
529
|
+
/// Index 170: ReleaseStringUTFChars
|
|
530
|
+
release_string_utf_chars = 170,
|
|
531
|
+
|
|
532
|
+
/// Index 171: GetArrayLength
|
|
533
|
+
get_array_length = 171,
|
|
534
|
+
|
|
535
|
+
/// Index 172: NewObjectArray
|
|
536
|
+
new_object_array = 172,
|
|
537
|
+
|
|
538
|
+
/// Index 173: GetObjectArrayElement
|
|
539
|
+
get_object_array_element = 173,
|
|
540
|
+
|
|
541
|
+
/// Index 174: SetObjectArrayElement
|
|
542
|
+
set_object_array_element = 174,
|
|
543
|
+
|
|
544
|
+
/// Index 175: NewBooleanArray
|
|
545
|
+
new_boolean_array = 175,
|
|
546
|
+
|
|
547
|
+
/// Index 176: NewByteArray
|
|
548
|
+
new_byte_array = 176,
|
|
549
|
+
|
|
550
|
+
/// Index 177: NewCharArray
|
|
551
|
+
new_char_array = 177,
|
|
552
|
+
|
|
553
|
+
/// Index 178: NewShortArray
|
|
554
|
+
new_short_array = 178,
|
|
555
|
+
|
|
556
|
+
/// Index 179: NewIntArray
|
|
557
|
+
new_int_array = 179,
|
|
558
|
+
|
|
559
|
+
/// Index 180: NewLongArray
|
|
560
|
+
new_long_array = 180,
|
|
561
|
+
|
|
562
|
+
/// Index 181: NewFloatArray
|
|
563
|
+
new_float_array = 181,
|
|
564
|
+
|
|
565
|
+
/// Index 182: NewDoubleArray
|
|
566
|
+
new_double_array = 182,
|
|
567
|
+
|
|
568
|
+
/// Index 183: GetBooleanArrayElements
|
|
569
|
+
get_boolean_array_elements = 183,
|
|
570
|
+
|
|
571
|
+
/// Index 184: GetByteArrayElements
|
|
572
|
+
get_byte_array_elements = 184,
|
|
573
|
+
|
|
574
|
+
/// Index 185: GetCharArrayElements
|
|
575
|
+
get_char_array_elements = 185,
|
|
576
|
+
|
|
577
|
+
/// Index 186: GetShortArrayElements
|
|
578
|
+
get_short_array_elements = 186,
|
|
579
|
+
|
|
580
|
+
/// Index 187: GetIntArrayElements
|
|
581
|
+
get_int_array_elements = 187,
|
|
582
|
+
|
|
583
|
+
/// Index 188: GetLongArrayElements
|
|
584
|
+
get_long_array_elements = 188,
|
|
585
|
+
|
|
586
|
+
/// Index 189: GetFloatArrayElements
|
|
587
|
+
get_float_array_elements = 189,
|
|
588
|
+
|
|
589
|
+
/// Index 190: GetDoubleArrayElements
|
|
590
|
+
get_double_array_elements = 190,
|
|
591
|
+
|
|
592
|
+
/// Index 191: ReleaseBooleanArrayElements
|
|
593
|
+
release_boolean_array_elements = 191,
|
|
594
|
+
|
|
595
|
+
/// Index 192: ReleaseByteArrayElements
|
|
596
|
+
release_byte_array_elements = 192,
|
|
597
|
+
|
|
598
|
+
/// Index 193: ReleaseCharArrayElements
|
|
599
|
+
release_char_array_elements = 193,
|
|
600
|
+
|
|
601
|
+
/// Index 194: ReleaseShortArrayElements
|
|
602
|
+
release_short_array_elements = 194,
|
|
603
|
+
|
|
604
|
+
/// Index 195: ReleaseIntArrayElements
|
|
605
|
+
release_int_array_elements = 195,
|
|
606
|
+
|
|
607
|
+
/// Index 196: ReleaseLongArrayElements
|
|
608
|
+
release_long_array_elements = 196,
|
|
609
|
+
|
|
610
|
+
/// Index 197: ReleaseFloatArrayElements
|
|
611
|
+
release_float_array_elements = 197,
|
|
612
|
+
|
|
613
|
+
/// Index 198: ReleaseDoubleArrayElements
|
|
614
|
+
release_double_array_elements = 198,
|
|
615
|
+
|
|
616
|
+
/// Index 199: GetBooleanArrayRegion
|
|
617
|
+
get_boolean_array_region = 199,
|
|
618
|
+
|
|
619
|
+
/// Index 200: GetByteArrayRegion
|
|
620
|
+
get_byte_array_region = 200,
|
|
621
|
+
|
|
622
|
+
/// Index 201: GetCharArrayRegion
|
|
623
|
+
get_char_array_region = 201,
|
|
624
|
+
|
|
625
|
+
/// Index 202: GetShortArrayRegion
|
|
626
|
+
get_short_array_region = 202,
|
|
627
|
+
|
|
628
|
+
/// Index 203: GetIntArrayRegion
|
|
629
|
+
get_int_array_region = 203,
|
|
630
|
+
|
|
631
|
+
/// Index 204: GetLongArrayRegion
|
|
632
|
+
get_long_array_region = 204,
|
|
633
|
+
|
|
634
|
+
/// Index 205: GetFloatArrayRegion
|
|
635
|
+
get_float_array_region = 205,
|
|
636
|
+
|
|
637
|
+
/// Index 206: GetDoubleArrayRegion
|
|
638
|
+
get_double_array_region = 206,
|
|
639
|
+
|
|
640
|
+
/// Index 207: SetBooleanArrayRegion
|
|
641
|
+
set_boolean_array_region = 207,
|
|
642
|
+
|
|
643
|
+
/// Index 208: SetByteArrayRegion
|
|
644
|
+
set_byte_array_region = 208,
|
|
645
|
+
|
|
646
|
+
/// Index 209: SetCharArrayRegion
|
|
647
|
+
set_char_array_region = 209,
|
|
648
|
+
|
|
649
|
+
/// Index 210: SetShortArrayRegion
|
|
650
|
+
set_short_array_region = 210,
|
|
651
|
+
|
|
652
|
+
/// Index 211: SetIntArrayRegion
|
|
653
|
+
set_int_array_region = 211,
|
|
654
|
+
|
|
655
|
+
/// Index 212: SetLongArrayRegion
|
|
656
|
+
set_long_array_region = 212,
|
|
657
|
+
|
|
658
|
+
/// Index 213: SetFloatArrayRegion
|
|
659
|
+
set_float_array_region = 213,
|
|
660
|
+
|
|
661
|
+
/// Index 214: SetDoubleArrayRegion
|
|
662
|
+
set_double_array_region = 214,
|
|
663
|
+
|
|
664
|
+
/// Index 215: RegisterNatives
|
|
665
|
+
register_natives = 215,
|
|
666
|
+
|
|
667
|
+
/// Index 216: UnregisterNatives
|
|
668
|
+
unregister_natives = 216,
|
|
669
|
+
|
|
670
|
+
/// Index 217: MonitorEnter
|
|
671
|
+
monitor_enter = 217,
|
|
672
|
+
|
|
673
|
+
/// Index 218: MonitorExit
|
|
674
|
+
monitor_exit = 218,
|
|
675
|
+
|
|
676
|
+
/// GetJavaVM - Index 219 in the JNIEnv interface function table
|
|
677
|
+
get_java_vm = 219,
|
|
678
|
+
|
|
679
|
+
/// Index 220: GetStringRegion
|
|
680
|
+
get_string_region = 220,
|
|
681
|
+
|
|
682
|
+
/// Index 221: GetStringUTFRegion
|
|
683
|
+
get_string_utf_region = 221,
|
|
684
|
+
|
|
685
|
+
/// Index 222: GetPrimitiveArrayCritical
|
|
686
|
+
get_primitive_array_critical = 222,
|
|
687
|
+
|
|
688
|
+
/// Index 223: ReleasePrimitiveArrayCritical
|
|
689
|
+
release_primitive_array_critical = 223,
|
|
690
|
+
|
|
691
|
+
/// Index 224: GetStringCritical
|
|
692
|
+
get_string_critical = 224,
|
|
693
|
+
|
|
694
|
+
/// Index 225: ReleaseStringCritical
|
|
695
|
+
release_string_critical = 225,
|
|
696
|
+
|
|
697
|
+
/// Index 226: NewWeakGlobalRef
|
|
698
|
+
new_weak_global_ref = 226,
|
|
699
|
+
|
|
700
|
+
/// Index 227: DeleteWeakGlobalRef
|
|
701
|
+
delete_weak_global_ref = 227,
|
|
702
|
+
|
|
703
|
+
/// Index 228: ExceptionCheck
|
|
704
|
+
exception_check = 228,
|
|
705
|
+
|
|
706
|
+
/// Index 229: NewDirectByteBuffer
|
|
707
|
+
new_direct_byte_buffer = 229,
|
|
708
|
+
|
|
709
|
+
/// Index 230: GetDirectBufferAddress
|
|
710
|
+
get_direct_buffer_address = 230,
|
|
711
|
+
|
|
712
|
+
/// GetDirectBufferCapacity - Index 231 in the JNIEnv interface function table
|
|
713
|
+
get_direct_buffer_capacity = 231,
|
|
714
|
+
|
|
715
|
+
/// Index 232: GetObjectRefType
|
|
716
|
+
get_object_ref_type = 232,
|
|
717
|
+
|
|
718
|
+
/// Index 233: GetModule
|
|
719
|
+
get_module = 233,
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
const JNIInterface = JNIInterfaceType(JNIEnv);
|
|
723
|
+
|
|
724
|
+
/// Returns the major version number in the higher 16 bits
|
|
725
|
+
/// and the minor version number in the lower 16 bits.
|
|
726
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getversion.
|
|
727
|
+
pub inline fn get_version(
|
|
728
|
+
env: *JNIEnv,
|
|
729
|
+
) JInt {
|
|
730
|
+
return JNIInterface.call(
|
|
731
|
+
env,
|
|
732
|
+
.get_version,
|
|
733
|
+
.{},
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#defineclass.
|
|
738
|
+
pub inline fn define_class(
|
|
739
|
+
env: *JNIEnv,
|
|
740
|
+
name: [*:0]const u8,
|
|
741
|
+
loader: JObject,
|
|
742
|
+
buf: [*]const JByte,
|
|
743
|
+
buf_len: JSize,
|
|
744
|
+
) JClass {
|
|
745
|
+
return JNIInterface.call(
|
|
746
|
+
env,
|
|
747
|
+
.define_class,
|
|
748
|
+
.{ name, loader, buf, buf_len },
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/// The name argument is a fully-qualified class name or an array type signature.
|
|
753
|
+
/// For example "java/lang/String"
|
|
754
|
+
/// Returns a class object from a fully-qualified name, or NULL if the class cannot be found.
|
|
755
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#findclass.
|
|
756
|
+
pub inline fn find_class(
|
|
757
|
+
env: *JNIEnv,
|
|
758
|
+
name: [*:0]const u8,
|
|
759
|
+
) JClass {
|
|
760
|
+
return JNIInterface.call(
|
|
761
|
+
env,
|
|
762
|
+
.find_class,
|
|
763
|
+
.{name},
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#fromreflectedmethod
|
|
768
|
+
pub inline fn from_reflected_method(
|
|
769
|
+
env: *JNIEnv,
|
|
770
|
+
jobject: JObject,
|
|
771
|
+
) JMethodID {
|
|
772
|
+
return JNIInterface.call(
|
|
773
|
+
env,
|
|
774
|
+
.from_reflected_method,
|
|
775
|
+
.{jobject},
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#fromfeflectedfield
|
|
780
|
+
pub inline fn from_feflected_field(
|
|
781
|
+
env: *JNIEnv,
|
|
782
|
+
jobject: JObject,
|
|
783
|
+
) JFieldID {
|
|
784
|
+
return JNIInterface.call(
|
|
785
|
+
env,
|
|
786
|
+
.from_feflected_field,
|
|
787
|
+
.{jobject},
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#toreflectedmethod
|
|
792
|
+
pub inline fn to_reflected_method(
|
|
793
|
+
env: *JNIEnv,
|
|
794
|
+
cls: JClass,
|
|
795
|
+
method_id: JMethodID,
|
|
796
|
+
is_static: JBoolean,
|
|
797
|
+
) JObject {
|
|
798
|
+
return JNIInterface.call(
|
|
799
|
+
env,
|
|
800
|
+
.to_reflected_method,
|
|
801
|
+
.{ cls, method_id, is_static },
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getsuperclass.
|
|
806
|
+
pub inline fn get_super_class(
|
|
807
|
+
env: *JNIEnv,
|
|
808
|
+
clazz: JClass,
|
|
809
|
+
) JClass {
|
|
810
|
+
return JNIInterface.call(
|
|
811
|
+
env,
|
|
812
|
+
.get_super_class,
|
|
813
|
+
.{clazz},
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#isassignablefrom.
|
|
818
|
+
pub inline fn is_assignable_from(
|
|
819
|
+
env: *JNIEnv,
|
|
820
|
+
clazz_1: JClass,
|
|
821
|
+
clazz_2: JClass,
|
|
822
|
+
) JBoolean {
|
|
823
|
+
return JNIInterface.call(
|
|
824
|
+
env,
|
|
825
|
+
.is_assignable_from,
|
|
826
|
+
.{ clazz_1, clazz_2 },
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#toreflectedfield.
|
|
831
|
+
pub inline fn to_reflected_field(
|
|
832
|
+
env: *JNIEnv,
|
|
833
|
+
cls: JClass,
|
|
834
|
+
field_id: JFieldID,
|
|
835
|
+
is_static: JBoolean,
|
|
836
|
+
) JObject {
|
|
837
|
+
return JNIInterface.call(
|
|
838
|
+
env,
|
|
839
|
+
.to_reflected_field,
|
|
840
|
+
.{ cls, field_id, is_static },
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#throw.
|
|
845
|
+
pub inline fn throw(
|
|
846
|
+
env: *JNIEnv,
|
|
847
|
+
obj: JThrowable,
|
|
848
|
+
) JNIResultType {
|
|
849
|
+
return JNIInterface.call(
|
|
850
|
+
env,
|
|
851
|
+
.throw,
|
|
852
|
+
.{obj},
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#thrownew.
|
|
857
|
+
pub inline fn throw_new(
|
|
858
|
+
env: *JNIEnv,
|
|
859
|
+
clazz: JClass,
|
|
860
|
+
message: ?[*:0]const u8,
|
|
861
|
+
) JNIResultType {
|
|
862
|
+
return JNIInterface.call(
|
|
863
|
+
env,
|
|
864
|
+
.throw_new,
|
|
865
|
+
.{ clazz, message },
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/// Returns the exception object that is currently in the process of being thrown,
|
|
870
|
+
/// or NULL if no exception is currently being thrown.
|
|
871
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#exceptionoccurred.
|
|
872
|
+
pub inline fn exception_occurred(
|
|
873
|
+
env: *JNIEnv,
|
|
874
|
+
) JThrowable {
|
|
875
|
+
return JNIInterface.call(
|
|
876
|
+
env,
|
|
877
|
+
.exception_occurred,
|
|
878
|
+
.{},
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/// Prints an exception and a backtrace of the stack to a system error-reporting channel,
|
|
883
|
+
/// such as stderr. This is a convenience routine provided for debugging.
|
|
884
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#exceptiondescribe.
|
|
885
|
+
pub inline fn exception_describe(
|
|
886
|
+
env: *JNIEnv,
|
|
887
|
+
) void {
|
|
888
|
+
JNIInterface.call(
|
|
889
|
+
env,
|
|
890
|
+
.exception_describe,
|
|
891
|
+
.{},
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/// Clears any exception that is currently being thrown.
|
|
896
|
+
/// If no exception is currently being thrown, this routine has no effect.
|
|
897
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#exceptionclear.
|
|
898
|
+
pub inline fn exception_clear(
|
|
899
|
+
env: *JNIEnv,
|
|
900
|
+
) void {
|
|
901
|
+
JNIInterface.call(
|
|
902
|
+
env,
|
|
903
|
+
.exception_clear,
|
|
904
|
+
.{},
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/// Raises a fatal error and does not expect the VM to recover.
|
|
909
|
+
/// This function does not return.
|
|
910
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#fatalerror.
|
|
911
|
+
pub inline fn fatal_error(
|
|
912
|
+
env: *JNIEnv,
|
|
913
|
+
msg: [*:0]const u8,
|
|
914
|
+
) noreturn {
|
|
915
|
+
JNIInterface.call(
|
|
916
|
+
env,
|
|
917
|
+
.fatal_error,
|
|
918
|
+
.{msg},
|
|
919
|
+
);
|
|
920
|
+
unreachable;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#pushlocalframe.
|
|
924
|
+
pub inline fn push_local_frame(
|
|
925
|
+
env: *JNIEnv,
|
|
926
|
+
capacity: JInt,
|
|
927
|
+
) JNIResultType {
|
|
928
|
+
return JNIInterface.call(
|
|
929
|
+
env,
|
|
930
|
+
.push_local_frame,
|
|
931
|
+
.{capacity},
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#poplocalframe.
|
|
936
|
+
pub inline fn pop_local_frame(
|
|
937
|
+
env: *JNIEnv,
|
|
938
|
+
result: JObject,
|
|
939
|
+
) JObject {
|
|
940
|
+
return JNIInterface.call(
|
|
941
|
+
env,
|
|
942
|
+
.pop_local_frame,
|
|
943
|
+
.{result},
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/// Returns a global reference to the given obj.
|
|
948
|
+
/// May return NULL if:
|
|
949
|
+
/// - obj refers to null;
|
|
950
|
+
/// - the system has run out of memory;
|
|
951
|
+
/// - obj was a weak global reference and has already been garbage collected.
|
|
952
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newglobalref.
|
|
953
|
+
pub inline fn new_global_ref(
|
|
954
|
+
env: *JNIEnv,
|
|
955
|
+
obj: JObject,
|
|
956
|
+
) JObject {
|
|
957
|
+
return JNIInterface.call(
|
|
958
|
+
env,
|
|
959
|
+
.new_global_ref,
|
|
960
|
+
.{obj},
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#deleteglobalref.
|
|
965
|
+
pub inline fn delete_global_ref(
|
|
966
|
+
env: *JNIEnv,
|
|
967
|
+
global_ref: JObject,
|
|
968
|
+
) void {
|
|
969
|
+
JNIInterface.call(
|
|
970
|
+
env,
|
|
971
|
+
.delete_global_ref,
|
|
972
|
+
.{global_ref},
|
|
973
|
+
);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#deletelocalref.
|
|
977
|
+
pub inline fn delete_local_ref(
|
|
978
|
+
env: *JNIEnv,
|
|
979
|
+
local_ref: JObject,
|
|
980
|
+
) void {
|
|
981
|
+
JNIInterface.call(
|
|
982
|
+
env,
|
|
983
|
+
.delete_local_ref,
|
|
984
|
+
.{local_ref},
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#issameobject.
|
|
989
|
+
pub inline fn is_same_object(
|
|
990
|
+
env: *JNIEnv,
|
|
991
|
+
ref_1: JObject,
|
|
992
|
+
ref_2: JObject,
|
|
993
|
+
) JBoolean {
|
|
994
|
+
return JNIInterface.call(
|
|
995
|
+
env,
|
|
996
|
+
.is_same_object,
|
|
997
|
+
.{ ref_1, ref_2 },
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/// Returns NULL if ref refers to null.
|
|
1002
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newlocalref.
|
|
1003
|
+
pub inline fn new_local_ref(
|
|
1004
|
+
env: *JNIEnv,
|
|
1005
|
+
ref: JObject,
|
|
1006
|
+
) JObject {
|
|
1007
|
+
return JNIInterface.call(
|
|
1008
|
+
env,
|
|
1009
|
+
.new_local_ref,
|
|
1010
|
+
.{ref},
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#ensurelocalcapacity.
|
|
1015
|
+
pub inline fn ensure_local_capacity(
|
|
1016
|
+
env: *JNIEnv,
|
|
1017
|
+
capacity: JInt,
|
|
1018
|
+
) JNIResultType {
|
|
1019
|
+
return JNIInterface.call(
|
|
1020
|
+
env,
|
|
1021
|
+
.ensure_local_capacity,
|
|
1022
|
+
.{capacity},
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/// Allocates a new Java object *without* invoking the constructor.
|
|
1027
|
+
/// Returns a reference to the object.
|
|
1028
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#allocobject.
|
|
1029
|
+
pub inline fn alloc_object(
|
|
1030
|
+
env: *JNIEnv,
|
|
1031
|
+
clazz: JClass,
|
|
1032
|
+
) JObject {
|
|
1033
|
+
return JNIInterface.call(
|
|
1034
|
+
env,
|
|
1035
|
+
.alloc_object,
|
|
1036
|
+
.{clazz},
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/// Returns a Java object, or NULL if the object cannot be constructed.
|
|
1041
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newobject.
|
|
1042
|
+
pub inline fn new_object(
|
|
1043
|
+
env: *JNIEnv,
|
|
1044
|
+
clazz: JClass,
|
|
1045
|
+
method_id: JMethodID,
|
|
1046
|
+
args: ?[*]const JValue,
|
|
1047
|
+
) JObject {
|
|
1048
|
+
return JNIInterface.call(
|
|
1049
|
+
env,
|
|
1050
|
+
.new_object,
|
|
1051
|
+
.{ clazz, method_id, args },
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getobjectclass.
|
|
1056
|
+
pub inline fn get_object_class(
|
|
1057
|
+
env: *JNIEnv,
|
|
1058
|
+
jobject: JObject,
|
|
1059
|
+
) JClass {
|
|
1060
|
+
return JNIInterface.call(
|
|
1061
|
+
env,
|
|
1062
|
+
.get_object_class,
|
|
1063
|
+
.{jobject},
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#isinstanceof.
|
|
1068
|
+
pub inline fn is_instance_of(
|
|
1069
|
+
env: *JNIEnv,
|
|
1070
|
+
jobject: JObject,
|
|
1071
|
+
clazz: JClass,
|
|
1072
|
+
) JBoolean {
|
|
1073
|
+
return JNIInterface.call(
|
|
1074
|
+
env,
|
|
1075
|
+
.is_instance_of,
|
|
1076
|
+
.{ jobject, clazz },
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getmethodid.
|
|
1081
|
+
pub inline fn get_method_id(
|
|
1082
|
+
env: *JNIEnv,
|
|
1083
|
+
clazz: JClass,
|
|
1084
|
+
name: [*:0]const u8,
|
|
1085
|
+
sig: [*:0]const u8,
|
|
1086
|
+
) JMethodID {
|
|
1087
|
+
return JNIInterface.call(
|
|
1088
|
+
env,
|
|
1089
|
+
.get_method_id,
|
|
1090
|
+
.{ clazz, name, sig },
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1095
|
+
pub inline fn call_object_method(
|
|
1096
|
+
env: *JNIEnv,
|
|
1097
|
+
obj: JObject,
|
|
1098
|
+
method_id: JMethodID,
|
|
1099
|
+
args: ?[*]const JValue,
|
|
1100
|
+
) JObject {
|
|
1101
|
+
return JNIInterface.call(
|
|
1102
|
+
env,
|
|
1103
|
+
.call_object_method,
|
|
1104
|
+
.{ obj, method_id, args },
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1109
|
+
pub inline fn call_boolean_method(
|
|
1110
|
+
env: *JNIEnv,
|
|
1111
|
+
obj: JObject,
|
|
1112
|
+
method_id: JMethodID,
|
|
1113
|
+
args: ?[*]const JValue,
|
|
1114
|
+
) JBoolean {
|
|
1115
|
+
return JNIInterface.call(
|
|
1116
|
+
env,
|
|
1117
|
+
.call_boolean_method,
|
|
1118
|
+
.{ obj, method_id, args },
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1123
|
+
pub inline fn call_byte_method(
|
|
1124
|
+
env: *JNIEnv,
|
|
1125
|
+
obj: JObject,
|
|
1126
|
+
method_id: JMethodID,
|
|
1127
|
+
args: ?[*]const JValue,
|
|
1128
|
+
) JByte {
|
|
1129
|
+
return JNIInterface.call(
|
|
1130
|
+
env,
|
|
1131
|
+
.call_byte_method,
|
|
1132
|
+
.{ obj, method_id, args },
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1137
|
+
pub inline fn call_char_method(
|
|
1138
|
+
env: *JNIEnv,
|
|
1139
|
+
obj: JObject,
|
|
1140
|
+
method_id: JMethodID,
|
|
1141
|
+
args: ?[*]const JValue,
|
|
1142
|
+
) JChar {
|
|
1143
|
+
return JNIInterface.call(
|
|
1144
|
+
env,
|
|
1145
|
+
.call_char_method,
|
|
1146
|
+
.{ obj, method_id, args },
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1151
|
+
pub inline fn call_short_method(
|
|
1152
|
+
env: *JNIEnv,
|
|
1153
|
+
obj: JObject,
|
|
1154
|
+
method_id: JMethodID,
|
|
1155
|
+
args: ?[*]const JValue,
|
|
1156
|
+
) JShort {
|
|
1157
|
+
return JNIInterface.call(
|
|
1158
|
+
env,
|
|
1159
|
+
.call_short_method,
|
|
1160
|
+
.{ obj, method_id, args },
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1165
|
+
pub inline fn call_int_method(
|
|
1166
|
+
env: *JNIEnv,
|
|
1167
|
+
obj: JObject,
|
|
1168
|
+
method_id: JMethodID,
|
|
1169
|
+
args: ?[*]const JValue,
|
|
1170
|
+
) JInt {
|
|
1171
|
+
return JNIInterface.call(
|
|
1172
|
+
env,
|
|
1173
|
+
.call_int_method,
|
|
1174
|
+
.{ obj, method_id, args },
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1179
|
+
pub inline fn call_long_method(
|
|
1180
|
+
env: *JNIEnv,
|
|
1181
|
+
obj: JObject,
|
|
1182
|
+
method_id: JMethodID,
|
|
1183
|
+
args: ?[*]const JValue,
|
|
1184
|
+
) JLong {
|
|
1185
|
+
return JNIInterface.call(
|
|
1186
|
+
env,
|
|
1187
|
+
.call_long_method,
|
|
1188
|
+
.{ obj, method_id, args },
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1193
|
+
pub inline fn call_float_method(
|
|
1194
|
+
env: *JNIEnv,
|
|
1195
|
+
obj: JObject,
|
|
1196
|
+
method_id: JMethodID,
|
|
1197
|
+
args: ?[*]const JValue,
|
|
1198
|
+
) JFloat {
|
|
1199
|
+
return JNIInterface.call(
|
|
1200
|
+
env,
|
|
1201
|
+
.call_float_method,
|
|
1202
|
+
.{ obj, method_id, args },
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1207
|
+
pub inline fn call_double_method(
|
|
1208
|
+
env: *JNIEnv,
|
|
1209
|
+
obj: JObject,
|
|
1210
|
+
method_id: JMethodID,
|
|
1211
|
+
args: ?[*]const JValue,
|
|
1212
|
+
) JDouble {
|
|
1213
|
+
return JNIInterface.call(
|
|
1214
|
+
env,
|
|
1215
|
+
.call_double_method,
|
|
1216
|
+
.{ obj, method_id, args },
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#calltypemethod-routines-calltypemethoda-routines-calltypemethodv-routines.
|
|
1221
|
+
pub inline fn call_void_method(
|
|
1222
|
+
env: *JNIEnv,
|
|
1223
|
+
obj: JObject,
|
|
1224
|
+
method_id: JMethodID,
|
|
1225
|
+
args: ?[*]const JValue,
|
|
1226
|
+
) void {
|
|
1227
|
+
JNIInterface.call(
|
|
1228
|
+
env,
|
|
1229
|
+
.call_void_method,
|
|
1230
|
+
.{ obj, method_id, args },
|
|
1231
|
+
);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1235
|
+
pub inline fn call_nonvirtual_object_method(
|
|
1236
|
+
env: *JNIEnv,
|
|
1237
|
+
obj: JObject,
|
|
1238
|
+
clazz: JClass,
|
|
1239
|
+
method_id: JMethodID,
|
|
1240
|
+
args: ?[*]const JValue,
|
|
1241
|
+
) JObject {
|
|
1242
|
+
return JNIInterface.call(
|
|
1243
|
+
env,
|
|
1244
|
+
.call_nonvirtual_object_method,
|
|
1245
|
+
.{ obj, clazz, method_id, args },
|
|
1246
|
+
);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1250
|
+
pub inline fn call_nonvirtual_boolean_method(
|
|
1251
|
+
env: *JNIEnv,
|
|
1252
|
+
obj: JObject,
|
|
1253
|
+
clazz: JClass,
|
|
1254
|
+
method_id: JMethodID,
|
|
1255
|
+
args: ?[*]const JValue,
|
|
1256
|
+
) JBoolean {
|
|
1257
|
+
return JNIInterface.call(
|
|
1258
|
+
env,
|
|
1259
|
+
.call_nonvirtual_boolean_method,
|
|
1260
|
+
.{ obj, clazz, method_id, args },
|
|
1261
|
+
);
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1265
|
+
pub inline fn call_nonvirtual_byte_method(
|
|
1266
|
+
env: *JNIEnv,
|
|
1267
|
+
obj: JObject,
|
|
1268
|
+
clazz: JClass,
|
|
1269
|
+
method_id: JMethodID,
|
|
1270
|
+
args: ?[*]const JValue,
|
|
1271
|
+
) JByte {
|
|
1272
|
+
return JNIInterface.call(
|
|
1273
|
+
env,
|
|
1274
|
+
.call_nonvirtual_byte_method,
|
|
1275
|
+
.{ obj, clazz, method_id, args },
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1280
|
+
pub inline fn call_nonvirtual_char_method(
|
|
1281
|
+
env: *JNIEnv,
|
|
1282
|
+
obj: JObject,
|
|
1283
|
+
clazz: JClass,
|
|
1284
|
+
method_id: JMethodID,
|
|
1285
|
+
args: ?[*]const JValue,
|
|
1286
|
+
) JChar {
|
|
1287
|
+
return JNIInterface.call(
|
|
1288
|
+
env,
|
|
1289
|
+
.call_nonvirtual_char_method,
|
|
1290
|
+
.{ obj, clazz, method_id, args },
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1295
|
+
pub inline fn call_nonvirtual_short_method(
|
|
1296
|
+
env: *JNIEnv,
|
|
1297
|
+
obj: JObject,
|
|
1298
|
+
clazz: JClass,
|
|
1299
|
+
method_id: JMethodID,
|
|
1300
|
+
args: ?[*]const JValue,
|
|
1301
|
+
) JShort {
|
|
1302
|
+
return JNIInterface.call(
|
|
1303
|
+
env,
|
|
1304
|
+
.call_nonvirtual_short_method,
|
|
1305
|
+
.{ obj, clazz, method_id, args },
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1310
|
+
pub inline fn call_nonvirtual_int_method(
|
|
1311
|
+
env: *JNIEnv,
|
|
1312
|
+
obj: JObject,
|
|
1313
|
+
clazz: JClass,
|
|
1314
|
+
method_id: JMethodID,
|
|
1315
|
+
args: ?[*]const JValue,
|
|
1316
|
+
) JInt {
|
|
1317
|
+
return JNIInterface.call(
|
|
1318
|
+
env,
|
|
1319
|
+
.call_nonvirtual_int_method,
|
|
1320
|
+
.{ obj, clazz, method_id, args },
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1325
|
+
pub inline fn call_nonvirtual_long_method(
|
|
1326
|
+
env: *JNIEnv,
|
|
1327
|
+
obj: JObject,
|
|
1328
|
+
clazz: JClass,
|
|
1329
|
+
method_id: JMethodID,
|
|
1330
|
+
args: ?[*]const JValue,
|
|
1331
|
+
) JLong {
|
|
1332
|
+
return JNIInterface.call(
|
|
1333
|
+
env,
|
|
1334
|
+
.call_nonvirtual_long_method,
|
|
1335
|
+
.{ obj, clazz, method_id, args },
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1340
|
+
pub inline fn call_nonvirtual_float_method(
|
|
1341
|
+
env: *JNIEnv,
|
|
1342
|
+
obj: JObject,
|
|
1343
|
+
clazz: JClass,
|
|
1344
|
+
method_id: JMethodID,
|
|
1345
|
+
args: ?[*]const JValue,
|
|
1346
|
+
) JFloat {
|
|
1347
|
+
return JNIInterface.call(
|
|
1348
|
+
env,
|
|
1349
|
+
.call_nonvirtual_float_method,
|
|
1350
|
+
.{ obj, clazz, method_id, args },
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1355
|
+
pub inline fn call_nonvirtual_double_method(
|
|
1356
|
+
env: *JNIEnv,
|
|
1357
|
+
obj: JObject,
|
|
1358
|
+
clazz: JClass,
|
|
1359
|
+
method_id: JMethodID,
|
|
1360
|
+
args: ?[*]const JValue,
|
|
1361
|
+
) JDouble {
|
|
1362
|
+
return JNIInterface.call(
|
|
1363
|
+
env,
|
|
1364
|
+
.call_nonvirtual_double_method,
|
|
1365
|
+
.{ obj, clazz, method_id, args },
|
|
1366
|
+
);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callnonvirtualtypemethod-routines-callnonvirtualtypemethoda-routines-callnonvirtualtypemethodv-routines.
|
|
1370
|
+
pub inline fn call_nonvirtual_void_method(
|
|
1371
|
+
env: *JNIEnv,
|
|
1372
|
+
obj: JObject,
|
|
1373
|
+
clazz: JClass,
|
|
1374
|
+
method_id: JMethodID,
|
|
1375
|
+
args: ?[*]const JValue,
|
|
1376
|
+
) void {
|
|
1377
|
+
JNIInterface.call(
|
|
1378
|
+
env,
|
|
1379
|
+
.call_nonvirtual_void_method,
|
|
1380
|
+
.{ obj, clazz, method_id, args },
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getfieldid.
|
|
1385
|
+
pub inline fn get_field_id(
|
|
1386
|
+
env: *JNIEnv,
|
|
1387
|
+
clazz: JClass,
|
|
1388
|
+
name: [*:0]const u8,
|
|
1389
|
+
sig: [*:0]const u8,
|
|
1390
|
+
) JFieldID {
|
|
1391
|
+
return JNIInterface.call(
|
|
1392
|
+
env,
|
|
1393
|
+
.get_field_id,
|
|
1394
|
+
.{ clazz, name, sig },
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1399
|
+
pub inline fn get_object_field(
|
|
1400
|
+
env: *JNIEnv,
|
|
1401
|
+
obj: JObject,
|
|
1402
|
+
field_id: JFieldID,
|
|
1403
|
+
) JObject {
|
|
1404
|
+
return JNIInterface.call(
|
|
1405
|
+
env,
|
|
1406
|
+
.get_object_field,
|
|
1407
|
+
.{ obj, field_id },
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1412
|
+
pub inline fn get_boolean_field(
|
|
1413
|
+
env: *JNIEnv,
|
|
1414
|
+
obj: JObject,
|
|
1415
|
+
field_id: JFieldID,
|
|
1416
|
+
) JBoolean {
|
|
1417
|
+
return JNIInterface.call(
|
|
1418
|
+
env,
|
|
1419
|
+
.get_boolean_field,
|
|
1420
|
+
.{ obj, field_id },
|
|
1421
|
+
);
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1425
|
+
pub inline fn get_byte_field(
|
|
1426
|
+
env: *JNIEnv,
|
|
1427
|
+
obj: JObject,
|
|
1428
|
+
field_id: JFieldID,
|
|
1429
|
+
) JByte {
|
|
1430
|
+
return JNIInterface.call(
|
|
1431
|
+
env,
|
|
1432
|
+
.get_byte_field,
|
|
1433
|
+
.{ obj, field_id },
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1438
|
+
pub inline fn get_char_field(
|
|
1439
|
+
env: *JNIEnv,
|
|
1440
|
+
obj: JObject,
|
|
1441
|
+
field_id: JFieldID,
|
|
1442
|
+
) JChar {
|
|
1443
|
+
return JNIInterface.call(
|
|
1444
|
+
env,
|
|
1445
|
+
.get_char_field,
|
|
1446
|
+
.{ obj, field_id },
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1451
|
+
pub inline fn get_short_field(
|
|
1452
|
+
env: *JNIEnv,
|
|
1453
|
+
obj: JObject,
|
|
1454
|
+
field_id: JFieldID,
|
|
1455
|
+
) JShort {
|
|
1456
|
+
return JNIInterface.call(
|
|
1457
|
+
env,
|
|
1458
|
+
.get_short_field,
|
|
1459
|
+
.{ obj, field_id },
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1464
|
+
pub inline fn get_int_field(
|
|
1465
|
+
env: *JNIEnv,
|
|
1466
|
+
obj: JObject,
|
|
1467
|
+
field_id: JFieldID,
|
|
1468
|
+
) JInt {
|
|
1469
|
+
return JNIInterface.call(
|
|
1470
|
+
env,
|
|
1471
|
+
.get_int_field,
|
|
1472
|
+
.{ obj, field_id },
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1477
|
+
pub inline fn get_long_field(
|
|
1478
|
+
env: *JNIEnv,
|
|
1479
|
+
obj: JObject,
|
|
1480
|
+
field_id: JFieldID,
|
|
1481
|
+
) JLong {
|
|
1482
|
+
return JNIInterface.call(
|
|
1483
|
+
env,
|
|
1484
|
+
.get_long_field,
|
|
1485
|
+
.{ obj, field_id },
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1490
|
+
pub inline fn get_float_field(
|
|
1491
|
+
env: *JNIEnv,
|
|
1492
|
+
obj: JObject,
|
|
1493
|
+
field_id: JFieldID,
|
|
1494
|
+
) JFloat {
|
|
1495
|
+
return JNIInterface.call(
|
|
1496
|
+
env,
|
|
1497
|
+
.get_float_field,
|
|
1498
|
+
.{ obj, field_id },
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#gettypefield-routines.
|
|
1503
|
+
pub inline fn get_double_field(
|
|
1504
|
+
env: *JNIEnv,
|
|
1505
|
+
obj: JObject,
|
|
1506
|
+
field_id: JFieldID,
|
|
1507
|
+
) JDouble {
|
|
1508
|
+
return JNIInterface.call(
|
|
1509
|
+
env,
|
|
1510
|
+
.get_double_field,
|
|
1511
|
+
.{ obj, field_id },
|
|
1512
|
+
);
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1516
|
+
pub inline fn set_object_field(
|
|
1517
|
+
env: *JNIEnv,
|
|
1518
|
+
obj: JObject,
|
|
1519
|
+
field_id: JFieldID,
|
|
1520
|
+
value: JObject,
|
|
1521
|
+
) void {
|
|
1522
|
+
JNIInterface.call(
|
|
1523
|
+
env,
|
|
1524
|
+
.set_object_field,
|
|
1525
|
+
.{ obj, field_id, value },
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1530
|
+
pub inline fn set_boolean_field(
|
|
1531
|
+
env: *JNIEnv,
|
|
1532
|
+
obj: JObject,
|
|
1533
|
+
field_id: JFieldID,
|
|
1534
|
+
value: JBoolean,
|
|
1535
|
+
) void {
|
|
1536
|
+
JNIInterface.call(
|
|
1537
|
+
env,
|
|
1538
|
+
.set_boolean_field,
|
|
1539
|
+
.{ obj, field_id, value },
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1544
|
+
pub inline fn set_byte_field(
|
|
1545
|
+
env: *JNIEnv,
|
|
1546
|
+
obj: JObject,
|
|
1547
|
+
field_id: JFieldID,
|
|
1548
|
+
value: JByte,
|
|
1549
|
+
) void {
|
|
1550
|
+
JNIInterface.call(
|
|
1551
|
+
env,
|
|
1552
|
+
.set_byte_field,
|
|
1553
|
+
.{ obj, field_id, value },
|
|
1554
|
+
);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1558
|
+
pub inline fn set_char_field(
|
|
1559
|
+
env: *JNIEnv,
|
|
1560
|
+
obj: JObject,
|
|
1561
|
+
field_id: JFieldID,
|
|
1562
|
+
value: JChar,
|
|
1563
|
+
) void {
|
|
1564
|
+
JNIInterface.call(
|
|
1565
|
+
env,
|
|
1566
|
+
.set_char_field,
|
|
1567
|
+
.{ obj, field_id, value },
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1572
|
+
pub inline fn set_short_field(
|
|
1573
|
+
env: *JNIEnv,
|
|
1574
|
+
obj: JObject,
|
|
1575
|
+
field_id: JFieldID,
|
|
1576
|
+
value: JShort,
|
|
1577
|
+
) void {
|
|
1578
|
+
JNIInterface.call(
|
|
1579
|
+
env,
|
|
1580
|
+
.set_short_field,
|
|
1581
|
+
.{ obj, field_id, value },
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1586
|
+
pub inline fn set_int_field(
|
|
1587
|
+
env: *JNIEnv,
|
|
1588
|
+
obj: JObject,
|
|
1589
|
+
field_id: JFieldID,
|
|
1590
|
+
value: JInt,
|
|
1591
|
+
) void {
|
|
1592
|
+
JNIInterface.call(
|
|
1593
|
+
env,
|
|
1594
|
+
.set_int_field,
|
|
1595
|
+
.{ obj, field_id, value },
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1600
|
+
pub inline fn set_long_field(
|
|
1601
|
+
env: *JNIEnv,
|
|
1602
|
+
obj: JObject,
|
|
1603
|
+
field_id: JFieldID,
|
|
1604
|
+
value: JLong,
|
|
1605
|
+
) void {
|
|
1606
|
+
JNIInterface.call(
|
|
1607
|
+
env,
|
|
1608
|
+
.set_long_field,
|
|
1609
|
+
.{ obj, field_id, value },
|
|
1610
|
+
);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1614
|
+
pub inline fn set_float_field(
|
|
1615
|
+
env: *JNIEnv,
|
|
1616
|
+
obj: JObject,
|
|
1617
|
+
field_id: JFieldID,
|
|
1618
|
+
value: JFloat,
|
|
1619
|
+
) void {
|
|
1620
|
+
JNIInterface.call(
|
|
1621
|
+
env,
|
|
1622
|
+
.set_float_field,
|
|
1623
|
+
.{ obj, field_id, value },
|
|
1624
|
+
);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#settypefield-routines.
|
|
1628
|
+
pub inline fn set_double_field(
|
|
1629
|
+
env: *JNIEnv,
|
|
1630
|
+
obj: JObject,
|
|
1631
|
+
field_id: JFieldID,
|
|
1632
|
+
value: JDouble,
|
|
1633
|
+
) void {
|
|
1634
|
+
JNIInterface.call(
|
|
1635
|
+
env,
|
|
1636
|
+
.set_double_field,
|
|
1637
|
+
.{ obj, field_id, value },
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstaticmethodid.
|
|
1642
|
+
pub inline fn get_static_method_id(
|
|
1643
|
+
env: *JNIEnv,
|
|
1644
|
+
clazz: JClass,
|
|
1645
|
+
name: [*:0]const u8,
|
|
1646
|
+
sig: [*:0]const u8,
|
|
1647
|
+
) JMethodID {
|
|
1648
|
+
return JNIInterface.call(
|
|
1649
|
+
env,
|
|
1650
|
+
.get_static_method_id,
|
|
1651
|
+
.{ clazz, name, sig },
|
|
1652
|
+
);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1656
|
+
pub inline fn call_static_object_method(
|
|
1657
|
+
env: *JNIEnv,
|
|
1658
|
+
clazz: JClass,
|
|
1659
|
+
method_id: JMethodID,
|
|
1660
|
+
args: ?[*]const JValue,
|
|
1661
|
+
) JObject {
|
|
1662
|
+
return JNIInterface.call(
|
|
1663
|
+
env,
|
|
1664
|
+
.call_static_object_method,
|
|
1665
|
+
.{ clazz, method_id, args },
|
|
1666
|
+
);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1670
|
+
pub inline fn call_static_boolean_method(
|
|
1671
|
+
env: *JNIEnv,
|
|
1672
|
+
clazz: JClass,
|
|
1673
|
+
method_id: JMethodID,
|
|
1674
|
+
args: ?[*]const JValue,
|
|
1675
|
+
) JBoolean {
|
|
1676
|
+
return JNIInterface.call(
|
|
1677
|
+
env,
|
|
1678
|
+
.call_static_boolean_method,
|
|
1679
|
+
.{ clazz, method_id, args },
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1684
|
+
pub inline fn call_static_byte_method(
|
|
1685
|
+
env: *JNIEnv,
|
|
1686
|
+
clazz: JClass,
|
|
1687
|
+
method_id: JMethodID,
|
|
1688
|
+
args: ?[*]const JValue,
|
|
1689
|
+
) JByte {
|
|
1690
|
+
return JNIInterface.call(
|
|
1691
|
+
env,
|
|
1692
|
+
.call_static_byte_method,
|
|
1693
|
+
.{ clazz, method_id, args },
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1698
|
+
pub inline fn call_static_char_method(
|
|
1699
|
+
env: *JNIEnv,
|
|
1700
|
+
clazz: JClass,
|
|
1701
|
+
method_id: JMethodID,
|
|
1702
|
+
args: ?[*]const JValue,
|
|
1703
|
+
) JChar {
|
|
1704
|
+
return JNIInterface.call(
|
|
1705
|
+
env,
|
|
1706
|
+
.call_static_char_method,
|
|
1707
|
+
.{ clazz, method_id, args },
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1712
|
+
pub inline fn call_static_short_method(
|
|
1713
|
+
env: *JNIEnv,
|
|
1714
|
+
clazz: JClass,
|
|
1715
|
+
method_id: JMethodID,
|
|
1716
|
+
args: ?[*]const JValue,
|
|
1717
|
+
) JShort {
|
|
1718
|
+
return JNIInterface.call(
|
|
1719
|
+
env,
|
|
1720
|
+
.call_static_short_method,
|
|
1721
|
+
.{ clazz, method_id, args },
|
|
1722
|
+
);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1726
|
+
pub inline fn call_static_int_method(
|
|
1727
|
+
env: *JNIEnv,
|
|
1728
|
+
clazz: JClass,
|
|
1729
|
+
method_id: JMethodID,
|
|
1730
|
+
args: ?[*]const JValue,
|
|
1731
|
+
) JInt {
|
|
1732
|
+
return JNIInterface.call(
|
|
1733
|
+
env,
|
|
1734
|
+
.call_static_int_method,
|
|
1735
|
+
.{ clazz, method_id, args },
|
|
1736
|
+
);
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1740
|
+
pub inline fn call_static_long_method(
|
|
1741
|
+
env: *JNIEnv,
|
|
1742
|
+
clazz: JClass,
|
|
1743
|
+
method_id: JMethodID,
|
|
1744
|
+
args: ?[*]const JValue,
|
|
1745
|
+
) JLong {
|
|
1746
|
+
return JNIInterface.call(
|
|
1747
|
+
env,
|
|
1748
|
+
.call_static_long_method,
|
|
1749
|
+
.{ clazz, method_id, args },
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1754
|
+
pub inline fn call_static_float_method(
|
|
1755
|
+
env: *JNIEnv,
|
|
1756
|
+
clazz: JClass,
|
|
1757
|
+
method_id: JMethodID,
|
|
1758
|
+
args: ?[*]const JValue,
|
|
1759
|
+
) JFloat {
|
|
1760
|
+
return JNIInterface.call(
|
|
1761
|
+
env,
|
|
1762
|
+
.call_static_float_method,
|
|
1763
|
+
.{ clazz, method_id, args },
|
|
1764
|
+
);
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1768
|
+
pub inline fn call_static_double_method(
|
|
1769
|
+
env: *JNIEnv,
|
|
1770
|
+
clazz: JClass,
|
|
1771
|
+
method_id: JMethodID,
|
|
1772
|
+
args: ?[*]const JValue,
|
|
1773
|
+
) JDouble {
|
|
1774
|
+
return JNIInterface.call(
|
|
1775
|
+
env,
|
|
1776
|
+
.call_static_double_method,
|
|
1777
|
+
.{ clazz, method_id, args },
|
|
1778
|
+
);
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#callstatictypemethod-routines-callstatictypemethoda-routines-callstatictypemethodv-routines.
|
|
1782
|
+
pub inline fn call_static_void_method(
|
|
1783
|
+
env: *JNIEnv,
|
|
1784
|
+
clazz: JClass,
|
|
1785
|
+
method_id: JMethodID,
|
|
1786
|
+
args: ?[*]const JValue,
|
|
1787
|
+
) void {
|
|
1788
|
+
JNIInterface.call(
|
|
1789
|
+
env,
|
|
1790
|
+
.call_static_void_method,
|
|
1791
|
+
.{ clazz, method_id, args },
|
|
1792
|
+
);
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
/// Returns a field ID, or NULL if the specified static field cannot be found.
|
|
1796
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstaticfieldid.
|
|
1797
|
+
pub inline fn get_static_field_id(
|
|
1798
|
+
env: *JNIEnv,
|
|
1799
|
+
clazz: JClass,
|
|
1800
|
+
name: [*:0]const u8,
|
|
1801
|
+
sig: [*:0]const u8,
|
|
1802
|
+
) JFieldID {
|
|
1803
|
+
return JNIInterface.call(
|
|
1804
|
+
env,
|
|
1805
|
+
.get_static_field_id,
|
|
1806
|
+
.{ clazz, name, sig },
|
|
1807
|
+
);
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1811
|
+
pub inline fn get_static_object_field(
|
|
1812
|
+
env: *JNIEnv,
|
|
1813
|
+
clazz: JClass,
|
|
1814
|
+
field_id: JFieldID,
|
|
1815
|
+
) JObject {
|
|
1816
|
+
return JNIInterface.call(
|
|
1817
|
+
env,
|
|
1818
|
+
.get_static_object_field,
|
|
1819
|
+
.{ clazz, field_id },
|
|
1820
|
+
);
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1824
|
+
pub inline fn get_static_boolean_field(
|
|
1825
|
+
env: *JNIEnv,
|
|
1826
|
+
clazz: JClass,
|
|
1827
|
+
field_id: JFieldID,
|
|
1828
|
+
) JBoolean {
|
|
1829
|
+
return JNIInterface.call(
|
|
1830
|
+
env,
|
|
1831
|
+
.get_static_boolean_field,
|
|
1832
|
+
.{ clazz, field_id },
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1837
|
+
pub inline fn get_static_byte_field(
|
|
1838
|
+
env: *JNIEnv,
|
|
1839
|
+
clazz: JClass,
|
|
1840
|
+
field_id: JFieldID,
|
|
1841
|
+
) JByte {
|
|
1842
|
+
return JNIInterface.call(
|
|
1843
|
+
env,
|
|
1844
|
+
.get_static_byte_field,
|
|
1845
|
+
.{ clazz, field_id },
|
|
1846
|
+
);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1850
|
+
pub inline fn get_static_char_field(
|
|
1851
|
+
env: *JNIEnv,
|
|
1852
|
+
clazz: JClass,
|
|
1853
|
+
field_id: JFieldID,
|
|
1854
|
+
) JChar {
|
|
1855
|
+
return JNIInterface.call(
|
|
1856
|
+
env,
|
|
1857
|
+
.get_static_char_field,
|
|
1858
|
+
.{ clazz, field_id },
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1863
|
+
pub inline fn get_static_short_field(
|
|
1864
|
+
env: *JNIEnv,
|
|
1865
|
+
clazz: JClass,
|
|
1866
|
+
field_id: JFieldID,
|
|
1867
|
+
) JShort {
|
|
1868
|
+
return JNIInterface.call(
|
|
1869
|
+
env,
|
|
1870
|
+
.get_static_short_field,
|
|
1871
|
+
.{ clazz, field_id },
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1876
|
+
pub inline fn get_static_int_field(
|
|
1877
|
+
env: *JNIEnv,
|
|
1878
|
+
clazz: JClass,
|
|
1879
|
+
field_id: JFieldID,
|
|
1880
|
+
) JInt {
|
|
1881
|
+
return JNIInterface.call(
|
|
1882
|
+
env,
|
|
1883
|
+
.get_static_int_field,
|
|
1884
|
+
.{ clazz, field_id },
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1889
|
+
pub inline fn get_static_long_field(
|
|
1890
|
+
env: *JNIEnv,
|
|
1891
|
+
clazz: JClass,
|
|
1892
|
+
field_id: JFieldID,
|
|
1893
|
+
) JLong {
|
|
1894
|
+
return JNIInterface.call(
|
|
1895
|
+
env,
|
|
1896
|
+
.get_static_long_field,
|
|
1897
|
+
.{ clazz, field_id },
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1902
|
+
pub inline fn get_static_float_field(
|
|
1903
|
+
env: *JNIEnv,
|
|
1904
|
+
clazz: JClass,
|
|
1905
|
+
field_id: JFieldID,
|
|
1906
|
+
) JFloat {
|
|
1907
|
+
return JNIInterface.call(
|
|
1908
|
+
env,
|
|
1909
|
+
.get_static_float_field,
|
|
1910
|
+
.{ clazz, field_id },
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1915
|
+
pub inline fn get_static_double_field(
|
|
1916
|
+
env: *JNIEnv,
|
|
1917
|
+
clazz: JClass,
|
|
1918
|
+
field_id: JFieldID,
|
|
1919
|
+
) JDouble {
|
|
1920
|
+
return JNIInterface.call(
|
|
1921
|
+
env,
|
|
1922
|
+
.get_static_double_field,
|
|
1923
|
+
.{ clazz, field_id },
|
|
1924
|
+
);
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstatictypefield-routines.
|
|
1928
|
+
pub inline fn set_static_object_field(
|
|
1929
|
+
env: *JNIEnv,
|
|
1930
|
+
clazz: JClass,
|
|
1931
|
+
field_id: JFieldID,
|
|
1932
|
+
value: JObject,
|
|
1933
|
+
) void {
|
|
1934
|
+
JNIInterface.call(
|
|
1935
|
+
env,
|
|
1936
|
+
.set_static_object_field,
|
|
1937
|
+
.{ clazz, field_id, value },
|
|
1938
|
+
);
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
1942
|
+
pub inline fn set_static_boolean_field(
|
|
1943
|
+
env: *JNIEnv,
|
|
1944
|
+
clazz: JClass,
|
|
1945
|
+
field_id: JFieldID,
|
|
1946
|
+
value: JBoolean,
|
|
1947
|
+
) void {
|
|
1948
|
+
JNIInterface.call(
|
|
1949
|
+
env,
|
|
1950
|
+
.set_static_boolean_field,
|
|
1951
|
+
.{ clazz, field_id, value },
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
1956
|
+
pub inline fn set_static_byte_field(
|
|
1957
|
+
env: *JNIEnv,
|
|
1958
|
+
clazz: JClass,
|
|
1959
|
+
field_id: JFieldID,
|
|
1960
|
+
value: JByte,
|
|
1961
|
+
) void {
|
|
1962
|
+
JNIInterface.call(
|
|
1963
|
+
env,
|
|
1964
|
+
.set_static_byte_field,
|
|
1965
|
+
.{ clazz, field_id, value },
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
1970
|
+
pub inline fn set_static_char_field(
|
|
1971
|
+
env: *JNIEnv,
|
|
1972
|
+
clazz: JClass,
|
|
1973
|
+
field_id: JFieldID,
|
|
1974
|
+
value: JChar,
|
|
1975
|
+
) void {
|
|
1976
|
+
JNIInterface.call(
|
|
1977
|
+
env,
|
|
1978
|
+
.set_static_char_field,
|
|
1979
|
+
.{ clazz, field_id, value },
|
|
1980
|
+
);
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
1984
|
+
pub inline fn set_static_short_field(
|
|
1985
|
+
env: *JNIEnv,
|
|
1986
|
+
clazz: JClass,
|
|
1987
|
+
field_id: JFieldID,
|
|
1988
|
+
value: JShort,
|
|
1989
|
+
) void {
|
|
1990
|
+
JNIInterface.call(
|
|
1991
|
+
env,
|
|
1992
|
+
.set_static_short_field,
|
|
1993
|
+
.{ clazz, field_id, value },
|
|
1994
|
+
);
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
1998
|
+
pub inline fn set_static_int_field(
|
|
1999
|
+
env: *JNIEnv,
|
|
2000
|
+
clazz: JClass,
|
|
2001
|
+
field_id: JFieldID,
|
|
2002
|
+
value: JInt,
|
|
2003
|
+
) void {
|
|
2004
|
+
JNIInterface.call(
|
|
2005
|
+
env,
|
|
2006
|
+
.set_static_int_field,
|
|
2007
|
+
.{ clazz, field_id, value },
|
|
2008
|
+
);
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
2012
|
+
pub inline fn set_static_long_field(
|
|
2013
|
+
env: *JNIEnv,
|
|
2014
|
+
clazz: JClass,
|
|
2015
|
+
field_id: JFieldID,
|
|
2016
|
+
value: JLong,
|
|
2017
|
+
) void {
|
|
2018
|
+
JNIInterface.call(
|
|
2019
|
+
env,
|
|
2020
|
+
.set_static_long_field,
|
|
2021
|
+
.{ clazz, field_id, value },
|
|
2022
|
+
);
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
2026
|
+
pub inline fn set_static_float_field(
|
|
2027
|
+
env: *JNIEnv,
|
|
2028
|
+
clazz: JClass,
|
|
2029
|
+
field_id: JFieldID,
|
|
2030
|
+
value: JFloat,
|
|
2031
|
+
) void {
|
|
2032
|
+
JNIInterface.call(
|
|
2033
|
+
env,
|
|
2034
|
+
.set_static_float_field,
|
|
2035
|
+
.{ clazz, field_id, value },
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setstatictypefield-routines.
|
|
2040
|
+
pub inline fn set_static_double_field(
|
|
2041
|
+
env: *JNIEnv,
|
|
2042
|
+
clazz: JClass,
|
|
2043
|
+
field_id: JFieldID,
|
|
2044
|
+
value: JDouble,
|
|
2045
|
+
) void {
|
|
2046
|
+
JNIInterface.call(
|
|
2047
|
+
env,
|
|
2048
|
+
.set_static_double_field,
|
|
2049
|
+
.{ clazz, field_id, value },
|
|
2050
|
+
);
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newstring.
|
|
2054
|
+
pub inline fn new_string(
|
|
2055
|
+
env: *JNIEnv,
|
|
2056
|
+
unicode_chars: [*]const JChar,
|
|
2057
|
+
size: JSize,
|
|
2058
|
+
) JString {
|
|
2059
|
+
return JNIInterface.call(
|
|
2060
|
+
env,
|
|
2061
|
+
.new_string,
|
|
2062
|
+
.{ unicode_chars, size },
|
|
2063
|
+
);
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringlength.
|
|
2067
|
+
pub inline fn get_string_length(
|
|
2068
|
+
env: *JNIEnv,
|
|
2069
|
+
string: JString,
|
|
2070
|
+
) JSize {
|
|
2071
|
+
return JNIInterface.call(
|
|
2072
|
+
env,
|
|
2073
|
+
.get_string_length,
|
|
2074
|
+
.{string},
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
/// Returns a pointer to the array of Unicode characters of the string.
|
|
2079
|
+
/// This pointer is valid until release_string_chars is called.
|
|
2080
|
+
/// If is_copy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2081
|
+
/// or it is set to false if no copy is made.
|
|
2082
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringchars.
|
|
2083
|
+
pub inline fn get_string_chars(
|
|
2084
|
+
env: *JNIEnv,
|
|
2085
|
+
string: JString,
|
|
2086
|
+
is_copy: ?*JBoolean,
|
|
2087
|
+
) ?[*]const JChar {
|
|
2088
|
+
return JNIInterface.call(
|
|
2089
|
+
env,
|
|
2090
|
+
.get_string_chars,
|
|
2091
|
+
.{ string, is_copy },
|
|
2092
|
+
);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releasestringchars.
|
|
2096
|
+
pub inline fn release_string_chars(
|
|
2097
|
+
env: *JNIEnv,
|
|
2098
|
+
string: JString,
|
|
2099
|
+
chars: [*]const JChar,
|
|
2100
|
+
) void {
|
|
2101
|
+
JNIInterface.call(
|
|
2102
|
+
env,
|
|
2103
|
+
.release_string_chars,
|
|
2104
|
+
.{ string, chars },
|
|
2105
|
+
);
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newstringutf.
|
|
2109
|
+
pub inline fn new_string_utf(
|
|
2110
|
+
env: *JNIEnv,
|
|
2111
|
+
bytes: [*:0]const u8,
|
|
2112
|
+
) JString {
|
|
2113
|
+
return JNIInterface.call(
|
|
2114
|
+
env,
|
|
2115
|
+
.new_string_utf,
|
|
2116
|
+
.{bytes},
|
|
2117
|
+
);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringutflength.
|
|
2121
|
+
pub inline fn get_string_utf_length(
|
|
2122
|
+
env: *JNIEnv,
|
|
2123
|
+
string: JString,
|
|
2124
|
+
) JSize {
|
|
2125
|
+
return JNIInterface.call(
|
|
2126
|
+
env,
|
|
2127
|
+
.get_string_utf_length,
|
|
2128
|
+
.{string},
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
/// Returns a pointer to an array of bytes representing the string in modified UTF-8 encoding.
|
|
2133
|
+
/// This array is valid until it is released by release_string_utf_chars.
|
|
2134
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2135
|
+
/// or it is set to false if no copy is made.
|
|
2136
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringutfchars.
|
|
2137
|
+
pub inline fn get_string_utf_chars(
|
|
2138
|
+
env: *JNIEnv,
|
|
2139
|
+
string: JString,
|
|
2140
|
+
is_copy: ?*JBoolean,
|
|
2141
|
+
) ?[*:0]const u8 {
|
|
2142
|
+
return JNIInterface.call(
|
|
2143
|
+
env,
|
|
2144
|
+
.get_string_utf_chars,
|
|
2145
|
+
.{ string, is_copy },
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releasestringutfchars.
|
|
2150
|
+
pub inline fn release_string_utf_chars(
|
|
2151
|
+
env: *JNIEnv,
|
|
2152
|
+
string: JString,
|
|
2153
|
+
utf: [*:0]const u8,
|
|
2154
|
+
) void {
|
|
2155
|
+
JNIInterface.call(
|
|
2156
|
+
env,
|
|
2157
|
+
.release_string_utf_chars,
|
|
2158
|
+
.{ string, utf },
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getarraylength.
|
|
2163
|
+
pub inline fn get_array_length(
|
|
2164
|
+
env: *JNIEnv,
|
|
2165
|
+
array: JArray,
|
|
2166
|
+
) JSize {
|
|
2167
|
+
return JNIInterface.call(
|
|
2168
|
+
env,
|
|
2169
|
+
.get_array_length,
|
|
2170
|
+
.{array},
|
|
2171
|
+
);
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
/// Constructs a new array holding objects in class elementClass.
|
|
2175
|
+
/// All elements are initially set to initialElement.
|
|
2176
|
+
/// Returns a Java array object, or NULL if the array cannot be constructed.
|
|
2177
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newobjectarray.
|
|
2178
|
+
pub inline fn new_object_array(
|
|
2179
|
+
env: *JNIEnv,
|
|
2180
|
+
length: JSize,
|
|
2181
|
+
element_class: JClass,
|
|
2182
|
+
initial_element: JObject,
|
|
2183
|
+
) JObjectArray {
|
|
2184
|
+
return JNIInterface.call(
|
|
2185
|
+
env,
|
|
2186
|
+
.new_object_array,
|
|
2187
|
+
.{ length, element_class, initial_element },
|
|
2188
|
+
);
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getobjectarrayelement.
|
|
2192
|
+
pub inline fn get_object_array_element(
|
|
2193
|
+
env: *JNIEnv,
|
|
2194
|
+
array: JObjectArray,
|
|
2195
|
+
index: JSize,
|
|
2196
|
+
) JObject {
|
|
2197
|
+
return JNIInterface.call(
|
|
2198
|
+
env,
|
|
2199
|
+
.get_object_array_element,
|
|
2200
|
+
.{ array, index },
|
|
2201
|
+
);
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setobjectarrayelement.
|
|
2205
|
+
pub inline fn set_object_array_element(
|
|
2206
|
+
env: *JNIEnv,
|
|
2207
|
+
array: JObjectArray,
|
|
2208
|
+
index: JSize,
|
|
2209
|
+
value: JObject,
|
|
2210
|
+
) void {
|
|
2211
|
+
JNIInterface.call(
|
|
2212
|
+
env,
|
|
2213
|
+
.set_object_array_element,
|
|
2214
|
+
.{ array, index, value },
|
|
2215
|
+
);
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2219
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2220
|
+
pub inline fn new_boolean_array(
|
|
2221
|
+
env: *JNIEnv,
|
|
2222
|
+
length: JSize,
|
|
2223
|
+
) JBooleanArray {
|
|
2224
|
+
return JNIInterface.call(
|
|
2225
|
+
env,
|
|
2226
|
+
.new_boolean_array,
|
|
2227
|
+
.{length},
|
|
2228
|
+
);
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2232
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2233
|
+
pub inline fn new_byte_array(
|
|
2234
|
+
env: *JNIEnv,
|
|
2235
|
+
length: JSize,
|
|
2236
|
+
) JByteArray {
|
|
2237
|
+
return JNIInterface.call(
|
|
2238
|
+
env,
|
|
2239
|
+
.new_byte_array,
|
|
2240
|
+
.{length},
|
|
2241
|
+
);
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2245
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2246
|
+
pub inline fn new_char_array(
|
|
2247
|
+
env: *JNIEnv,
|
|
2248
|
+
length: JSize,
|
|
2249
|
+
) JCharArray {
|
|
2250
|
+
return JNIInterface.call(
|
|
2251
|
+
env,
|
|
2252
|
+
.new_char_array,
|
|
2253
|
+
.{length},
|
|
2254
|
+
);
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2258
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2259
|
+
pub inline fn new_short_array(
|
|
2260
|
+
env: *JNIEnv,
|
|
2261
|
+
length: JSize,
|
|
2262
|
+
) JShortArray {
|
|
2263
|
+
return JNIInterface.call(
|
|
2264
|
+
env,
|
|
2265
|
+
.new_short_array,
|
|
2266
|
+
.{length},
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2271
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2272
|
+
pub inline fn new_int_array(
|
|
2273
|
+
env: *JNIEnv,
|
|
2274
|
+
length: JSize,
|
|
2275
|
+
) JIntArray {
|
|
2276
|
+
return JNIInterface.call(
|
|
2277
|
+
env,
|
|
2278
|
+
.new_int_array,
|
|
2279
|
+
.{length},
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2284
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2285
|
+
pub inline fn new_long_array(
|
|
2286
|
+
env: *JNIEnv,
|
|
2287
|
+
length: JSize,
|
|
2288
|
+
) JLongArray {
|
|
2289
|
+
return JNIInterface.call(
|
|
2290
|
+
env,
|
|
2291
|
+
.new_long_array,
|
|
2292
|
+
.{length},
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2297
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2298
|
+
pub inline fn new_float_array(
|
|
2299
|
+
env: *JNIEnv,
|
|
2300
|
+
length: JSize,
|
|
2301
|
+
) JFloatArray {
|
|
2302
|
+
return JNIInterface.call(
|
|
2303
|
+
env,
|
|
2304
|
+
.new_float_array,
|
|
2305
|
+
.{length},
|
|
2306
|
+
);
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/// Returns a Java array, or NULL if the array cannot be constructed.
|
|
2310
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newprimitivetypearray-routines.
|
|
2311
|
+
pub inline fn new_double_array(
|
|
2312
|
+
env: *JNIEnv,
|
|
2313
|
+
length: JSize,
|
|
2314
|
+
) JDoubleArray {
|
|
2315
|
+
return JNIInterface.call(
|
|
2316
|
+
env,
|
|
2317
|
+
.new_double_array,
|
|
2318
|
+
.{length},
|
|
2319
|
+
);
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
/// Returns the body of the primitive array.
|
|
2323
|
+
/// The result is valid until the corresponding release function is called.
|
|
2324
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2325
|
+
/// or it is set to false if no copy is made.
|
|
2326
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2327
|
+
pub inline fn get_boolean_array_elements(
|
|
2328
|
+
env: *JNIEnv,
|
|
2329
|
+
array: JBooleanArray,
|
|
2330
|
+
is_copy: ?*JBoolean,
|
|
2331
|
+
) ?[*]JBoolean {
|
|
2332
|
+
return JNIInterface.call(
|
|
2333
|
+
env,
|
|
2334
|
+
.get_boolean_array_elements,
|
|
2335
|
+
.{ array, is_copy },
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
/// Returns the body of the primitive array.
|
|
2340
|
+
/// The result is valid until the corresponding release function is called.
|
|
2341
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2342
|
+
/// or it is set to false if no copy is made.
|
|
2343
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2344
|
+
pub inline fn get_byte_array_elements(
|
|
2345
|
+
env: *JNIEnv,
|
|
2346
|
+
array: JByteArray,
|
|
2347
|
+
is_copy: ?*JBoolean,
|
|
2348
|
+
) ?[*]JByte {
|
|
2349
|
+
return JNIInterface.call(
|
|
2350
|
+
env,
|
|
2351
|
+
.get_byte_array_elements,
|
|
2352
|
+
.{ array, is_copy },
|
|
2353
|
+
);
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
/// Returns the body of the primitive array.
|
|
2357
|
+
/// The result is valid until the corresponding release function is called.
|
|
2358
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2359
|
+
/// or it is set to false if no copy is made.
|
|
2360
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2361
|
+
pub inline fn get_char_array_elements(
|
|
2362
|
+
env: *JNIEnv,
|
|
2363
|
+
array: JCharArray,
|
|
2364
|
+
is_copy: ?*JBoolean,
|
|
2365
|
+
) ?[*]JChar {
|
|
2366
|
+
return JNIInterface.call(
|
|
2367
|
+
env,
|
|
2368
|
+
.get_char_array_elements,
|
|
2369
|
+
.{ array, is_copy },
|
|
2370
|
+
);
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
/// Returns the body of the primitive array.
|
|
2374
|
+
/// The result is valid until the corresponding release function is called.
|
|
2375
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2376
|
+
/// or it is set to false if no copy is made.
|
|
2377
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2378
|
+
pub inline fn get_short_array_elements(
|
|
2379
|
+
env: *JNIEnv,
|
|
2380
|
+
array: JShortArray,
|
|
2381
|
+
is_copy: ?*JBoolean,
|
|
2382
|
+
) ?[*]JShort {
|
|
2383
|
+
return JNIInterface.call(
|
|
2384
|
+
env,
|
|
2385
|
+
.get_short_array_elements,
|
|
2386
|
+
.{ array, is_copy },
|
|
2387
|
+
);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
/// Returns the body of the primitive array.
|
|
2391
|
+
/// The result is valid until the corresponding release function is called.
|
|
2392
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2393
|
+
/// or it is set to false if no copy is made.
|
|
2394
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2395
|
+
pub inline fn get_int_array_elements(
|
|
2396
|
+
env: *JNIEnv,
|
|
2397
|
+
array: JIntArray,
|
|
2398
|
+
is_copy: ?*JBoolean,
|
|
2399
|
+
) ?[*]JInt {
|
|
2400
|
+
return JNIInterface.call(
|
|
2401
|
+
env,
|
|
2402
|
+
.get_int_array_elements,
|
|
2403
|
+
.{ array, is_copy },
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
/// Returns the body of the primitive array.
|
|
2408
|
+
/// The result is valid until the corresponding release function is called.
|
|
2409
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2410
|
+
/// or it is set to false if no copy is made.
|
|
2411
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2412
|
+
pub inline fn get_long_array_elements(
|
|
2413
|
+
env: *JNIEnv,
|
|
2414
|
+
array: JLongArray,
|
|
2415
|
+
is_copy: ?*JBoolean,
|
|
2416
|
+
) ?[*]JLong {
|
|
2417
|
+
return JNIInterface.call(
|
|
2418
|
+
env,
|
|
2419
|
+
.get_long_array_elements,
|
|
2420
|
+
.{ array, is_copy },
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
/// Returns the body of the primitive array.
|
|
2425
|
+
/// The result is valid until the corresponding release function is called.
|
|
2426
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2427
|
+
/// or it is set to false if no copy is made.
|
|
2428
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2429
|
+
pub inline fn get_float_array_elements(
|
|
2430
|
+
env: *JNIEnv,
|
|
2431
|
+
array: JFloatArray,
|
|
2432
|
+
is_copy: ?*JBoolean,
|
|
2433
|
+
) ?[*]JFloat {
|
|
2434
|
+
return JNIInterface.call(
|
|
2435
|
+
env,
|
|
2436
|
+
.get_float_array_elements,
|
|
2437
|
+
.{ array, is_copy },
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
/// Index 190: GetDoubleArrayElements
|
|
2442
|
+
/// Returns the body of the primitive array.
|
|
2443
|
+
/// The result is valid until the corresponding release function is called.
|
|
2444
|
+
/// If isCopy is not NULL, then *is_copy is set to true if a copy is made,
|
|
2445
|
+
/// or it is set to false if no copy is made.
|
|
2446
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayelements-routines.
|
|
2447
|
+
pub inline fn get_double_array_elements(
|
|
2448
|
+
env: *JNIEnv,
|
|
2449
|
+
array: JDoubleArray,
|
|
2450
|
+
is_copy: ?*JBoolean,
|
|
2451
|
+
) ?[*]JDouble {
|
|
2452
|
+
return JNIInterface.call(
|
|
2453
|
+
env,
|
|
2454
|
+
.get_double_array_elements,
|
|
2455
|
+
.{ array, is_copy },
|
|
2456
|
+
);
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2460
|
+
pub inline fn release_boolean_array_elements(
|
|
2461
|
+
env: *JNIEnv,
|
|
2462
|
+
array: JBooleanArray,
|
|
2463
|
+
elems: [*]JBoolean,
|
|
2464
|
+
mode: JArrayReleaseMode,
|
|
2465
|
+
) void {
|
|
2466
|
+
JNIInterface.call(
|
|
2467
|
+
env,
|
|
2468
|
+
.release_boolean_array_elements,
|
|
2469
|
+
.{ array, elems, mode },
|
|
2470
|
+
);
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2474
|
+
pub inline fn release_byte_array_elements(
|
|
2475
|
+
env: *JNIEnv,
|
|
2476
|
+
array: JByteArray,
|
|
2477
|
+
elems: [*]JByte,
|
|
2478
|
+
mode: JArrayReleaseMode,
|
|
2479
|
+
) void {
|
|
2480
|
+
JNIInterface.call(
|
|
2481
|
+
env,
|
|
2482
|
+
.release_byte_array_elements,
|
|
2483
|
+
.{ array, elems, mode },
|
|
2484
|
+
);
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2488
|
+
pub inline fn release_char_array_elements(
|
|
2489
|
+
env: *JNIEnv,
|
|
2490
|
+
array: JCharArray,
|
|
2491
|
+
elems: [*]JChar,
|
|
2492
|
+
mode: JArrayReleaseMode,
|
|
2493
|
+
) void {
|
|
2494
|
+
JNIInterface.call(
|
|
2495
|
+
env,
|
|
2496
|
+
.release_char_array_elements,
|
|
2497
|
+
.{ array, elems, mode },
|
|
2498
|
+
);
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2502
|
+
pub inline fn release_short_array_elements(
|
|
2503
|
+
env: *JNIEnv,
|
|
2504
|
+
array: JShortArray,
|
|
2505
|
+
elems: [*]JShort,
|
|
2506
|
+
mode: JArrayReleaseMode,
|
|
2507
|
+
) void {
|
|
2508
|
+
JNIInterface.call(
|
|
2509
|
+
env,
|
|
2510
|
+
.release_short_array_elements,
|
|
2511
|
+
.{ array, elems, mode },
|
|
2512
|
+
);
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2516
|
+
pub inline fn release_int_array_elements(
|
|
2517
|
+
env: *JNIEnv,
|
|
2518
|
+
array: JIntArray,
|
|
2519
|
+
elems: [*]JInt,
|
|
2520
|
+
mode: JArrayReleaseMode,
|
|
2521
|
+
) void {
|
|
2522
|
+
JNIInterface.call(
|
|
2523
|
+
env,
|
|
2524
|
+
.release_int_array_elements,
|
|
2525
|
+
.{ array, elems, mode },
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2530
|
+
pub inline fn release_long_array_elements(
|
|
2531
|
+
env: *JNIEnv,
|
|
2532
|
+
array: JLongArray,
|
|
2533
|
+
elems: [*]JLong,
|
|
2534
|
+
mode: JArrayReleaseMode,
|
|
2535
|
+
) void {
|
|
2536
|
+
JNIInterface.call(
|
|
2537
|
+
env,
|
|
2538
|
+
.release_long_array_elements,
|
|
2539
|
+
.{ array, elems, mode },
|
|
2540
|
+
);
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2544
|
+
pub inline fn release_float_array_elements(
|
|
2545
|
+
env: *JNIEnv,
|
|
2546
|
+
array: JFloatArray,
|
|
2547
|
+
elems: [*]JFloat,
|
|
2548
|
+
mode: JArrayReleaseMode,
|
|
2549
|
+
) void {
|
|
2550
|
+
JNIInterface.call(
|
|
2551
|
+
env,
|
|
2552
|
+
.release_float_array_elements,
|
|
2553
|
+
.{ array, elems, mode },
|
|
2554
|
+
);
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivetypearrayelements-routines.
|
|
2558
|
+
pub inline fn release_double_array_elements(
|
|
2559
|
+
env: *JNIEnv,
|
|
2560
|
+
array: JDoubleArray,
|
|
2561
|
+
elems: [*]JDouble,
|
|
2562
|
+
mode: JArrayReleaseMode,
|
|
2563
|
+
) void {
|
|
2564
|
+
JNIInterface.call(
|
|
2565
|
+
env,
|
|
2566
|
+
.release_double_array_elements,
|
|
2567
|
+
.{ array, elems, mode },
|
|
2568
|
+
);
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2572
|
+
pub inline fn get_boolean_array_region(
|
|
2573
|
+
env: *JNIEnv,
|
|
2574
|
+
array: JBooleanArray,
|
|
2575
|
+
start: JSize,
|
|
2576
|
+
len: JSize,
|
|
2577
|
+
buf: [*]JBoolean,
|
|
2578
|
+
) void {
|
|
2579
|
+
JNIInterface.call(
|
|
2580
|
+
env,
|
|
2581
|
+
.get_boolean_array_region,
|
|
2582
|
+
.{ array, start, len, buf },
|
|
2583
|
+
);
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2587
|
+
pub inline fn get_byte_array_region(
|
|
2588
|
+
env: *JNIEnv,
|
|
2589
|
+
array: JByteArray,
|
|
2590
|
+
start: JSize,
|
|
2591
|
+
len: JSize,
|
|
2592
|
+
buf: [*]JByte,
|
|
2593
|
+
) void {
|
|
2594
|
+
JNIInterface.call(
|
|
2595
|
+
env,
|
|
2596
|
+
.get_byte_array_region,
|
|
2597
|
+
.{ array, start, len, buf },
|
|
2598
|
+
);
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2602
|
+
pub inline fn get_char_array_region(
|
|
2603
|
+
env: *JNIEnv,
|
|
2604
|
+
array: JCharArray,
|
|
2605
|
+
start: JSize,
|
|
2606
|
+
len: JSize,
|
|
2607
|
+
buf: [*]JChar,
|
|
2608
|
+
) void {
|
|
2609
|
+
JNIInterface.call(
|
|
2610
|
+
env,
|
|
2611
|
+
.get_char_array_region,
|
|
2612
|
+
.{ array, start, len, buf },
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2617
|
+
pub inline fn get_short_array_region(
|
|
2618
|
+
env: *JNIEnv,
|
|
2619
|
+
array: JShortArray,
|
|
2620
|
+
start: JSize,
|
|
2621
|
+
len: JSize,
|
|
2622
|
+
buf: [*]JShort,
|
|
2623
|
+
) void {
|
|
2624
|
+
JNIInterface.call(
|
|
2625
|
+
env,
|
|
2626
|
+
.get_short_array_region,
|
|
2627
|
+
.{ array, start, len, buf },
|
|
2628
|
+
);
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2632
|
+
pub inline fn get_int_array_region(
|
|
2633
|
+
env: *JNIEnv,
|
|
2634
|
+
array: JIntArray,
|
|
2635
|
+
start: JSize,
|
|
2636
|
+
len: JSize,
|
|
2637
|
+
buf: [*]JInt,
|
|
2638
|
+
) void {
|
|
2639
|
+
JNIInterface.call(
|
|
2640
|
+
env,
|
|
2641
|
+
.get_int_array_region,
|
|
2642
|
+
.{ array, start, len, buf },
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2647
|
+
pub inline fn get_long_array_region(
|
|
2648
|
+
env: *JNIEnv,
|
|
2649
|
+
array: JLongArray,
|
|
2650
|
+
start: JSize,
|
|
2651
|
+
len: JSize,
|
|
2652
|
+
buf: [*]JLong,
|
|
2653
|
+
) void {
|
|
2654
|
+
JNIInterface.call(
|
|
2655
|
+
env,
|
|
2656
|
+
.get_long_array_region,
|
|
2657
|
+
.{ array, start, len, buf },
|
|
2658
|
+
);
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2662
|
+
pub inline fn get_float_array_region(
|
|
2663
|
+
env: *JNIEnv,
|
|
2664
|
+
array: JFloatArray,
|
|
2665
|
+
start: JSize,
|
|
2666
|
+
len: JSize,
|
|
2667
|
+
buf: [*]JFloat,
|
|
2668
|
+
) void {
|
|
2669
|
+
JNIInterface.call(
|
|
2670
|
+
env,
|
|
2671
|
+
.get_float_array_region,
|
|
2672
|
+
.{ array, start, len, buf },
|
|
2673
|
+
);
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivetypearrayregion-routines.
|
|
2677
|
+
pub inline fn get_double_array_region(
|
|
2678
|
+
env: *JNIEnv,
|
|
2679
|
+
array: JDoubleArray,
|
|
2680
|
+
start: JSize,
|
|
2681
|
+
len: JSize,
|
|
2682
|
+
buf: [*]JDouble,
|
|
2683
|
+
) void {
|
|
2684
|
+
JNIInterface.call(
|
|
2685
|
+
env,
|
|
2686
|
+
.get_double_array_region,
|
|
2687
|
+
.{ array, start, len, buf },
|
|
2688
|
+
);
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2692
|
+
pub inline fn set_boolean_array_region(
|
|
2693
|
+
env: *JNIEnv,
|
|
2694
|
+
array: JBooleanArray,
|
|
2695
|
+
start: JSize,
|
|
2696
|
+
len: JSize,
|
|
2697
|
+
buf: [*]const JBoolean,
|
|
2698
|
+
) void {
|
|
2699
|
+
JNIInterface.call(
|
|
2700
|
+
env,
|
|
2701
|
+
.set_boolean_array_region,
|
|
2702
|
+
.{ array, start, len, buf },
|
|
2703
|
+
);
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2707
|
+
pub inline fn set_byte_array_region(
|
|
2708
|
+
env: *JNIEnv,
|
|
2709
|
+
array: JByteArray,
|
|
2710
|
+
start: JSize,
|
|
2711
|
+
len: JSize,
|
|
2712
|
+
buf: [*]const JByte,
|
|
2713
|
+
) void {
|
|
2714
|
+
JNIInterface.call(
|
|
2715
|
+
env,
|
|
2716
|
+
.set_byte_array_region,
|
|
2717
|
+
.{ array, start, len, buf },
|
|
2718
|
+
);
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2722
|
+
pub inline fn set_char_array_region(
|
|
2723
|
+
env: *JNIEnv,
|
|
2724
|
+
array: JCharArray,
|
|
2725
|
+
start: JSize,
|
|
2726
|
+
len: JSize,
|
|
2727
|
+
buf: [*]const JChar,
|
|
2728
|
+
) void {
|
|
2729
|
+
JNIInterface.call(
|
|
2730
|
+
env,
|
|
2731
|
+
.set_char_array_region,
|
|
2732
|
+
.{ array, start, len, buf },
|
|
2733
|
+
);
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2737
|
+
pub inline fn set_short_array_region(
|
|
2738
|
+
env: *JNIEnv,
|
|
2739
|
+
array: JShortArray,
|
|
2740
|
+
start: JSize,
|
|
2741
|
+
len: JSize,
|
|
2742
|
+
buf: [*]const JShort,
|
|
2743
|
+
) void {
|
|
2744
|
+
JNIInterface.call(
|
|
2745
|
+
env,
|
|
2746
|
+
.set_short_array_region,
|
|
2747
|
+
.{ array, start, len, buf },
|
|
2748
|
+
);
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2752
|
+
pub inline fn set_int_array_region(
|
|
2753
|
+
env: *JNIEnv,
|
|
2754
|
+
array: JIntArray,
|
|
2755
|
+
start: JSize,
|
|
2756
|
+
len: JSize,
|
|
2757
|
+
buf: [*]const JInt,
|
|
2758
|
+
) void {
|
|
2759
|
+
JNIInterface.call(
|
|
2760
|
+
env,
|
|
2761
|
+
.set_int_array_region,
|
|
2762
|
+
.{ array, start, len, buf },
|
|
2763
|
+
);
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2767
|
+
pub inline fn set_long_array_region(
|
|
2768
|
+
env: *JNIEnv,
|
|
2769
|
+
array: JLongArray,
|
|
2770
|
+
start: JSize,
|
|
2771
|
+
len: JSize,
|
|
2772
|
+
buf: [*]const JLong,
|
|
2773
|
+
) void {
|
|
2774
|
+
JNIInterface.call(
|
|
2775
|
+
env,
|
|
2776
|
+
.set_long_array_region,
|
|
2777
|
+
.{ array, start, len, buf },
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2782
|
+
pub inline fn set_float_array_region(
|
|
2783
|
+
env: *JNIEnv,
|
|
2784
|
+
array: JFloatArray,
|
|
2785
|
+
start: JSize,
|
|
2786
|
+
len: JSize,
|
|
2787
|
+
buf: [*]const JFloat,
|
|
2788
|
+
) void {
|
|
2789
|
+
JNIInterface.call(
|
|
2790
|
+
env,
|
|
2791
|
+
.set_float_array_region,
|
|
2792
|
+
.{ array, start, len, buf },
|
|
2793
|
+
);
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#setprimitivetypearrayregion-routines.
|
|
2797
|
+
pub inline fn set_double_array_region(
|
|
2798
|
+
env: *JNIEnv,
|
|
2799
|
+
array: JDoubleArray,
|
|
2800
|
+
start: JSize,
|
|
2801
|
+
len: JSize,
|
|
2802
|
+
buf: [*]const JDouble,
|
|
2803
|
+
) void {
|
|
2804
|
+
JNIInterface.call(
|
|
2805
|
+
env,
|
|
2806
|
+
.set_double_array_region,
|
|
2807
|
+
.{ array, start, len, buf },
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#registernatives.
|
|
2812
|
+
pub inline fn register_natives(
|
|
2813
|
+
env: *JNIEnv,
|
|
2814
|
+
clazz: JClass,
|
|
2815
|
+
methods: [*]const JNINativeMethod,
|
|
2816
|
+
methods_len: JInt,
|
|
2817
|
+
) JNIResultType {
|
|
2818
|
+
return JNIInterface.call(
|
|
2819
|
+
env,
|
|
2820
|
+
.register_natives,
|
|
2821
|
+
.{ clazz, methods, methods_len },
|
|
2822
|
+
);
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#unregisternatives.
|
|
2826
|
+
pub inline fn unregister_natives(
|
|
2827
|
+
env: *JNIEnv,
|
|
2828
|
+
clazz: JClass,
|
|
2829
|
+
) JNIResultType {
|
|
2830
|
+
return JNIInterface.call(
|
|
2831
|
+
env,
|
|
2832
|
+
.unregister_natives,
|
|
2833
|
+
.{clazz},
|
|
2834
|
+
);
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#monitorenter.
|
|
2838
|
+
pub inline fn monitor_enter(
|
|
2839
|
+
env: *JNIEnv,
|
|
2840
|
+
obj: JObject,
|
|
2841
|
+
) JNIResultType {
|
|
2842
|
+
return JNIInterface.call(
|
|
2843
|
+
env,
|
|
2844
|
+
.monitor_enter,
|
|
2845
|
+
.{obj},
|
|
2846
|
+
);
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#monitorexit.
|
|
2850
|
+
pub inline fn monitor_exit(
|
|
2851
|
+
env: *JNIEnv,
|
|
2852
|
+
obj: JObject,
|
|
2853
|
+
) JNIResultType {
|
|
2854
|
+
return JNIInterface.call(
|
|
2855
|
+
env,
|
|
2856
|
+
.monitor_exit,
|
|
2857
|
+
.{obj},
|
|
2858
|
+
);
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getjavavm.
|
|
2862
|
+
pub inline fn get_java_vm(
|
|
2863
|
+
env: *JNIEnv,
|
|
2864
|
+
vm: **JavaVM,
|
|
2865
|
+
) JNIResultType {
|
|
2866
|
+
return JNIInterface.call(
|
|
2867
|
+
env,
|
|
2868
|
+
.get_java_vm,
|
|
2869
|
+
.{vm},
|
|
2870
|
+
);
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringregion.
|
|
2874
|
+
pub inline fn get_string_region(
|
|
2875
|
+
env: *JNIEnv,
|
|
2876
|
+
string: JString,
|
|
2877
|
+
start: JSize,
|
|
2878
|
+
len: JSize,
|
|
2879
|
+
buf: [*]JChar,
|
|
2880
|
+
) void {
|
|
2881
|
+
JNIInterface.call(
|
|
2882
|
+
env,
|
|
2883
|
+
.get_string_region,
|
|
2884
|
+
.{ string, start, len, buf },
|
|
2885
|
+
);
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringutfregion.
|
|
2889
|
+
pub inline fn get_string_utf_region(
|
|
2890
|
+
env: *JNIEnv,
|
|
2891
|
+
string: JString,
|
|
2892
|
+
start: JSize,
|
|
2893
|
+
len: JSize,
|
|
2894
|
+
buf: [*]u8,
|
|
2895
|
+
) void {
|
|
2896
|
+
JNIInterface.call(
|
|
2897
|
+
env,
|
|
2898
|
+
.get_string_utf_region,
|
|
2899
|
+
.{ string, start, len, buf },
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getprimitivearraycritical.
|
|
2904
|
+
pub inline fn get_primitive_array_critical(
|
|
2905
|
+
env: *JNIEnv,
|
|
2906
|
+
array: JArray,
|
|
2907
|
+
is_copy: ?*JBoolean,
|
|
2908
|
+
) ?*anyopaque {
|
|
2909
|
+
return JNIInterface.call(
|
|
2910
|
+
env,
|
|
2911
|
+
.get_primitive_array_critical,
|
|
2912
|
+
.{ array, is_copy },
|
|
2913
|
+
);
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#releaseprimitivearraycritical.
|
|
2917
|
+
pub inline fn release_primitive_array_critical(
|
|
2918
|
+
env: *JNIEnv,
|
|
2919
|
+
array: JArray,
|
|
2920
|
+
c_array: *anyopaque,
|
|
2921
|
+
mode: JArrayReleaseMode,
|
|
2922
|
+
) void {
|
|
2923
|
+
JNIInterface.call(
|
|
2924
|
+
env,
|
|
2925
|
+
.release_primitive_array_critical,
|
|
2926
|
+
.{ array, c_array, mode },
|
|
2927
|
+
);
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringcritical-releasestringcritical.
|
|
2931
|
+
pub inline fn get_string_critical(
|
|
2932
|
+
env: *JNIEnv,
|
|
2933
|
+
string: JString,
|
|
2934
|
+
is_copy: ?*JBoolean,
|
|
2935
|
+
) ?[*]const JChar {
|
|
2936
|
+
return JNIInterface.call(
|
|
2937
|
+
env,
|
|
2938
|
+
.get_string_critical,
|
|
2939
|
+
.{ string, is_copy },
|
|
2940
|
+
);
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getstringcritical-releasestringcritical.
|
|
2944
|
+
pub inline fn release_string_critical(
|
|
2945
|
+
env: *JNIEnv,
|
|
2946
|
+
string: JString,
|
|
2947
|
+
chars: [*]const JChar,
|
|
2948
|
+
) void {
|
|
2949
|
+
JNIInterface.call(
|
|
2950
|
+
env,
|
|
2951
|
+
.release_string_critical,
|
|
2952
|
+
.{ string, chars },
|
|
2953
|
+
);
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
/// Returns NULL if obj refers to null, or if the VM runs out of memory.
|
|
2957
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newweakglobalref.
|
|
2958
|
+
pub inline fn new_weak_global_ref(
|
|
2959
|
+
env: *JNIEnv,
|
|
2960
|
+
obj: JObject,
|
|
2961
|
+
) JWeakReference {
|
|
2962
|
+
return JNIInterface.call(
|
|
2963
|
+
env,
|
|
2964
|
+
.new_weak_global_ref,
|
|
2965
|
+
.{obj},
|
|
2966
|
+
);
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#deleteweakglobalref.
|
|
2970
|
+
pub inline fn delete_weak_global_ref(
|
|
2971
|
+
env: *JNIEnv,
|
|
2972
|
+
ref: JWeakReference,
|
|
2973
|
+
) void {
|
|
2974
|
+
JNIInterface.call(
|
|
2975
|
+
env,
|
|
2976
|
+
.delete_weak_global_ref,
|
|
2977
|
+
.{ref},
|
|
2978
|
+
);
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
/// Returns true when there is a pending exception; otherwise, returns false.
|
|
2982
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#exceptioncheck.
|
|
2983
|
+
pub inline fn exception_check(
|
|
2984
|
+
env: *JNIEnv,
|
|
2985
|
+
) JBoolean {
|
|
2986
|
+
return JNIInterface.call(
|
|
2987
|
+
env,
|
|
2988
|
+
.exception_check,
|
|
2989
|
+
.{},
|
|
2990
|
+
);
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
/// Allocates and returns a direct java.nio.ByteBuffer.
|
|
2994
|
+
/// Returns NULL if an exception occurs,
|
|
2995
|
+
/// or if JNI access to direct buffers is not supported by this virtual machine.
|
|
2996
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#newdirectbytebuffer.
|
|
2997
|
+
pub inline fn new_direct_byte_buffer(
|
|
2998
|
+
env: *JNIEnv,
|
|
2999
|
+
address: *anyopaque,
|
|
3000
|
+
capacity: JLong,
|
|
3001
|
+
) JObject {
|
|
3002
|
+
return JNIInterface.call(
|
|
3003
|
+
env,
|
|
3004
|
+
.new_direct_byte_buffer,
|
|
3005
|
+
.{ address, capacity },
|
|
3006
|
+
);
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
/// Returns the starting address of the memory region referenced by the buffer.
|
|
3010
|
+
/// Returns NULL if the memory region is undefined,
|
|
3011
|
+
/// if the given object is not a direct java.nio.Buffer,
|
|
3012
|
+
/// or if JNI access to direct buffers is not supported by this virtual machine.
|
|
3013
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getdirectbufferaddress.
|
|
3014
|
+
pub inline fn get_direct_buffer_address(
|
|
3015
|
+
env: *JNIEnv,
|
|
3016
|
+
buf: JObject,
|
|
3017
|
+
) ?[*]u8 {
|
|
3018
|
+
return JNIInterface.call(
|
|
3019
|
+
env,
|
|
3020
|
+
.get_direct_buffer_address,
|
|
3021
|
+
.{buf},
|
|
3022
|
+
);
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
/// Returns the capacity of the memory region associated with the buffer.
|
|
3026
|
+
/// Returns -1 if the given object is not a direct java.nio.Buffer,
|
|
3027
|
+
/// if the object is an unaligned view buffer and the processor architecture
|
|
3028
|
+
/// does not support unaligned access,
|
|
3029
|
+
/// or if JNI access to direct buffers is not supported by this virtual machine.
|
|
3030
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getdirectbuffercapacity.
|
|
3031
|
+
pub inline fn get_direct_buffer_capacity(
|
|
3032
|
+
env: *JNIEnv,
|
|
3033
|
+
buf: JObject,
|
|
3034
|
+
) JLong {
|
|
3035
|
+
return JNIInterface.call(
|
|
3036
|
+
env,
|
|
3037
|
+
.get_direct_buffer_capacity,
|
|
3038
|
+
.{buf},
|
|
3039
|
+
);
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getobjectreftype.
|
|
3043
|
+
pub inline fn get_object_ref_type(
|
|
3044
|
+
env: *JNIEnv,
|
|
3045
|
+
obj: JObject,
|
|
3046
|
+
) JObjectRefType {
|
|
3047
|
+
return JNIInterface.call(
|
|
3048
|
+
env,
|
|
3049
|
+
.get_object_ref_type,
|
|
3050
|
+
.{obj},
|
|
3051
|
+
);
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/functions.html#getmodule.
|
|
3055
|
+
pub inline fn get_module(
|
|
3056
|
+
env: *JNIEnv,
|
|
3057
|
+
clazz: JClass,
|
|
3058
|
+
) JObject {
|
|
3059
|
+
return JNIInterface.call(
|
|
3060
|
+
env,
|
|
3061
|
+
.get_module,
|
|
3062
|
+
.{clazz},
|
|
3063
|
+
);
|
|
3064
|
+
}
|
|
3065
|
+
};
|
|
3066
|
+
|
|
3067
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#jni_createjavavm.
|
|
3068
|
+
pub const JavaVMOption = extern struct {
|
|
3069
|
+
/// The option as a string in the default platform encoding.
|
|
3070
|
+
option_string: [*:0]const u8,
|
|
3071
|
+
extra_info: ?*anyopaque = null,
|
|
3072
|
+
};
|
|
3073
|
+
|
|
3074
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#jni_createjavavm.
|
|
3075
|
+
pub const JavaVMInitArgs = extern struct {
|
|
3076
|
+
version: JInt,
|
|
3077
|
+
options_len: JInt,
|
|
3078
|
+
options: ?[*]JavaVMOption,
|
|
3079
|
+
ignore_unrecognized: JBoolean,
|
|
3080
|
+
};
|
|
3081
|
+
|
|
3082
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#attachcurrentthread.
|
|
3083
|
+
pub const JavaVMAttachArgs = extern struct {
|
|
3084
|
+
version: JInt,
|
|
3085
|
+
name: [*:0]const u8,
|
|
3086
|
+
group: JObject,
|
|
3087
|
+
};
|
|
3088
|
+
|
|
3089
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html
|
|
3090
|
+
pub const JavaVM = opaque {
|
|
3091
|
+
/// Each function is accessible at a fixed offset through the JavaVM argument.
|
|
3092
|
+
/// The JavaVM type is a pointer to the invocation API function table.
|
|
3093
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#invocation-api-functions.
|
|
3094
|
+
const FunctionTable = enum(usize) {
|
|
3095
|
+
/// Index 3: DestroyJavaVM.
|
|
3096
|
+
destroy_java_vm = 3,
|
|
3097
|
+
|
|
3098
|
+
/// Index 4: AttachCurrentThread.
|
|
3099
|
+
attach_current_thread = 4,
|
|
3100
|
+
|
|
3101
|
+
/// Index 5: DetachCurrentThread.
|
|
3102
|
+
detach_current_thread = 5,
|
|
3103
|
+
|
|
3104
|
+
/// Index 6: GetEnv.
|
|
3105
|
+
get_env = 6,
|
|
3106
|
+
|
|
3107
|
+
/// Index 7: AttachCurrentThreadAsDaemon.
|
|
3108
|
+
attach_current_thread_as_daemon = 7,
|
|
3109
|
+
};
|
|
3110
|
+
|
|
3111
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#jni_getdefaultjavavminitargs.
|
|
3112
|
+
pub const get_default_java_vm_init_args = struct {
|
|
3113
|
+
extern "jvm" fn JNI_GetDefaultJavaVMInitArgs(
|
|
3114
|
+
vm_args: ?*JavaVMInitArgs,
|
|
3115
|
+
) callconv(.c) JNIResultType;
|
|
3116
|
+
}.JNI_GetDefaultJavaVMInitArgs;
|
|
3117
|
+
|
|
3118
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#jni_get_createdjavavm.
|
|
3119
|
+
pub const get_created_java_vm = struct {
|
|
3120
|
+
extern "jvm" fn JNI_GetCreatedJavaVMs(
|
|
3121
|
+
vm_buf: [*]*JavaVM,
|
|
3122
|
+
buf_len: JSize,
|
|
3123
|
+
vm_len: ?*JSize,
|
|
3124
|
+
) callconv(.c) JNIResultType;
|
|
3125
|
+
}.JNI_GetCreatedJavaVMs;
|
|
3126
|
+
|
|
3127
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#jni_createjavavm.
|
|
3128
|
+
pub const create_java_vm = struct {
|
|
3129
|
+
extern "jvm" fn JNI_CreateJavaVM(
|
|
3130
|
+
jvm: **JavaVM,
|
|
3131
|
+
env: **JNIEnv,
|
|
3132
|
+
args: *JavaVMInitArgs,
|
|
3133
|
+
) callconv(.c) JNIResultType;
|
|
3134
|
+
}.JNI_CreateJavaVM;
|
|
3135
|
+
|
|
3136
|
+
const JNIInterface = JNIInterfaceType(JavaVM);
|
|
3137
|
+
|
|
3138
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#destroyjavavm.
|
|
3139
|
+
pub inline fn destroy_java_vm(
|
|
3140
|
+
vm: *JavaVM,
|
|
3141
|
+
) JNIResultType {
|
|
3142
|
+
return JNIInterface.call(
|
|
3143
|
+
vm,
|
|
3144
|
+
.destroy_java_vm,
|
|
3145
|
+
.{},
|
|
3146
|
+
);
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#attachcurrentthread.
|
|
3150
|
+
pub inline fn attach_current_thread(
|
|
3151
|
+
vm: *JavaVM,
|
|
3152
|
+
env: **JNIEnv,
|
|
3153
|
+
args: ?*JavaVMAttachArgs,
|
|
3154
|
+
) JNIResultType {
|
|
3155
|
+
return JNIInterface.call(
|
|
3156
|
+
vm,
|
|
3157
|
+
.attach_current_thread,
|
|
3158
|
+
.{ env, args },
|
|
3159
|
+
);
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#detachcurrentthread.
|
|
3163
|
+
pub inline fn detach_current_thread(
|
|
3164
|
+
vm: *JavaVM,
|
|
3165
|
+
) JNIResultType {
|
|
3166
|
+
return JNIInterface.call(
|
|
3167
|
+
vm,
|
|
3168
|
+
.detach_current_thread,
|
|
3169
|
+
.{},
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#attach_currentthreadasdaemon.
|
|
3174
|
+
pub inline fn attach_current_thread_as_daemon(
|
|
3175
|
+
vm: *JavaVM,
|
|
3176
|
+
env: **JNIEnv,
|
|
3177
|
+
args: ?*JavaVMAttachArgs,
|
|
3178
|
+
) JNIResultType {
|
|
3179
|
+
return JNIInterface.call(
|
|
3180
|
+
vm,
|
|
3181
|
+
.attach_current_thread_as_daemon,
|
|
3182
|
+
.{ env, args },
|
|
3183
|
+
);
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
/// https://docs.oracle.com/en/java/javase/17/docs/specs/jni/invocation.html#getenv
|
|
3187
|
+
pub inline fn get_env(
|
|
3188
|
+
vm: *JavaVM,
|
|
3189
|
+
env: **JNIEnv,
|
|
3190
|
+
version: JInt,
|
|
3191
|
+
) JNIResultType {
|
|
3192
|
+
return JNIInterface.call(
|
|
3193
|
+
vm,
|
|
3194
|
+
.get_env,
|
|
3195
|
+
.{ env, version },
|
|
3196
|
+
);
|
|
3197
|
+
}
|
|
3198
|
+
};
|
|
3199
|
+
|
|
3200
|
+
/// Invokes a function at the offset of the vtable, allowing to utilize the function pointer
|
|
3201
|
+
/// without the need to declare a VTable layout, where the ordering of fields defines the ABI.
|
|
3202
|
+
/// The function index is stored within T.FunctionTable enum, which only holds the index value.
|
|
3203
|
+
/// The function signature is declared as an inline function within the T opaque type.
|
|
3204
|
+
fn JNIInterfaceType(comptime T: type) type {
|
|
3205
|
+
return struct {
|
|
3206
|
+
fn JniFnType(comptime function: T.FunctionTable) type {
|
|
3207
|
+
const Fn = @TypeOf(@field(T, @tagName(function)));
|
|
3208
|
+
var fn_info = @typeInfo(Fn);
|
|
3209
|
+
switch (fn_info) {
|
|
3210
|
+
.@"fn" => {
|
|
3211
|
+
fn_info.@"fn".calling_convention = .c;
|
|
3212
|
+
return @Type(fn_info);
|
|
3213
|
+
},
|
|
3214
|
+
else => @compileError("Expected " ++ @tagName(function) ++ " to be a function"),
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
pub inline fn call(
|
|
3219
|
+
self: *T,
|
|
3220
|
+
comptime function: T.FunctionTable,
|
|
3221
|
+
args: anytype,
|
|
3222
|
+
) return_type: {
|
|
3223
|
+
const type_info = @typeInfo(JniFnType(function));
|
|
3224
|
+
break :return_type type_info.@"fn".return_type.?;
|
|
3225
|
+
} {
|
|
3226
|
+
const Fn = JniFnType(function);
|
|
3227
|
+
const VTable = extern struct {
|
|
3228
|
+
functions: [*]const *const anyopaque,
|
|
3229
|
+
};
|
|
3230
|
+
|
|
3231
|
+
const vtable: *VTable = @ptrCast(@alignCast(self));
|
|
3232
|
+
const fn_ptr: *const Fn = @ptrCast(@alignCast(
|
|
3233
|
+
vtable.functions[@intFromEnum(function)],
|
|
3234
|
+
));
|
|
3235
|
+
return @call(.auto, fn_ptr, .{self} ++ args);
|
|
3236
|
+
}
|
|
3237
|
+
};
|
|
3238
|
+
}
|