From 0df2bca9dc99172e7cd41fb506ed5d87c6b85197 Mon Sep 17 00:00:00 2001 From: Jan Cristina Date: Fri, 20 Sep 2024 11:40:22 +0200 Subject: [PATCH] move-panama-backend - cleanup filed and fix makefile --- Cargo.lock | 18 +- Makefile.toml | 561 +- build-feature.sh | 4 +- cli/src/backend/mod.rs | 21 +- feature/Cargo.toml | 2 +- .../dev/diplomattest/somelib/ErrorEnum.java | 45 - .../dev/diplomattest/somelib/ErrorStruct.java | 53 - .../somelib/ntv/ErrorEnum_option.java | 178 - .../diplomattest/somelib/ntv/ErrorStruct.java | 173 - .../somelib/ntv/ErrorStruct_option.java | 178 - .../diplomattest/somelib/ntv/somelib_h.java | 22 +- .../main/dev/diplomattest/somelib/Bar.java | 64 - .../diplomattest/somelib/BorrowedFields.java | 96 - .../somelib/BorrowedFieldsReturning.java | 53 - .../somelib/BorrowedFieldsWithBounds.java | 100 - .../diplomattest/somelib/ContiguousEnum.java | 59 - .../diplomattest/somelib/CyclicStructA.java | 59 - .../diplomattest/somelib/CyclicStructB.java | 59 - .../dev/diplomattest/somelib/Float64Vec.java | 266 - .../main/dev/diplomattest/somelib/Foo.java | 136 - .../diplomattest/somelib/ImportedStruct.java | 53 - .../main/dev/diplomattest/somelib/Lib.java | 205 - .../main/dev/diplomattest/somelib/MyEnum.java | 82 - .../dev/diplomattest/somelib/MyString.java | 142 - .../dev/diplomattest/somelib/MyStruct.java | 95 - .../main/dev/diplomattest/somelib/MyZst.java | 33 - .../somelib/NestedBorrowedFields.java | 99 - .../main/dev/diplomattest/somelib/One.java | 240 - .../main/dev/diplomattest/somelib/Opaque.java | 136 - .../somelib/OpaqueMutexedString.java | 148 - .../dev/diplomattest/somelib/RefList.java | 62 - .../somelib/RefListParameter.java | 45 - .../main/dev/diplomattest/somelib/Two.java | 49 - .../diplomattest/somelib/UnimportedEnum.java | 52 - .../dev/diplomattest/somelib/Utf16Wrap.java | 88 - .../somelib/ntv/BorrowedFields.java | 219 - .../somelib/ntv/BorrowedFieldsReturning.java | 127 - .../ntv/BorrowedFieldsReturning_option.java | 178 - .../somelib/ntv/BorrowedFieldsWithBounds.java | 219 - .../ntv/BorrowedFieldsWithBounds_option.java | 178 - .../somelib/ntv/BorrowedFields_option.java | 178 - .../somelib/ntv/ContiguousEnum_option.java | 178 - .../somelib/ntv/CyclicStructA.java | 127 - .../somelib/ntv/CyclicStructA_option.java | 177 - .../somelib/ntv/CyclicStructB.java | 127 - .../somelib/ntv/CyclicStructB_option.java | 177 - .../somelib/ntv/DiplomatBoolArray.java | 173 - .../somelib/ntv/DiplomatBoolView.java | 173 - .../somelib/ntv/DiplomatBoolViewMut.java | 173 - .../somelib/ntv/DiplomatCharArray.java | 173 - .../somelib/ntv/DiplomatCharView.java | 173 - .../somelib/ntv/DiplomatCharViewMut.java | 173 - .../somelib/ntv/DiplomatF32Array.java | 173 - .../somelib/ntv/DiplomatF32View.java | 173 - .../somelib/ntv/DiplomatF32ViewMut.java | 173 - .../somelib/ntv/DiplomatF64Array.java | 173 - .../somelib/ntv/DiplomatF64View.java | 173 - .../somelib/ntv/DiplomatF64ViewMut.java | 173 - .../somelib/ntv/DiplomatI16Array.java | 173 - .../somelib/ntv/DiplomatI16View.java | 173 - .../somelib/ntv/DiplomatI16ViewMut.java | 173 - .../somelib/ntv/DiplomatI32Array.java | 173 - .../somelib/ntv/DiplomatI32View.java | 173 - .../somelib/ntv/DiplomatI32ViewMut.java | 173 - .../somelib/ntv/DiplomatI64Array.java | 173 - .../somelib/ntv/DiplomatI64View.java | 173 - .../somelib/ntv/DiplomatI64ViewMut.java | 173 - .../somelib/ntv/DiplomatI8Array.java | 173 - .../somelib/ntv/DiplomatI8View.java | 173 - .../somelib/ntv/DiplomatI8ViewMut.java | 173 - .../somelib/ntv/DiplomatIsizeArray.java | 173 - .../somelib/ntv/DiplomatIsizeView.java | 173 - .../somelib/ntv/DiplomatIsizeViewMut.java | 173 - .../somelib/ntv/DiplomatString16Array.java | 173 - .../somelib/ntv/DiplomatString16View.java | 173 - .../somelib/ntv/DiplomatString16ViewMut.java | 173 - .../somelib/ntv/DiplomatStringArray.java | 173 - .../somelib/ntv/DiplomatStringView.java | 173 - .../somelib/ntv/DiplomatStringViewMut.java | 173 - .../somelib/ntv/DiplomatStrings16Array.java | 173 - .../somelib/ntv/DiplomatStrings16View.java | 173 - .../somelib/ntv/DiplomatStrings16ViewMut.java | 173 - .../somelib/ntv/DiplomatStringsArray.java | 173 - .../somelib/ntv/DiplomatStringsView.java | 173 - .../somelib/ntv/DiplomatStringsViewMut.java | 173 - .../somelib/ntv/DiplomatU16Array.java | 173 - .../somelib/ntv/DiplomatU16View.java | 173 - .../somelib/ntv/DiplomatU16ViewMut.java | 173 - .../somelib/ntv/DiplomatU32Array.java | 173 - .../somelib/ntv/DiplomatU32View.java | 173 - .../somelib/ntv/DiplomatU32ViewMut.java | 173 - .../somelib/ntv/DiplomatU64Array.java | 173 - .../somelib/ntv/DiplomatU64View.java | 173 - .../somelib/ntv/DiplomatU64ViewMut.java | 173 - .../somelib/ntv/DiplomatU8Array.java | 173 - .../somelib/ntv/DiplomatU8View.java | 173 - .../somelib/ntv/DiplomatU8ViewMut.java | 173 - .../somelib/ntv/DiplomatUsizeArray.java | 173 - .../somelib/ntv/DiplomatUsizeView.java | 173 - .../somelib/ntv/DiplomatUsizeViewMut.java | 173 - .../somelib/ntv/DiplomatWrite.java | 512 - .../dev/diplomattest/somelib/ntv/FILE.java | 47 - .../somelib/ntv/ImportedStruct.java | 174 - .../somelib/ntv/ImportedStruct_option.java | 178 - .../somelib/ntv/MyEnum_option.java | 178 - .../diplomattest/somelib/ntv/MyStruct.java | 405 - .../somelib/ntv/MyStruct_option.java | 178 - .../somelib/ntv/NestedBorrowedFields.java | 219 - .../ntv/NestedBorrowedFields_option.java | 178 - .../diplomattest/somelib/ntv/OptionBool.java | 177 - .../diplomattest/somelib/ntv/OptionChar.java | 178 - .../diplomattest/somelib/ntv/OptionF32.java | 178 - .../diplomattest/somelib/ntv/OptionF64.java | 178 - .../diplomattest/somelib/ntv/OptionI16.java | 178 - .../diplomattest/somelib/ntv/OptionI32.java | 178 - .../diplomattest/somelib/ntv/OptionI64.java | 178 - .../diplomattest/somelib/ntv/OptionI8.java | 177 - .../diplomattest/somelib/ntv/OptionIsize.java | 178 - .../diplomattest/somelib/ntv/OptionU16.java | 178 - .../diplomattest/somelib/ntv/OptionU32.java | 178 - .../diplomattest/somelib/ntv/OptionU64.java | 178 - .../diplomattest/somelib/ntv/OptionU8.java | 177 - .../diplomattest/somelib/ntv/OptionUsize.java | 178 - .../somelib/ntv/UnimportedEnum_option.java | 178 - .../somelib/ntv/__darwin_mbstate_t.java | 26 - .../somelib/ntv/__darwin_pthread_attr_t.java | 29 - .../somelib/ntv/__darwin_pthread_cond_t.java | 29 - .../ntv/__darwin_pthread_condattr_t.java | 29 - .../ntv/__darwin_pthread_handler_rec.java | 272 - .../somelib/ntv/__darwin_pthread_mutex_t.java | 29 - .../ntv/__darwin_pthread_mutexattr_t.java | 29 - .../somelib/ntv/__darwin_pthread_once_t.java | 29 - .../ntv/__darwin_pthread_rwlock_t.java | 29 - .../ntv/__darwin_pthread_rwlockattr_t.java | 29 - .../diplomattest/somelib/ntv/__mbstate_t.java | 206 - .../dev/diplomattest/somelib/ntv/__sFILE.java | 1292 -- .../dev/diplomattest/somelib/ntv/__sbuf.java | 174 - .../somelib/ntv/_opaque_pthread_attr_t.java | 206 - .../somelib/ntv/_opaque_pthread_cond_t.java | 206 - .../ntv/_opaque_pthread_condattr_t.java | 206 - .../somelib/ntv/_opaque_pthread_mutex_t.java | 206 - .../ntv/_opaque_pthread_mutexattr_t.java | 206 - .../somelib/ntv/_opaque_pthread_once_t.java | 206 - .../somelib/ntv/_opaque_pthread_rwlock_t.java | 206 - .../ntv/_opaque_pthread_rwlockattr_t.java | 206 - .../somelib/ntv/_opaque_pthread_t.java | 252 - .../diplomattest/somelib/ntv/funopen$x0.java | 70 - .../diplomattest/somelib/ntv/funopen$x1.java | 70 - .../diplomattest/somelib/ntv/funopen$x2.java | 70 - .../diplomattest/somelib/ntv/funopen$x3.java | 68 - .../diplomattest/somelib/ntv/somelib_h.java | 15429 ---------------- .../java/dev/diplomattest/somelib/Lib.java | 205 - 152 files changed, 46 insertions(+), 39607 deletions(-) delete mode 100644 feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorEnum.java delete mode 100644 feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorStruct.java delete mode 100644 feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorEnum_option.java delete mode 100644 feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct.java delete mode 100644 feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Bar.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFields.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsReturning.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsWithBounds.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ContiguousEnum.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructA.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructB.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Float64Vec.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Foo.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ImportedStruct.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Lib.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/MyEnum.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/MyString.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/MyStruct.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/MyZst.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/NestedBorrowedFields.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/One.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Opaque.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/OpaqueMutexedString.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/RefList.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/RefListParameter.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Two.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/UnimportedEnum.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/Utf16Wrap.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/ContiguousEnum_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolArray.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolView.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharArray.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharView.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeArray.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeView.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringArray.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringView.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsArray.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsView.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8Array.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8View.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8ViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeArray.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeView.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeViewMut.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatWrite.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/FILE.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyEnum_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionBool.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionChar.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF32.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF64.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI16.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI32.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI64.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI8.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionIsize.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU16.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU32.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU64.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU8.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionUsize.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/UnimportedEnum_option.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_mbstate_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_attr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_cond_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_condattr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_handler_rec.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutex_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutexattr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_once_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlock_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlockattr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__mbstate_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sFILE.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sbuf.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_attr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_cond_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_condattr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutex_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutexattr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_once_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlock_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlockattr_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_t.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x0.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x1.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x2.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x3.java delete mode 100644 feature/tmp/src/main/dev/diplomattest/somelib/ntv/somelib_h.java delete mode 100644 feature/tmp/src/main/java/dev/diplomattest/somelib/Lib.java diff --git a/Cargo.lock b/Cargo.lock index 08adb49..3c6b8ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -195,15 +195,6 @@ dependencies = [ "syn", ] -[[package]] -name = "diplomat-feature-tests" -version = "0.0.0" -dependencies = [ - "diplomat", - "diplomat-runtime", - "log", -] - [[package]] name = "diplomat-java" version = "0.1.0" @@ -295,6 +286,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "feature-tests" +version = "0.0.0" +dependencies = [ + "diplomat", + "diplomat-runtime", + "log", +] + [[package]] name = "getopts" version = "0.2.21" diff --git a/Makefile.toml b/Makefile.toml index 6fd1f3e..b9fcbe3 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,225 +1,8 @@ [config] default_to_workspace = false -# If adding a new backend, be sure to update: -# - test-native (if necessary) -# - test-example -# - test-feature -# - gen-example -# - gen-feature -# -# You will likely also want to add {gen, test}-{feature, example}-[backend] and -# {gen, test}-[backend] - # Metatasks invoked by CI -[tasks.test-native] -description = "Test only the native" -category = "Tests" -dependencies = [ - "test-cpp", - "test-c", -] - -[tasks.gen] -category = "Code generation" -dependencies = [ - "gen-feature", - "gen-example", -] - # Tests -[tasks.test-all] -category = "Tests" -dependencies = [ - "test-example", - "test-feature", -] - -[tasks.test-cpp] -category = "Tests" -dependencies = [ - "test-cpp-example", - "test-cpp-feature", -] - -[tasks.test-c] -category = "Tests" -dependencies = [ - "test-c-example", -] - -[tasks.test-js] -category = "Tests" -dependencies = [ - "test-js-feature", -] - -[tasks.test-demo] -category = "Tests" -dependencies = [ - "test-demo-feature", - "test-demo-example" -] - -[tasks.test-dart] -category = "Tests" -dependencies = [ - "test-dart-example", - "test-dart-feature", -] - -[tasks.test-kotlin] -category = "Tests" -dependencies = [ - "test-kotlin-example", - "test-kotlin-feature", -] - -[tasks.test-java] -category = "Tests" -dependencies = [ - "test-java-feature", -] - -[tasks.test-example] -category = "Tests" -dependencies = [ - "test-cpp-example", - "test-c-example", - "test-demo-example", - "test-dart-example", - "test-kotlin-example", -] - -[tasks.test-feature] -category = "Tests" -dependencies = [ - "test-cpp-feature", - "test-js-feature", - "test-demo-feature", - "test-dart-feature", - "test-kotlin-feature", - "test-java-feature", -] - -[tasks.test-cpp-example] -category = "Tests" -dependencies = ["build-example"] -script_runner = "@duckscript" -script = ''' -exit_on_error true -cd example/cpp -rm tests/*.out -exec --fail-on-error make -''' - -[tasks.test-cpp-feature] -category = "Tests" -dependencies = ["build-feature"] -script_runner = "@duckscript" -script = ''' -exit_on_error true -cd feature_tests/cpp -rm tests/*.out -exec --fail-on-error make -''' - -[tasks.test-c-example] -category = "Tests" -dependencies = ["build-example"] -script_runner = "@duckscript" -script = ''' -exit_on_error true -cd example/c -rm *.out -exec --fail-on-error make -''' - -[tasks.test-js-feature] -category = "Tests" -dependencies = ["build-feature-wasm"] -script_runner = "@shell" -script = ''' -cd feature_tests/js/ -cp ../../target/wasm32-unknown-unknown/debug/diplomat_feature_tests.wasm api/diplomat_feature_tests.wasm -npm install && npm run test -''' - -[tasks.test-demo-feature] -category = "Tests" -dependencies = ["build-feature-wasm"] -script_runner = "@shell" -script = ''' -cd feature_tests/demo_gen -cp ../../target/wasm32-unknown-unknown/debug/diplomat_feature_tests.wasm ../js/api/diplomat_feature_tests.wasm -npm install && npm run test -''' - -[tasks.test-demo-example] -category = "Tests" -dependencies = ["build-example-wasm"] -script_runner = "@shell" -script = ''' -cd example/demo_gen -cp ../../target/wasm32-unknown-unknown/debug/diplomat_example.wasm ../js/lib/api/diplomat_example.wasm -npm install && npm run test -''' - -[tasks.test-dart-example] -category = "Tests" -script_runner = "@duckscript" -dependencies = ["build-example"] -script = ''' -exit_on_error true -cd example/dart/ -exec --fail-on-error dart --enable-experiment=native-assets pub get -exec --fail-on-error dart --enable-experiment=native-assets test -''' - -[tasks.test-dart-feature] -category = "Tests" -script_runner = "@duckscript" -dependencies = ["build-feature"] -script = ''' -exit_on_error true -cd feature_tests/dart/ -exec --fail-on-error dart --enable-experiment=native-assets pub get -exec --fail-on-error dart --enable-experiment=native-assets test -''' - -[tasks.test-kotlin-example.mac] -env = {"OUT_FILE" = "dylib"} - -[tasks.test-kotlin-example.linux] -env = {"OUT_FILE" = "so", "LD_LIBRARY_PATH" = "./"} - -[tasks.test-kotlin-example] -category = "Tests" -script_runner = "@duckscript" -dependencies = ["build-example-jvm"] -script = ''' -exit_on_error true -cp target/debug/libdiplomat_example.${OUT_FILE} example/kotlin/somelib/libsomelib.${OUT_FILE} -cd example/kotlin/somelib -exec --fail-on-error gradle test --warning-mode all -''' - -[tasks.test-kotlin-feature.mac] -env = {"OUT_FILE" = "dylib"} - -[tasks.test-kotlin-feature.linux] -env = {"OUT_FILE" = "so", "LD_LIBRARY_PATH" = "./"} - -[tasks.test-kotlin-feature] -category = "Tests" -script_runner = "@duckscript" -dependencies = ["build-feature-jvm"] -script = ''' -exit_on_error true -cp target/debug/libdiplomat_feature_tests.${OUT_FILE} feature_tests/kotlin/somelib/libsomelib.${OUT_FILE} -cd feature_tests/kotlin/somelib -exec --fail-on-error gradle test --warning-mode all -''' [tasks.test-java-feature.mac] env = {"OUT_FILE" = "dylib"} @@ -229,357 +12,41 @@ env = {"OUT_FILE" = "so", "LD_LIBRARY_PATH" = "./"} [tasks.test-java-feature] category = "Tests" -script_runner = "@duckscript" +script_runner = "@bash" dependencies = ["build-feature"] script = ''' -exit_on_error true -cp target/debug/libdiplomat_feature_tests.${OUT_FILE} feature_tests/java/somelib/libsomelib.${OUT_FILE} -cd feature_tests/java/somelib -exec --fail-on-error mvn test -''' - -[tasks.check-c-example] -category = "Tests" -script_runner = "@duckscript" -script = ''' -exit_on_error true -cc = get_env CC -if is_empty ${cc} - cc = set "gcc" -end -c_std = get_env C_STD -if is_empty ${c_std} - c_std = set "c11" -end - -cd example/c/include -files_list = glob_array "./*.h" -exit_code = set 0 -for file in ${files_list} - echo "Checking ${file}" - output = exec --get-exit-code ${cc} -std=${c_std} -pedantic-errors -Wall ${file} - exit_code = set ${exit_code} or ${output} -end -exit ${exit_code} -''' - -[tasks.check-c-feature] -category = "Tests" -script_runner = "@duckscript" -script = ''' -exit_on_error true -cc = get_env CC -if is_empty ${cc} - cc = set "gcc" -end -c_std = get_env C_STD -if is_empty ${c_std} - c_std = set "c11" -end - -cd feature_tests/c/include -files_list = glob_array "./*.h" -exit_code = set 0 -for file in ${files_list} - echo "Checking ${file}" - output = exec --get-exit-code ${cc} -std=${c_std} -pedantic-errors -Wall ${file} - exit_code = set ${exit_code} or ${output} -end -exit ${exit_code} -''' - -[tasks.check-c] -category = "Tests" -dependencies = [ - "check-c-feature", - "check-c-example", -] - -[tasks.check-cpp-example] -category = "Tests" -script_runner = "@duckscript" -script = ''' -exit_on_error true -cxx = get_env CXX -if is_empty ${cxx} - cxx = set "g++" -end -cxx_std = get_env CXX_STD -if is_empty ${cxx_std} - cxx_std = set "c++17" -end - -cd example/cpp/include -files_list = glob_array "./*.hpp" -exit_code = set 0 -for file in ${files_list} - echo "Checking ${file}" - output = exec --get-exit-code ${cxx} -std=${cxx_std} -pedantic-errors -Wall ${file} - exit_code = set ${exit_code} or ${output} -end -exit ${exit_code} -''' - -[tasks.check-cpp-feature] -category = "Tests" -script_runner = "@duckscript" -script = ''' -exit_on_error true -cxx = get_env CXX -if is_empty ${cxx} - cxx = set "g++" -end -cxx_std = get_env CXX_STD -if is_empty ${cxx_std} - cxx_std = set "c++17" -end - -cd feature_tests/cpp/include -files_list = glob_array "./*.hpp" -exit_code = set 0 -for file in ${files_list} - echo "Checking ${file}" - output = exec --get-exit-code ${cxx} -std=${cxx_std} -pedantic-errors -Wall ${file} - exit_code = set ${exit_code} or ${output} -end -exit ${exit_code} -''' - -[tasks.check-cpp] -category = "Tests" -dependencies = [ - "check-cpp-feature", - "check-cpp-example", -] - - -# Generation -[tasks.gen-feature] -category = "Code generation" -dependencies = [ - "gen-cpp-feature", - "gen-c-feature", - "gen-js-feature", - "gen-demo-feature", - "gen-dart-feature", - "gen-kotlin-feature", -] - -[tasks.gen-example] -category = "Code generation" -dependencies = [ - "gen-cpp-example", - "gen-c-example", - "gen-js-example", - "gen-demo-example", - "gen-dart-example", - "gen-kotlin-example", -] - - -[tasks.gen-c] -category = "Code generation" -dependencies = [ - "gen-c-feature", - "gen-c-example" -] -[tasks.gen-cpp] -category = "Code generation" -dependencies = [ - "gen-cpp-feature", - "gen-cpp-example" -] - -[tasks.gen-dart] -category = "Code generation" -dependencies = [ - "gen-dart-feature", - "gen-dart-example", -] - -[tasks.gen-kotlin] -category = "Code generation" -dependencies = [ - "gen-kotlin-feature", - "gen-kotlin-example", -] - -[tasks.gen-java] -category = "Code generation" -dependencies = [ - "gen-java-feature", -] - - - - -[tasks.gen-c-feature] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests c include -''' - -[tasks.gen-c-example] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic example c include -''' - -[tasks.gen-cpp-feature] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests cpp include -''' - -[tasks.gen-cpp-example] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic example cpp include -''' - - -[tasks.gen-js-feature] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests js api -''' - -[tasks.gen-js-example] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic example js lib/api +cargo build --release -p feature-tests +cp target/debug/libfeature_test.{OUTFILE} feature/java/somelib/libsomelib.{OUTFILE} +cd feature/java/somelib +mvn test ''' -[tasks.gen-demo-feature] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests demo_gen demo "-l diplomat-demo-conf.toml" -''' - -[tasks.gen-demo-example] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic example demo_gen demo "-l diplomat-demo-conf.toml" -''' - -[tasks.gen-dart-feature] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests dart lib/src -''' - -[tasks.gen-dart-example] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic example dart lib/src -''' [tasks.gen-java-feature] category = "Code generation" -script_runner = "@duckscript" +script_runner = "@bash" script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests java somelib "-l diplomat-java-conf.toml" /src/main/java +mkdir feature/tmp +cargo run -p diplomat-java -- -e feature/src/lib.rs -l feature/diplomat-java-conf.toml feature/tmp/ +rm -r feature/java/somelib/src/main +mv feature/tmp/src/main feature/java/somelib/src/main +rm -r feature/tmp ''' -# this task generates all of the kotlin code but does not copy generated project files over -# we only copy the generated main src files to preserve the tests -[tasks.gen-kotlin-feature] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic feature_tests kotlin somelib "-l diplomat-kt-conf.toml" /src/main/kotlin -''' - -[tasks.gen-kotlin-example] -category = "Code generation" -script_runner = "@duckscript" -script = ''' -exit_on_error true -!include_files ./support/functions.ds -generate_generic example kotlin somelib "-l diplomat-kt-conf.toml" /src/main/kotlin -''' - # Build deps -[tasks.build-tool] -description = "Build diplomat-tool" -category = "Plumbing" -command = "cargo" -args = ["build", "-p", "diplomat-tool"] -[tasks.build-example] -description = "Build example" -category = "Plumbing" -command = "cargo" -args = ["build", "-p", "diplomat-example"] [tasks.build-feature] description = "Build feature_tests" category = "Plumbing" command = "cargo" -args = ["build", "-p", "diplomat-feature-tests"] -[tasks.build-example-wasm] -description = "Build feature_tests for wasm" -category = "Plumbing" -command = "cargo" -args = ["build", "-p", "diplomat-example", "--target", "wasm32-unknown-unknown"] -[tasks.build-feature-wasm] -description = "Build feature_tests for wasm" -category = "Plumbing" -command = "cargo" -args = ["build", "-p", "diplomat-feature-tests", "--target", "wasm32-unknown-unknown"] - - -[tasks.build-example-jvm] -description = "Build feature_tests for wasm" -category = "Plumbing" -command = "cargo" -args = ["build", "-p", "diplomat-example", "--features", "diplomat-runtime/jvm-callback-support"] -[tasks.build-feature-jvm] -description = "Build feature_tests for wasm" -category = "Plumbing" -command = "cargo" -args = ["build", "-p", "diplomat-feature-tests", "--features", "diplomat-runtime/jvm-callback-support"] - +args = ["build", "-p", "feature-tests"] -[tasks.bench-rust-example] +[tasks.bench-rust-feature] description = "Benchmark rust example" category = "Benchmark" script = ''' cargo bench --package diplomat-example ''' -[tasks.bench-kotlin-example] +[tasks.bench-java-feature] description = "Benchmark kotlin example" category = "Benchmark" dependencies = ["gen-kotlin-example", "test-kotlin-example"] diff --git a/build-feature.sh b/build-feature.sh index 1193d70..da63f8f 100644 --- a/build-feature.sh +++ b/build-feature.sh @@ -1,3 +1,5 @@ mkdir feature/tmp cargo run -p diplomat-java -- -e feature/src/lib.rs -l feature/diplomat-java-conf.toml feature/tmp/ -mv feature/tmp/* feature/java/somelib/ +rm -r feature/java/somelib/src/main +mv feature/tmp/src/main feature/java/somelib/src/main +rm -r feature/tmp diff --git a/cli/src/backend/mod.rs b/cli/src/backend/mod.rs index 394cfa1..a83191e 100644 --- a/cli/src/backend/mod.rs +++ b/cli/src/backend/mod.rs @@ -17,8 +17,6 @@ use serde::Deserialize; use diplomat_tool::{ErrorStore, FileMap}; const TMP_C_DIR: &str = "tmp"; -const _TMP_LIB_NAME: &str = "dev/diplomattest/somelib"; // todo: build from conf -const _JAVA_DIR: &str = "src/main/"; mod formatter; @@ -128,7 +126,10 @@ pub(crate) fn run<'a>( unreachable!("Encountered unknown variant: {unknown:?} while parsing all types") } }; - files.add_file(format!("src/main/{domain_path}/{lib_name}/{file}",), body); + files.add_file( + format!("src/main/java/{domain_path}/{lib_name}/{file}",), + body, + ); } let c_errors = c_errors.take_all(); @@ -178,7 +179,7 @@ pub(crate) fn run<'a>( .arg("--include-dir") .arg(&tmp_path) .arg("--output") - .arg(out_folder.join("src/main/")) + .arg(out_folder.join("src/main/java")) .arg("--target-package") .arg(package) .arg("--library") @@ -191,6 +192,17 @@ pub(crate) fn run<'a>( command.arg("-r").arg(tmp_path).output() }; + let remove_extraneous_files = || { + let mut command = std::process::Command::new("rm"); + command + .arg("-r") + .arg(out_folder.join(format!( + "/src/main/{domain}/{lib_name}/{{_*, funopen*, FILE.java}}", + domain = domain.replace(".", "/") + ))) + .output() + }; + match command.output() { Err(err) => match err.kind() { std::io::ErrorKind::NotFound => { @@ -211,6 +223,7 @@ pub(crate) fn run<'a>( let stderr = String::from_utf8_lossy(&ok.stderr); println!("Std Err from jextract:\n{stderr}"); + remove_extraneous_files().expect("Failed to remove extraneous files"); } } diff --git a/feature/Cargo.toml b/feature/Cargo.toml index fcec60b..f5f670c 100644 --- a/feature/Cargo.toml +++ b/feature/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "diplomat-feature-tests" +name = "feature-tests" version = "0.0.0" publish = false authors = [ diff --git a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorEnum.java b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorEnum.java deleted file mode 100644 index 53838c8..0000000 --- a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.somelib_h; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; - -public enum ErrorEnum { - Foo, - Bar, - ; - - static ErrorEnum fromInt(int i) { - switch (i) { - case 0 -> { - return ErrorEnum.Foo; - } - case 1 -> { - return ErrorEnum.Bar; - } - - } - throw new RuntimeException("Unexpected int for ErrorEnum:" + i); - } - - int toInt() { - switch (this) { - case Foo -> { - return 0; - } - case Bar -> { - return 1; - } - - } - throw new RuntimeException("Unexpected variant for ErrorEnum:" + this); - } - - -} diff --git a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorStruct.java b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorStruct.java deleted file mode 100644 index 8414d57..0000000 --- a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ErrorStruct.java +++ /dev/null @@ -1,53 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class ErrorStruct { - int i; - int j; - - - List selfEdges = List.of(); - - - private ErrorStruct() { - } - - ErrorStruct(MemorySegment structSegment) { - this.selfEdges = selfEdges; - - - var iNative = dev.diplomattest.somelib.ntv.ErrorStruct.i(structSegment); - var iVal = iNative; - this.i = iVal; - var jNative = dev.diplomattest.somelib.ntv.ErrorStruct.j(structSegment); - var jVal = jNative; - this.j = jVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.ErrorStruct.allocate(arena); - - var iNative = i; - dev.diplomattest.somelib.ntv.ErrorStruct.i(returnVal, iNative); - var jNative = j; - dev.diplomattest.somelib.ntv.ErrorStruct.j(returnVal, jNative); - - - return returnVal; - - } - -} - diff --git a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorEnum_option.java b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorEnum_option.java deleted file mode 100644 index 9652da7..0000000 --- a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorEnum_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct ErrorEnum_option { - * union { - * ErrorEnum ok; - * }; - * bool is_ok; - * } - * } - */ -public class ErrorEnum_option { - - ErrorEnum_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$19:34"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("ErrorEnum_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$19:34"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * ErrorEnum ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * ErrorEnum ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * ErrorEnum ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * ErrorEnum ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct.java b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct.java deleted file mode 100644 index c50ae32..0000000 --- a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct ErrorStruct { - * int32_t i; - * int32_t j; - * } - * } - */ -public class ErrorStruct { - - ErrorStruct() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_INT.withName("i"), - somelib_h.C_INT.withName("j") - ).withName("ErrorStruct"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt i$LAYOUT = (OfInt)$LAYOUT.select(groupElement("i")); - - /** - * Layout for field: - * {@snippet lang=c : - * int32_t i - * } - */ - public static final OfInt i$layout() { - return i$LAYOUT; - } - - private static final long i$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int32_t i - * } - */ - public static final long i$offset() { - return i$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int32_t i - * } - */ - public static int i(MemorySegment struct) { - return struct.get(i$LAYOUT, i$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int32_t i - * } - */ - public static void i(MemorySegment struct, int fieldValue) { - struct.set(i$LAYOUT, i$OFFSET, fieldValue); - } - - private static final OfInt j$LAYOUT = (OfInt)$LAYOUT.select(groupElement("j")); - - /** - * Layout for field: - * {@snippet lang=c : - * int32_t j - * } - */ - public static final OfInt j$layout() { - return j$LAYOUT; - } - - private static final long j$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int32_t j - * } - */ - public static final long j$offset() { - return j$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int32_t j - * } - */ - public static int j(MemorySegment struct) { - return struct.get(j$LAYOUT, j$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int32_t j - * } - */ - public static void j(MemorySegment struct, int fieldValue) { - struct.set(j$LAYOUT, j$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct_option.java b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct_option.java deleted file mode 100644 index 5764466..0000000 --- a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/ErrorStruct_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct ErrorStruct_option { - * union { - * ErrorStruct ok; - * }; - * bool is_ok; - * } - * } - */ -public class ErrorStruct_option { - - ErrorStruct_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - ErrorStruct.layout().withName("ok") - ).withName("$anon$19:36"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("ErrorStruct_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$19:36"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * ErrorStruct ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * ErrorStruct ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * ErrorStruct ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * ErrorStruct ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/somelib_h.java b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/somelib_h.java index f9dd280..8543c7b 100644 --- a/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/somelib_h.java +++ b/feature/java/somelib/src/main/java/dev/diplomattest/somelib/ntv/somelib_h.java @@ -14168,24 +14168,6 @@ public static void Utf16Wrap_destroy(MemorySegment self) { throw new AssertionError("should not reach here", ex$); } } - private static final int ErrorEnum_Foo = (int)0L; - /** - * {@snippet lang=c : - * enum ErrorEnum.ErrorEnum_Foo = 0 - * } - */ - public static int ErrorEnum_Foo() { - return ErrorEnum_Foo; - } - private static final int ErrorEnum_Bar = (int)1L; - /** - * {@snippet lang=c : - * enum ErrorEnum.ErrorEnum_Bar = 1 - * } - */ - public static int ErrorEnum_Bar() { - return ErrorEnum_Bar; - } private static final int ContiguousEnum_C = (int)0L; /** * {@snippet lang=c : @@ -14377,13 +14359,13 @@ public static long __DARWIN_C_LEVEL() { } /** * {@snippet lang=c : - * #define __ASSERT_FILE_NAME "jextract$14462318489172502015.h" + * #define __ASSERT_FILE_NAME "jextract$18314337822400972544.h" * } */ public static MemorySegment __ASSERT_FILE_NAME() { class Holder { static final MemorySegment __ASSERT_FILE_NAME - = somelib_h.LIBRARY_ARENA.allocateFrom("jextract$14462318489172502015.h"); + = somelib_h.LIBRARY_ARENA.allocateFrom("jextract$18314337822400972544.h"); } return Holder.__ASSERT_FILE_NAME; } diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Bar.java b/feature/tmp/src/main/dev/diplomattest/somelib/Bar.java deleted file mode 100644 index e63774e..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Bar.java +++ /dev/null @@ -1,64 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class Bar { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - List bEdges = List.of(); - List aEdges = List.of(); - - - static class BarCleaner implements Runnable { - - MemorySegment segment; - BarCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.Bar_destroy(this.segment); - } - } - - Bar() {} - Bar(MemorySegment handle, List selfEdges, List bEdges, List aEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - this.bEdges = bEdges; - this.aEdges = aEdges; - - - } - - - public Foo foo() { - - - var nativeVal = somelib_h.Bar_foo(internal); - - List selfEdges = List.of(this); - - - - List aEdges = List.of(this); - var returnVal = new Foo(nativeVal, selfEdges, aEdges); - return returnVal; - - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFields.java b/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFields.java deleted file mode 100644 index 066f5f4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFields.java +++ /dev/null @@ -1,96 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class BorrowedFields { - String a; - String b; - String c; - - - List selfEdges = List.of(); - List aEdges = List.of(); - - - private BorrowedFields() { - } - - BorrowedFields(MemorySegment structSegment, List aEdges) { - this.selfEdges = selfEdges; - this.aEdges = aEdges; - - - var aNative = dev.diplomattest.somelib.ntv.BorrowedFields.a(structSegment); - var aVal = SliceUtils.readUtf16(aNative); - this.a = aVal; - var bNative = dev.diplomattest.somelib.ntv.BorrowedFields.b(structSegment); - var bVal = SliceUtils.readUtf8(bNative); - this.b = bVal; - var cNative = dev.diplomattest.somelib.ntv.BorrowedFields.c(structSegment); - var cVal = SliceUtils.readUtf8(cNative); - this.c = cVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.BorrowedFields.allocate(arena); - - var aData = arena.allocateFrom(a, StandardCharsets.UTF_16); - var aLen = aData.byteSize() - 1; // allocated strings are null terminated - var aView = DiplomatString16View.allocate(arena); - DiplomatString16View.len(aView, aLen); - DiplomatString16View.data(aView, aData); - dev.diplomattest.somelib.ntv.BorrowedFields.a(returnVal, aView); - var bData= arena.allocateFrom(b, StandardCharsets.UTF_8); - var bLen = bData.byteSize() - 1; // allocated strings are null terminated - var bView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(bView, bLen); - DiplomatStringView.data(bView, bData); - dev.diplomattest.somelib.ntv.BorrowedFields.b(returnVal, bView); - var cData= arena.allocateFrom(c, StandardCharsets.UTF_8); - var cLen = cData.byteSize() - 1; // allocated strings are null terminated - var cView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(cView, cLen); - DiplomatStringView.data(cView, cData); - dev.diplomattest.somelib.ntv.BorrowedFields.c(returnVal, cView); - - - return returnVal; - - } - - public static BorrowedFields fromBarAndStrings(Bar bar,String dstr16,String utf8Str) { - - try (var arena = Arena.ofConfined()) { - - var barNative = bar.internal; - var dstr16Data = Arena.ofAuto().allocateFrom(dstr16, StandardCharsets.UTF_16); - var dstr16Len = dstr16Data.byteSize() - 1; // allocated strings are null terminated - var dstr16View = DiplomatString16View.allocate(Arena.ofAuto()); - DiplomatString16View.len(dstr16View, dstr16Len); - DiplomatString16View.data(dstr16View, dstr16Data); - var utf8StrData= Arena.ofAuto().allocateFrom(utf8Str, StandardCharsets.UTF_8); - var utf8StrLen = utf8StrData.byteSize() - 1; // allocated strings are null terminated - var utf8StrView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(utf8StrView, utf8StrLen); - DiplomatStringView.data(utf8StrView, utf8StrData); - var nativeVal = somelib_h.BorrowedFields_from_bar_and_strings(arena, barNative, dstr16View, utf8StrView); - - var returnVal = new BorrowedFields(nativeVal, List.of(bar, dstr16, utf8Str)); - return returnVal; - - } - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsReturning.java b/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsReturning.java deleted file mode 100644 index eefce6a..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsReturning.java +++ /dev/null @@ -1,53 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class BorrowedFieldsReturning { - String bytes; - - - List selfEdges = List.of(); - List aEdges = List.of(); - - - private BorrowedFieldsReturning() { - } - - BorrowedFieldsReturning(MemorySegment structSegment, List aEdges) { - this.selfEdges = selfEdges; - this.aEdges = aEdges; - - - var bytesNative = dev.diplomattest.somelib.ntv.BorrowedFieldsReturning.bytes(structSegment); - var bytesVal = SliceUtils.readUtf8(bytesNative); - this.bytes = bytesVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.BorrowedFieldsReturning.allocate(arena); - - var bytesData= arena.allocateFrom(bytes, StandardCharsets.UTF_8); - var bytesLen = bytesData.byteSize() - 1; // allocated strings are null terminated - var bytesView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(bytesView, bytesLen); - DiplomatStringView.data(bytesView, bytesData); - dev.diplomattest.somelib.ntv.BorrowedFieldsReturning.bytes(returnVal, bytesView); - - - return returnVal; - - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsWithBounds.java b/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsWithBounds.java deleted file mode 100644 index f595e1d..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/BorrowedFieldsWithBounds.java +++ /dev/null @@ -1,100 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class BorrowedFieldsWithBounds { - String fieldA; - String fieldB; - String fieldC; - - - List selfEdges = List.of(); - List aEdges = List.of(); - List bEdges = List.of(); - List cEdges = List.of(); - - - private BorrowedFieldsWithBounds() { - } - - BorrowedFieldsWithBounds(MemorySegment structSegment, List aEdges, List bEdges, List cEdges) { - this.selfEdges = selfEdges; - this.aEdges = aEdges; - this.bEdges = bEdges; - this.cEdges = cEdges; - - - var fieldANative = dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.field_a(structSegment); - var fieldAVal = SliceUtils.readUtf16(fieldANative); - this.fieldA = fieldAVal; - var fieldBNative = dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.field_b(structSegment); - var fieldBVal = SliceUtils.readUtf8(fieldBNative); - this.fieldB = fieldBVal; - var fieldCNative = dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.field_c(structSegment); - var fieldCVal = SliceUtils.readUtf8(fieldCNative); - this.fieldC = fieldCVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.allocate(arena); - - var fieldAData = arena.allocateFrom(fieldA, StandardCharsets.UTF_16); - var fieldALen = fieldAData.byteSize() - 1; // allocated strings are null terminated - var fieldAView = DiplomatString16View.allocate(arena); - DiplomatString16View.len(fieldAView, fieldALen); - DiplomatString16View.data(fieldAView, fieldAData); - dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.field_a(returnVal, fieldAView); - var fieldBData= arena.allocateFrom(fieldB, StandardCharsets.UTF_8); - var fieldBLen = fieldBData.byteSize() - 1; // allocated strings are null terminated - var fieldBView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(fieldBView, fieldBLen); - DiplomatStringView.data(fieldBView, fieldBData); - dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.field_b(returnVal, fieldBView); - var fieldCData= arena.allocateFrom(fieldC, StandardCharsets.UTF_8); - var fieldCLen = fieldCData.byteSize() - 1; // allocated strings are null terminated - var fieldCView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(fieldCView, fieldCLen); - DiplomatStringView.data(fieldCView, fieldCData); - dev.diplomattest.somelib.ntv.BorrowedFieldsWithBounds.field_c(returnVal, fieldCView); - - - return returnVal; - - } - - public static BorrowedFieldsWithBounds fromFooAndStrings(Foo foo,String dstr16X,String utf8StrZ) { - - try (var arena = Arena.ofConfined()) { - - var fooNative = foo.internal; - var dstr16XData = Arena.ofAuto().allocateFrom(dstr16X, StandardCharsets.UTF_16); - var dstr16XLen = dstr16XData.byteSize() - 1; // allocated strings are null terminated - var dstr16XView = DiplomatString16View.allocate(Arena.ofAuto()); - DiplomatString16View.len(dstr16XView, dstr16XLen); - DiplomatString16View.data(dstr16XView, dstr16XData); - var utf8StrZData= Arena.ofAuto().allocateFrom(utf8StrZ, StandardCharsets.UTF_8); - var utf8StrZLen = utf8StrZData.byteSize() - 1; // allocated strings are null terminated - var utf8StrZView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(utf8StrZView, utf8StrZLen); - DiplomatStringView.data(utf8StrZView, utf8StrZData); - var nativeVal = somelib_h.BorrowedFieldsWithBounds_from_foo_and_strings(arena, fooNative, dstr16XView, utf8StrZView); - - var returnVal = new BorrowedFieldsWithBounds(nativeVal, List.of(foo, dstr16X, utf8StrZ), List.of(foo, utf8StrZ), List.of()); - return returnVal; - - } - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ContiguousEnum.java b/feature/tmp/src/main/dev/diplomattest/somelib/ContiguousEnum.java deleted file mode 100644 index bea541a..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ContiguousEnum.java +++ /dev/null @@ -1,59 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.somelib_h; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; - -public enum ContiguousEnum { - C, - D, - E, - F, - ; - - static ContiguousEnum fromInt(int i) { - switch (i) { - case 0 -> { - return ContiguousEnum.C; - } - case 1 -> { - return ContiguousEnum.D; - } - case 2 -> { - return ContiguousEnum.E; - } - case 3 -> { - return ContiguousEnum.F; - } - - } - throw new RuntimeException("Unexpected int for ContiguousEnum:" + i); - } - - int toInt() { - switch (this) { - case C -> { - return 0; - } - case D -> { - return 1; - } - case E -> { - return 2; - } - case F -> { - return 3; - } - - } - throw new RuntimeException("Unexpected variant for ContiguousEnum:" + this); - } - - -} diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructA.java b/feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructA.java deleted file mode 100644 index 2eb0b76..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructA.java +++ /dev/null @@ -1,59 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class CyclicStructA { - CyclicStructB a; - - - List selfEdges = List.of(); - - - private CyclicStructA() { - } - - CyclicStructA(MemorySegment structSegment) { - this.selfEdges = selfEdges; - - - var aNative = dev.diplomattest.somelib.ntv.CyclicStructA.a(structSegment); - var aVal = new CyclicStructB(aNative); - this.a = aVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.CyclicStructA.allocate(arena); - - var aNative = a.toNative(arena); - dev.diplomattest.somelib.ntv.CyclicStructA.a(returnVal, aNative); - - - return returnVal; - - } - - public static CyclicStructB getB() { - - try (var arena = Arena.ofConfined()) { - - var nativeVal = somelib_h.CyclicStructA_get_b(arena); - - var returnVal = new CyclicStructB(nativeVal); - return returnVal; - - } - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructB.java b/feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructB.java deleted file mode 100644 index f7d41fc..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/CyclicStructB.java +++ /dev/null @@ -1,59 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class CyclicStructB { - byte field; - - - List selfEdges = List.of(); - - - private CyclicStructB() { - } - - CyclicStructB(MemorySegment structSegment) { - this.selfEdges = selfEdges; - - - var fieldNative = dev.diplomattest.somelib.ntv.CyclicStructB.field(structSegment); - var fieldVal = fieldNative; - this.field = fieldVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.CyclicStructB.allocate(arena); - - var fieldNative = field; - dev.diplomattest.somelib.ntv.CyclicStructB.field(returnVal, fieldNative); - - - return returnVal; - - } - - public static CyclicStructA getA() { - - try (var arena = Arena.ofConfined()) { - - var nativeVal = somelib_h.CyclicStructB_get_a(arena); - - var returnVal = new CyclicStructA(nativeVal); - return returnVal; - - } - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Float64Vec.java b/feature/tmp/src/main/dev/diplomattest/somelib/Float64Vec.java deleted file mode 100644 index 97f3fdf..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Float64Vec.java +++ /dev/null @@ -1,266 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class Float64Vec { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - - - static class Float64VecCleaner implements Runnable { - - MemorySegment segment; - Float64VecCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.Float64Vec_destroy(this.segment); - } - } - - Float64Vec() {} - Float64Vec(MemorySegment handle, List selfEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - - - } - - public static Float64Vec new_(double[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_DOUBLE, v); - var vView = DiplomatF64View.allocate(Arena.ofAuto()); - DiplomatF64View.len(vView, vLen); - DiplomatF64View.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - public static Float64Vec newBool(boolean[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - byte[] vByteArray = new byte[vLen]; - for (int i = 0; i < vLen; i++) { - vByteArray[i] = (byte) (v[i] ? 1 : 0); - } - var vData = Arena.ofAuto().allocateFrom(JAVA_BYTE, vByteArray); - var vView = DiplomatBoolView.allocate(Arena.ofAuto()); - DiplomatBoolView.len(vView, vLen); - DiplomatBoolView.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new_bool(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - public static Float64Vec newI16(short[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_SHORT, v); - var vView = DiplomatI16View.allocate(Arena.ofAuto()); - DiplomatI16View.len(vView, vLen); - DiplomatI16View.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new_i16(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - public static Float64Vec newU16(short[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_SHORT, v); - var vView = DiplomatU16View.allocate(Arena.ofAuto()); - DiplomatU16View.len(vView, vLen); - DiplomatU16View.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new_u16(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - public static Float64Vec newIsize(long[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_LONG, v); - var vView = DiplomatIsizeView.allocate(Arena.ofAuto()); - DiplomatIsizeView.len(vView, vLen); - DiplomatIsizeView.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new_isize(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - public static Float64Vec newUsize(long[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_LONG, v); - var vView = DiplomatUsizeView.allocate(Arena.ofAuto()); - DiplomatUsizeView.len(vView, vLen); - DiplomatUsizeView.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new_usize(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - public static Float64Vec newF64BeBytes(byte[] v) { - - try (var arena = Arena.ofConfined()) { - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_BYTE, v); - var vView = DiplomatU8View.allocate(Arena.ofAuto()); - DiplomatU8View.len(vView, vLen); - DiplomatU8View.data(vView, vData); - - var nativeVal = somelib_h.Float64Vec_new_f64_be_bytes(vView); - - List selfEdges = List.of(); - - - - var returnVal = new Float64Vec(nativeVal, selfEdges); - return returnVal; - - } - } - - - public double[] asSlice() { - - try (var arena = Arena.ofConfined()) { - - - var nativeVal = somelib_h.Float64Vec_as_slice(arena, internal); - - var data = dev.diplomattest.somelib.ntv.DiplomatF64View.data(nativeVal); - var len = dev.diplomattest.somelib.ntv.DiplomatF64View.len(nativeVal); - var returnVal = SliceUtils.doubleSliceToArray(nativeVal); - return returnVal; - - } - } - - public void fillSlice(double[] v) { - - try (var arena = Arena.ofConfined()) { - - var vLen = v.length; - var vData= Arena.ofAuto().allocateFrom(JAVA_DOUBLE, v); - var vView = DiplomatF64View.allocate(Arena.ofAuto()); - DiplomatF64View.len(vView, vLen); - DiplomatF64View.data(vView, vData); - - somelib_h.Float64Vec_fill_slice(internal, vView); - - } - } - - public void setValue(double[] newSlice) { - - try (var arena = Arena.ofConfined()) { - - var newSliceLen = newSlice.length; - var newSliceData= Arena.ofAuto().allocateFrom(JAVA_DOUBLE, newSlice); - var newSliceView = DiplomatF64View.allocate(Arena.ofAuto()); - DiplomatF64View.len(newSliceView, newSliceLen); - DiplomatF64View.data(newSliceView, newSliceData); - - somelib_h.Float64Vec_set_value(internal, newSliceView); - - } - } - - public String toString_() { - - - var writeable = somelib_h.diplomat_buffer_write_create(0); - somelib_h.Float64Vec_to_string(internal, writeable); - var string = SliceUtils. readUtf8FromWriteable(writeable); - somelib_h.diplomat_buffer_write_destroy(writeable); - return string; - } - - public double[] borrow() { - - try (var arena = Arena.ofConfined()) { - - - var nativeVal = somelib_h.Float64Vec_borrow(arena, internal); - - var data = dev.diplomattest.somelib.ntv.DiplomatF64View.data(nativeVal); - var len = dev.diplomattest.somelib.ntv.DiplomatF64View.len(nativeVal); - var returnVal = SliceUtils.doubleSliceToArray(nativeVal); - return returnVal; - - } - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Foo.java b/feature/tmp/src/main/dev/diplomattest/somelib/Foo.java deleted file mode 100644 index 9981364..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Foo.java +++ /dev/null @@ -1,136 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class Foo { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - List aEdges = List.of(); - - - static class FooCleaner implements Runnable { - - MemorySegment segment; - FooCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.Foo_destroy(this.segment); - } - } - - Foo() {} - Foo(MemorySegment handle, List selfEdges, List aEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - this.aEdges = aEdges; - - - } - - public static Foo new_(String x) { - - try (var arena = Arena.ofConfined()) { - var xData= Arena.ofAuto().allocateFrom(x, StandardCharsets.UTF_8); - var xLen = xData.byteSize() - 1; // allocated strings are null terminated - var xView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(xView, xLen); - DiplomatStringView.data(xView, xData); - var nativeVal = somelib_h.Foo_new(xView); - - List selfEdges = List.of(); - - - - List aEdges = List.of(x); - var returnVal = new Foo(nativeVal, selfEdges, aEdges); - return returnVal; - - } - } - - public static Foo extractFromFields(BorrowedFields fields) { - - try (var arena = Arena.ofConfined()) { - var fieldsNative = fields.toNative(arena); - var nativeVal = somelib_h.Foo_extract_from_fields(fieldsNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(fields); - var returnVal = new Foo(nativeVal, selfEdges, aEdges); - return returnVal; - - } - } - - public static Foo extractFromBounds(BorrowedFieldsWithBounds bounds,String anotherString) { - - try (var arena = Arena.ofConfined()) { - var boundsNative = bounds.toNative(arena); - var anotherStringData= Arena.ofAuto().allocateFrom(anotherString, StandardCharsets.UTF_8); - var anotherStringLen = anotherStringData.byteSize() - 1; // allocated strings are null terminated - var anotherStringView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(anotherStringView, anotherStringLen); - DiplomatStringView.data(anotherStringView, anotherStringData); - var nativeVal = somelib_h.Foo_extract_from_bounds(boundsNative, anotherStringView); - - List selfEdges = List.of(); - - - - List aEdges = List.of(bounds, bounds, anotherString); - var returnVal = new Foo(nativeVal, selfEdges, aEdges); - return returnVal; - - } - } - - - public Bar getBar() { - - - var nativeVal = somelib_h.Foo_get_bar(internal); - - List selfEdges = List.of(); - - - - List bEdges = List.of(this); - List aEdges = List.of(this); - var returnVal = new Bar(nativeVal, selfEdges, bEdges, aEdges); - return returnVal; - - } - - public BorrowedFieldsReturning asReturning() { - - try (var arena = Arena.ofConfined()) { - - - var nativeVal = somelib_h.Foo_as_returning(arena, internal); - - var returnVal = new BorrowedFieldsReturning(nativeVal, List.of()); - return returnVal; - - } - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ImportedStruct.java b/feature/tmp/src/main/dev/diplomattest/somelib/ImportedStruct.java deleted file mode 100644 index c17cc32..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ImportedStruct.java +++ /dev/null @@ -1,53 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class ImportedStruct { - UnimportedEnum foo; - byte count; - - - List selfEdges = List.of(); - - - private ImportedStruct() { - } - - ImportedStruct(MemorySegment structSegment) { - this.selfEdges = selfEdges; - - - var fooNative = dev.diplomattest.somelib.ntv.ImportedStruct.foo(structSegment); - var fooVal = UnimportedEnum.fromInt(fooNative); - this.foo = fooVal; - var countNative = dev.diplomattest.somelib.ntv.ImportedStruct.count(structSegment); - var countVal = countNative; - this.count = countVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.ImportedStruct.allocate(arena); - - var fooNative = foo.toInt(); - dev.diplomattest.somelib.ntv.ImportedStruct.foo(returnVal, fooNative); - var countNative = count; - dev.diplomattest.somelib.ntv.ImportedStruct.count(returnVal, countNative); - - - return returnVal; - - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Lib.java b/feature/tmp/src/main/dev/diplomattest/somelib/Lib.java deleted file mode 100644 index 77d56cc..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Lib.java +++ /dev/null @@ -1,205 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.*; -import java.lang.ref.Cleaner; -import java.nio.charset.StandardCharsets; -import java.util.function.Consumer; -import java.util.Arrays; - -import static java.lang.foreign.ValueLayout.*; - -public class Lib { - static final Cleaner cleaner = Cleaner.create(); -} - -class SliceUtils { - - - static boolean[] booleanSliceToArray(MemorySegment segment) { - var data = DiplomatU8View.data(segment); - var len = DiplomatU8View.len(segment); - var slice = data.asSlice(0, len * JAVA_BYTE.byteSize()); - var byteArray = slice.toArray(JAVA_BYTE); - var returnArray = new boolean[(int) len]; - for (var i=0; i < len; i++ ) { - returnArray[i] = (byteArray[i] == 1); - } - return returnArray; - } - - static byte[] byteSliceToArray(MemorySegment segment) { - var data = DiplomatU8View.data(segment); - var len = DiplomatU8View.len(segment); - var slice = data.asSlice(0, len * JAVA_BYTE.byteSize()); - return slice.toArray(JAVA_BYTE); - } - - static short[] shortSliceToArray(MemorySegment segment) { - var data = DiplomatU16View.data(segment); - var len = DiplomatU16View.len(segment); - var slice = data.asSlice(0, len * JAVA_SHORT.byteSize()); - return slice.toArray(JAVA_SHORT); - } - static int[] intSliceToArray(MemorySegment segment) { - var data = DiplomatU32View.data(segment); - var len = DiplomatU32View.len(segment); - var slice = data.asSlice(0, len * JAVA_INT.byteSize()); - return slice.toArray(JAVA_INT); - } - static long[] longSliceToArray(MemorySegment segment) { - var data = DiplomatU64View.data(segment); - var len = DiplomatU64View.len(segment); - var slice = data.asSlice(0, len * JAVA_LONG.byteSize()); - return slice.toArray(JAVA_LONG); - } - static float[] floatSliceToArray(MemorySegment segment) { - var data = DiplomatF32View.data(segment); - var len = DiplomatF32View.len(segment); - var slice = data.asSlice(0, len * JAVA_FLOAT.byteSize()); - return slice.toArray(JAVA_FLOAT); - } - - static double[] doubleSliceToArray(MemorySegment segment) { - var data = DiplomatF64View.data(segment); - var len = DiplomatF64View.len(segment); - var slice = data.asSlice(0, len * JAVA_DOUBLE.byteSize()); - return slice.toArray(JAVA_DOUBLE); - } - - static MemorySegment byteArrayToSlice(SegmentAllocator arena, byte[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_BYTE, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_BYTE, i, array[i]); - } - return memSeg; - } - - static MemorySegment shortArrayToSlice(SegmentAllocator arena, short[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_SHORT, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_SHORT, i, array[i]); - } - return memSeg; - } - - static MemorySegment intArrayToSlice(SegmentAllocator arena, int[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_INT, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_INT, i, array[i]); - } - return memSeg; - } - static MemorySegment longArrayToSlice(SegmentAllocator arena, long[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_LONG, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_LONG, i, array[i]); - } - return memSeg; - } - static MemorySegment floatArrayToSlice(SegmentAllocator arena, float[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_FLOAT, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_FLOAT, i, array[i]); - } - return memSeg; - } - - static MemorySegment doubleArrayToSlice(SegmentAllocator arena, double[] array) { - return arena.allocateFrom(JAVA_DOUBLE, array); - } - - static String readUtf8(MemorySegment segment) { - var data = DiplomatStringView.data(segment); - var len = DiplomatStringView.len(segment); - var strData = data.asSlice(0, len); - var bytes = strData.toArray(JAVA_BYTE); - var string = new String(bytes, StandardCharsets.UTF_8); - return string; - } - - static String readUtf16(MemorySegment segment) { - var data = DiplomatStringView.data(segment); - var len = DiplomatStringView.len(segment); - var strData = data.asSlice(0, len); - var bytes = strData.toArray(JAVA_BYTE); - var string = new String(bytes, StandardCharsets.UTF_16); - return string; - } - // for parameter conversion - static MemorySegment strToUtf8Slice(SegmentAllocator arena, String str) { - var vData = arena.allocateFrom(str, StandardCharsets.UTF_8); - var vLen = vData.byteSize() - 1; - var vView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(vView, vLen); - DiplomatStringView.data(vView, vData); - return vData; - } - - static MemorySegment strToUtf16Slice(SegmentAllocator arena, String str) { - var vData = arena.allocateFrom(str, StandardCharsets.UTF_16); - var vLen = vData.byteSize() - 1; - var vView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(vView, vLen); - DiplomatStringView.data(vView, vData); - return vData; - } - static MemorySegment strs16(SegmentAllocator arena, String [] strings) { - var diplomatStrsData = DiplomatStringView.allocateArray(strings.length, arena); - var layout = DiplomatStringView.layout(); - diplomatStrsData.elements(layout).forEach(new Consumer() { - int i = 0; - @Override - public void accept(MemorySegment memorySegment) { - var str = strings[i]; - var bytes = str.getBytes(StandardCharsets.UTF_16); - var data = arena.allocateFrom(JAVA_BYTE, bytes); - DiplomatStringView.data(memorySegment, data); - DiplomatStringView.len(memorySegment, bytes.length); - i++; - } - }); - var diplomatStrsView = DiplomatStrings16View.allocate(arena); - DiplomatStrings16View.len(diplomatStrsView, strings.length); - DiplomatStrings16View.data(diplomatStrsView, diplomatStrsData); - return diplomatStrsView; - } - - static MemorySegment strs8(SegmentAllocator arena, String [] strings) { - var diplomatStrsData = DiplomatStringView.allocateArray(strings.length, arena); - var layout = DiplomatStringView.layout(); - diplomatStrsData.elements(layout).forEach(new Consumer() { - int i = 0; - @Override - public void accept(MemorySegment memorySegment) { - var str = strings[i]; - var bytes = str.getBytes(StandardCharsets.UTF_8); - var data = arena.allocateFrom(JAVA_BYTE, bytes); - DiplomatStringView.data(memorySegment, data); - DiplomatStringView.len(memorySegment, bytes.length); - i++; - } - }); - - var diplomatStrsView = DiplomatStringsView.allocate(arena); - DiplomatStringsView.len(diplomatStrsView, strings.length); - DiplomatStringsView.data(diplomatStrsView, diplomatStrsData); - return diplomatStrsView; - } - - static String readUtf8FromWriteable(MemorySegment writeable) { - var buffer = DiplomatWrite.buf(writeable); - var len = DiplomatWrite.len(writeable); - var bytes = new byte[(int) len]; - for (var i = 0; i < len; i++) { - bytes[i] = buffer.get(JAVA_BYTE, i); - } - return new String(bytes, StandardCharsets.UTF_8); - } -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/MyEnum.java b/feature/tmp/src/main/dev/diplomattest/somelib/MyEnum.java deleted file mode 100644 index 11c4296..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/MyEnum.java +++ /dev/null @@ -1,82 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.somelib_h; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; - -public enum MyEnum { - A, - B, - C, - D, - E, - F, - ; - - static MyEnum fromInt(int i) { - switch (i) { - case -2 -> { - return MyEnum.A; - } - case -1 -> { - return MyEnum.B; - } - case 0 -> { - return MyEnum.C; - } - case 1 -> { - return MyEnum.D; - } - case 2 -> { - return MyEnum.E; - } - case 3 -> { - return MyEnum.F; - } - - } - throw new RuntimeException("Unexpected int for MyEnum:" + i); - } - - int toInt() { - switch (this) { - case A -> { - return -2; - } - case B -> { - return -1; - } - case C -> { - return 0; - } - case D -> { - return 1; - } - case E -> { - return 2; - } - case F -> { - return 3; - } - - } - throw new RuntimeException("Unexpected variant for MyEnum:" + this); - } - - - public static MyEnum getA() { - - var nativeVal = somelib_h.MyEnum_get_a(); - - var returnVal = MyEnum.fromInt(nativeVal); - return returnVal; - - } - -} diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/MyString.java b/feature/tmp/src/main/dev/diplomattest/somelib/MyString.java deleted file mode 100644 index 48a73a6..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/MyString.java +++ /dev/null @@ -1,142 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class MyString { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - - - static class MyStringCleaner implements Runnable { - - MemorySegment segment; - MyStringCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.MyString_destroy(this.segment); - } - } - - MyString() {} - MyString(MemorySegment handle, List selfEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - - - } - - public static MyString new_(String v) { - - try (var arena = Arena.ofConfined()) { - var vData= Arena.ofAuto().allocateFrom(v, StandardCharsets.UTF_8); - var vLen = vData.byteSize() - 1; // allocated strings are null terminated - var vView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(vView, vLen); - DiplomatStringView.data(vView, vData); - var nativeVal = somelib_h.MyString_new(vView); - - List selfEdges = List.of(); - - - - var returnVal = new MyString(nativeVal, selfEdges); - return returnVal; - - } - } - - public static MyString newUnsafe(String v) { - - try (var arena = Arena.ofConfined()) { - var vData= Arena.ofAuto().allocateFrom(v, StandardCharsets.UTF_8); - var vLen = vData.byteSize() - 1; // allocated strings are null terminated - var vView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(vView, vLen); - DiplomatStringView.data(vView, vData); - var nativeVal = somelib_h.MyString_new_unsafe(vView); - - List selfEdges = List.of(); - - - - var returnVal = new MyString(nativeVal, selfEdges); - return returnVal; - - } - } - - public static MyString newFromFirst(String [] v) { - - try (var arena = Arena.ofConfined()) { - var vView = SliceUtils.strs8(Arena.ofAuto(), v); - var vLen = v.length; - var nativeVal = somelib_h.MyString_new_from_first(vView); - - List selfEdges = List.of(); - - - - var returnVal = new MyString(nativeVal, selfEdges); - return returnVal; - - } - } - - public static String stringTransform(String foo) { - - try (var arena = Arena.ofConfined()) { - var fooData= Arena.ofAuto().allocateFrom(foo, StandardCharsets.UTF_8); - var fooLen = fooData.byteSize() - 1; // allocated strings are null terminated - var fooView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(fooView, fooLen); - DiplomatStringView.data(fooView, fooData); - var writeable = somelib_h.diplomat_buffer_write_create(0); - somelib_h.MyString_string_transform(fooView, writeable); - var string = SliceUtils. readUtf8FromWriteable(writeable); - somelib_h.diplomat_buffer_write_destroy(writeable); - return string; - } - } - - - public void setStr(String newStr) { - - try (var arena = Arena.ofConfined()) { - - var newStrData= Arena.ofAuto().allocateFrom(newStr, StandardCharsets.UTF_8); - var newStrLen = newStrData.byteSize() - 1; // allocated strings are null terminated - var newStrView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(newStrView, newStrLen); - DiplomatStringView.data(newStrView, newStrData); - somelib_h.MyString_set_str(internal, newStrView); - - } - } - - public String getStr() { - - - var writeable = somelib_h.diplomat_buffer_write_create(0); - somelib_h.MyString_get_str(internal, writeable); - var string = SliceUtils. readUtf8FromWriteable(writeable); - somelib_h.diplomat_buffer_write_destroy(writeable); - return string; - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/MyStruct.java b/feature/tmp/src/main/dev/diplomattest/somelib/MyStruct.java deleted file mode 100644 index 756d05d..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/MyStruct.java +++ /dev/null @@ -1,95 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class MyStruct { - byte a; - boolean b; - byte c; - long d; - int e; - int f; - MyEnum g; - - - List selfEdges = List.of(); - - - private MyStruct() { - } - - MyStruct(MemorySegment structSegment) { - this.selfEdges = selfEdges; - - - var aNative = dev.diplomattest.somelib.ntv.MyStruct.a(structSegment); - var aVal = aNative; - this.a = aVal; - var bNative = dev.diplomattest.somelib.ntv.MyStruct.b(structSegment); - var bVal = bNative; - this.b = bVal; - var cNative = dev.diplomattest.somelib.ntv.MyStruct.c(structSegment); - var cVal = cNative; - this.c = cVal; - var dNative = dev.diplomattest.somelib.ntv.MyStruct.d(structSegment); - var dVal = dNative; - this.d = dVal; - var eNative = dev.diplomattest.somelib.ntv.MyStruct.e(structSegment); - var eVal = eNative; - this.e = eVal; - var fNative = dev.diplomattest.somelib.ntv.MyStruct.f(structSegment); - var fVal = fNative; - this.f = fVal; - var gNative = dev.diplomattest.somelib.ntv.MyStruct.g(structSegment); - var gVal = MyEnum.fromInt(gNative); - this.g = gVal; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.MyStruct.allocate(arena); - - var aNative = a; - dev.diplomattest.somelib.ntv.MyStruct.a(returnVal, aNative); - var bNative = b; - dev.diplomattest.somelib.ntv.MyStruct.b(returnVal, bNative); - var cNative = c; - dev.diplomattest.somelib.ntv.MyStruct.c(returnVal, cNative); - var dNative = d; - dev.diplomattest.somelib.ntv.MyStruct.d(returnVal, dNative); - var eNative = e; - dev.diplomattest.somelib.ntv.MyStruct.e(returnVal, eNative); - var fNative = f; - dev.diplomattest.somelib.ntv.MyStruct.f(returnVal, fNative); - var gNative = g.toInt(); - dev.diplomattest.somelib.ntv.MyStruct.g(returnVal, gNative); - - - return returnVal; - - } - - public static MyStruct new_() { - - try (var arena = Arena.ofConfined()) { - - var nativeVal = somelib_h.MyStruct_new(arena); - - var returnVal = new MyStruct(nativeVal); - return returnVal; - - } - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/MyZst.java b/feature/tmp/src/main/dev/diplomattest/somelib/MyZst.java deleted file mode 100644 index e68eb57..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/MyZst.java +++ /dev/null @@ -1,33 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class MyZst { - - - List selfEdges = List.of(); - - - private MyZst() { - } - - MyZst(MemorySegment structSegment) { - this.selfEdges = selfEdges; - - - - - } - - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/NestedBorrowedFields.java b/feature/tmp/src/main/dev/diplomattest/somelib/NestedBorrowedFields.java deleted file mode 100644 index f6a9cb3..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/NestedBorrowedFields.java +++ /dev/null @@ -1,99 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class NestedBorrowedFields { - BorrowedFields fields; - BorrowedFieldsWithBounds bounds; - BorrowedFieldsWithBounds bounds2; - - - List selfEdges = List.of(); - List xEdges = List.of(); - List yEdges = List.of(); - List zEdges = List.of(); - - - private NestedBorrowedFields() { - } - - NestedBorrowedFields(MemorySegment structSegment, List xEdges, List yEdges, List zEdges) { - this.selfEdges = selfEdges; - this.xEdges = xEdges; - this.yEdges = yEdges; - this.zEdges = zEdges; - - - var fieldsNative = dev.diplomattest.somelib.ntv.NestedBorrowedFields.fields(structSegment); - var fieldsVal = new BorrowedFields(fieldsNative, List.of(xEdges, yEdges)); - this.fields = fieldsVal; - var boundsNative = dev.diplomattest.somelib.ntv.NestedBorrowedFields.bounds(structSegment); - var boundsVal = new BorrowedFieldsWithBounds(boundsNative, List.of(xEdges, yEdges), List.of(), List.of()); - this.bounds = boundsVal; - var bounds2Native = dev.diplomattest.somelib.ntv.NestedBorrowedFields.bounds2(structSegment); - var bounds2Val = new BorrowedFieldsWithBounds(bounds2Native, List.of(), List.of(), List.of()); - this.bounds2 = bounds2Val; - - - } - - MemorySegment toNative(SegmentAllocator arena) { - var returnVal = dev.diplomattest.somelib.ntv.NestedBorrowedFields.allocate(arena); - - var fieldsNative = fields.toNative(arena); - dev.diplomattest.somelib.ntv.NestedBorrowedFields.fields(returnVal, fieldsNative); - var boundsNative = bounds.toNative(arena); - dev.diplomattest.somelib.ntv.NestedBorrowedFields.bounds(returnVal, boundsNative); - var bounds2Native = bounds2.toNative(arena); - dev.diplomattest.somelib.ntv.NestedBorrowedFields.bounds2(returnVal, bounds2Native); - - - return returnVal; - - } - - public static NestedBorrowedFields fromBarAndFooAndStrings(Bar bar,Foo foo,String dstr16X,String dstr16Z,String utf8StrY,String utf8StrZ) { - - try (var arena = Arena.ofConfined()) { - - var barNative = bar.internal; - var fooNative = foo.internal; - var dstr16XData = Arena.ofAuto().allocateFrom(dstr16X, StandardCharsets.UTF_16); - var dstr16XLen = dstr16XData.byteSize() - 1; // allocated strings are null terminated - var dstr16XView = DiplomatString16View.allocate(Arena.ofAuto()); - DiplomatString16View.len(dstr16XView, dstr16XLen); - DiplomatString16View.data(dstr16XView, dstr16XData); - var dstr16ZData = Arena.ofAuto().allocateFrom(dstr16Z, StandardCharsets.UTF_16); - var dstr16ZLen = dstr16ZData.byteSize() - 1; // allocated strings are null terminated - var dstr16ZView = DiplomatString16View.allocate(Arena.ofAuto()); - DiplomatString16View.len(dstr16ZView, dstr16ZLen); - DiplomatString16View.data(dstr16ZView, dstr16ZData); - var utf8StrYData= Arena.ofAuto().allocateFrom(utf8StrY, StandardCharsets.UTF_8); - var utf8StrYLen = utf8StrYData.byteSize() - 1; // allocated strings are null terminated - var utf8StrYView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(utf8StrYView, utf8StrYLen); - DiplomatStringView.data(utf8StrYView, utf8StrYData); - var utf8StrZData= Arena.ofAuto().allocateFrom(utf8StrZ, StandardCharsets.UTF_8); - var utf8StrZLen = utf8StrZData.byteSize() - 1; // allocated strings are null terminated - var utf8StrZView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(utf8StrZView, utf8StrZLen); - DiplomatStringView.data(utf8StrZView, utf8StrZData); - var nativeVal = somelib_h.NestedBorrowedFields_from_bar_and_foo_and_strings(arena, barNative, fooNative, dstr16XView, dstr16ZView, utf8StrYView, utf8StrZView); - - var returnVal = new NestedBorrowedFields(nativeVal, List.of(bar, dstr16X, utf8StrY), List.of(bar, utf8StrY), List.of(foo, dstr16Z, utf8StrZ)); - return returnVal; - - } - } - -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/One.java b/feature/tmp/src/main/dev/diplomattest/somelib/One.java deleted file mode 100644 index 0e84f66..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/One.java +++ /dev/null @@ -1,240 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class One { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - List aEdges = List.of(); - - - static class OneCleaner implements Runnable { - - MemorySegment segment; - OneCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.One_destroy(this.segment); - } - } - - One() {} - One(MemorySegment handle, List selfEdges, List aEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - this.aEdges = aEdges; - - - } - - public static One transitivity(One hold,One nohold) { - - var holdNative = hold.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_transitivity(holdNative, noholdNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(hold); - var returnVal = new One(nativeVal, selfEdges, aEdges); - return returnVal; - - } - - public static One cycle(Two hold,One nohold) { - - var holdNative = hold.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_cycle(holdNative, noholdNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(hold); - var returnVal = new One(nativeVal, selfEdges, aEdges); - return returnVal; - - } - - public static One manyDependents(One a,One b,Two c,Two d,Two nohold) { - - var aNative = a.internal; - var bNative = b.internal; - var cNative = c.internal; - var dNative = d.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_many_dependents(aNative, bNative, cNative, dNative, noholdNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(a, b, c, d); - var returnVal = new One(nativeVal, selfEdges, aEdges); - return returnVal; - - } - - public static One returnOutlivesParam(Two hold,One nohold) { - - var holdNative = hold.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_return_outlives_param(holdNative, noholdNative); - - List selfEdges = List.of(); - - - - List longEdges = List.of(hold); - var returnVal = new One(nativeVal, selfEdges, longEdges); - return returnVal; - - } - - public static One diamondTop(One top,One left,One right,One bottom) { - - var topNative = top.internal; - var leftNative = left.internal; - var rightNative = right.internal; - var bottomNative = bottom.internal; - var nativeVal = somelib_h.One_diamond_top(topNative, leftNative, rightNative, bottomNative); - - List selfEdges = List.of(); - - - - List topEdges = List.of(top, left, right, bottom); - var returnVal = new One(nativeVal, selfEdges, topEdges); - return returnVal; - - } - - public static One diamondLeft(One top,One left,One right,One bottom) { - - var topNative = top.internal; - var leftNative = left.internal; - var rightNative = right.internal; - var bottomNative = bottom.internal; - var nativeVal = somelib_h.One_diamond_left(topNative, leftNative, rightNative, bottomNative); - - List selfEdges = List.of(); - - - - List leftEdges = List.of(left, bottom); - var returnVal = new One(nativeVal, selfEdges, leftEdges); - return returnVal; - - } - - public static One diamondRight(One top,One left,One right,One bottom) { - - var topNative = top.internal; - var leftNative = left.internal; - var rightNative = right.internal; - var bottomNative = bottom.internal; - var nativeVal = somelib_h.One_diamond_right(topNative, leftNative, rightNative, bottomNative); - - List selfEdges = List.of(); - - - - List rightEdges = List.of(right, bottom); - var returnVal = new One(nativeVal, selfEdges, rightEdges); - return returnVal; - - } - - public static One diamondBottom(One top,One left,One right,One bottom) { - - var topNative = top.internal; - var leftNative = left.internal; - var rightNative = right.internal; - var bottomNative = bottom.internal; - var nativeVal = somelib_h.One_diamond_bottom(topNative, leftNative, rightNative, bottomNative); - - List selfEdges = List.of(); - - - - List bottomEdges = List.of(bottom); - var returnVal = new One(nativeVal, selfEdges, bottomEdges); - return returnVal; - - } - - public static One diamondAndNestedTypes(One a,One b,One c,One d,One nohold) { - - var aNative = a.internal; - var bNative = b.internal; - var cNative = c.internal; - var dNative = d.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_diamond_and_nested_types(aNative, bNative, cNative, dNative, noholdNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(a, b, c, d); - var returnVal = new One(nativeVal, selfEdges, aEdges); - return returnVal; - - } - - public static One implicitBounds(One explicitHold,One implicitHold,One nohold) { - - var explicitHoldNative = explicitHold.internal; - var implicitHoldNative = implicitHold.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_implicit_bounds(explicitHoldNative, implicitHoldNative, noholdNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(explicitHold, implicitHold); - var returnVal = new One(nativeVal, selfEdges, aEdges); - return returnVal; - - } - - public static One implicitBoundsDeep(One explicit,One implicit1,One implicit2,One nohold) { - - var explicitNative = explicit.internal; - var implicit1Native = implicit1.internal; - var implicit2Native = implicit2.internal; - var noholdNative = nohold.internal; - var nativeVal = somelib_h.One_implicit_bounds_deep(explicitNative, implicit1Native, implicit2Native, noholdNative); - - List selfEdges = List.of(); - - - - List aEdges = List.of(explicit, implicit1, implicit2); - var returnVal = new One(nativeVal, selfEdges, aEdges); - return returnVal; - - } - - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Opaque.java b/feature/tmp/src/main/dev/diplomattest/somelib/Opaque.java deleted file mode 100644 index f5f4b0a..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Opaque.java +++ /dev/null @@ -1,136 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class Opaque { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - - - static class OpaqueCleaner implements Runnable { - - MemorySegment segment; - OpaqueCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.Opaque_destroy(this.segment); - } - } - - Opaque() {} - Opaque(MemorySegment handle, List selfEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - - - } - - public static Opaque new_() { - - var nativeVal = somelib_h.Opaque_new(); - - List selfEdges = List.of(); - - - - var returnVal = new Opaque(nativeVal, selfEdges); - return returnVal; - - } - - public static Opaque fromStr(String input) { - - try (var arena = Arena.ofConfined()) { - var inputData= Arena.ofAuto().allocateFrom(input, StandardCharsets.UTF_8); - var inputLen = inputData.byteSize() - 1; // allocated strings are null terminated - var inputView = DiplomatStringView.allocate(Arena.ofAuto()); - DiplomatStringView.len(inputView, inputLen); - DiplomatStringView.data(inputView, inputData); - var nativeVal = somelib_h.Opaque_from_str(inputView); - - List selfEdges = List.of(); - - - - var returnVal = new Opaque(nativeVal, selfEdges); - return returnVal; - - } - } - - public static long returnsUsize() { - - var nativeVal = somelib_h.Opaque_returns_usize(); - - var returnVal = nativeVal; - return returnVal; - - } - - public static ImportedStruct returnsImported() { - - try (var arena = Arena.ofConfined()) { - - var nativeVal = somelib_h.Opaque_returns_imported(arena); - - var returnVal = new ImportedStruct(nativeVal); - return returnVal; - - } - } - - public static byte cmp() { - - var nativeVal = somelib_h.Opaque_cmp(); - - var returnVal = nativeVal; - return returnVal; - - } - - - public String getDebugStr() { - - - var writeable = somelib_h.diplomat_buffer_write_create(0); - somelib_h.Opaque_get_debug_str(internal, writeable); - var string = SliceUtils. readUtf8FromWriteable(writeable); - somelib_h.diplomat_buffer_write_destroy(writeable); - return string; - } - - public void assertStruct(MyStruct s) { - - - var sNative = s.toNative(Arena.ofAuto()); - somelib_h.Opaque_assert_struct(internal, sNative); - - } - - public long internalLen() { - - - var nativeVal = somelib_h.Opaque_internal_len(internal); - - var returnVal = nativeVal; - return returnVal; - - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/OpaqueMutexedString.java b/feature/tmp/src/main/dev/diplomattest/somelib/OpaqueMutexedString.java deleted file mode 100644 index 3c13bbc..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/OpaqueMutexedString.java +++ /dev/null @@ -1,148 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class OpaqueMutexedString { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - - - static class OpaqueMutexedStringCleaner implements Runnable { - - MemorySegment segment; - OpaqueMutexedStringCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.OpaqueMutexedString_destroy(this.segment); - } - } - - OpaqueMutexedString() {} - OpaqueMutexedString(MemorySegment handle, List selfEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - - - } - - public static OpaqueMutexedString fromUsize(long number) { - - var numberNative = number; - var nativeVal = somelib_h.OpaqueMutexedString_from_usize(numberNative); - - List selfEdges = List.of(); - - - - var returnVal = new OpaqueMutexedString(nativeVal, selfEdges); - return returnVal; - - } - - public static OpaqueMutexedString borrowOther(OpaqueMutexedString other) { - - var otherNative = other.internal; - var nativeVal = somelib_h.OpaqueMutexedString_borrow_other(otherNative); - - List selfEdges = List.of(other); - - - - var returnVal = new OpaqueMutexedString(nativeVal, selfEdges); - return returnVal; - - } - - - public void change(long number) { - - - var numberNative = number; - somelib_h.OpaqueMutexedString_change(internal, numberNative); - - } - - public OpaqueMutexedString borrow() { - - - var nativeVal = somelib_h.OpaqueMutexedString_borrow(internal); - - List selfEdges = List.of(this); - - - - var returnVal = new OpaqueMutexedString(nativeVal, selfEdges); - return returnVal; - - } - - public OpaqueMutexedString borrowSelfOrOther(OpaqueMutexedString other) { - - - var otherNative = other.internal; - var nativeVal = somelib_h.OpaqueMutexedString_borrow_self_or_other(internal, otherNative); - - List selfEdges = List.of(this, other); - - - - var returnVal = new OpaqueMutexedString(nativeVal, selfEdges); - return returnVal; - - } - - public long getLenAndAdd(long other) { - - - var otherNative = other; - var nativeVal = somelib_h.OpaqueMutexedString_get_len_and_add(internal, otherNative); - - var returnVal = nativeVal; - return returnVal; - - } - - public String dummyStr() { - - try (var arena = Arena.ofConfined()) { - - - var nativeVal = somelib_h.OpaqueMutexedString_dummy_str(arena, internal); - - var returnVal = SliceUtils.readUtf8(nativeVal); - return returnVal; - - } - } - - public Utf16Wrap wrapper() { - - - var nativeVal = somelib_h.OpaqueMutexedString_wrapper(internal); - - List selfEdges = List.of(); - - - - var returnVal = new Utf16Wrap(nativeVal, selfEdges); - return returnVal; - - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/RefList.java b/feature/tmp/src/main/dev/diplomattest/somelib/RefList.java deleted file mode 100644 index 9a1864f..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/RefList.java +++ /dev/null @@ -1,62 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class RefList { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - List aEdges = List.of(); - - - static class RefListCleaner implements Runnable { - - MemorySegment segment; - RefListCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.RefList_destroy(this.segment); - } - } - - RefList() {} - RefList(MemorySegment handle, List selfEdges, List aEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - this.aEdges = aEdges; - - - } - - public static RefList node(RefListParameter data) { - - var dataNative = data.internal; - var nativeVal = somelib_h.RefList_node(dataNative); - - List selfEdges = List.of(); - - - - List bEdges = List.of(data); - var returnVal = new RefList(nativeVal, selfEdges, bEdges); - return returnVal; - - } - - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/RefListParameter.java b/feature/tmp/src/main/dev/diplomattest/somelib/RefListParameter.java deleted file mode 100644 index ab41826..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/RefListParameter.java +++ /dev/null @@ -1,45 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class RefListParameter { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - - - static class RefListParameterCleaner implements Runnable { - - MemorySegment segment; - RefListParameterCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.RefListParameter_destroy(this.segment); - } - } - - RefListParameter() {} - RefListParameter(MemorySegment handle, List selfEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - - - } - - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Two.java b/feature/tmp/src/main/dev/diplomattest/somelib/Two.java deleted file mode 100644 index 287eec4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Two.java +++ /dev/null @@ -1,49 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class Two { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - List aEdges = List.of(); - List bEdges = List.of(); - - - static class TwoCleaner implements Runnable { - - MemorySegment segment; - TwoCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.Two_destroy(this.segment); - } - } - - Two() {} - Two(MemorySegment handle, List selfEdges, List aEdges, List bEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - this.aEdges = aEdges; - this.bEdges = bEdges; - - - } - - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/UnimportedEnum.java b/feature/tmp/src/main/dev/diplomattest/somelib/UnimportedEnum.java deleted file mode 100644 index 667a1ac..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/UnimportedEnum.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.somelib_h; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.ref.Cleaner; -import java.lang.foreign.SegmentAllocator; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; - -public enum UnimportedEnum { - A, - B, - C, - ; - - static UnimportedEnum fromInt(int i) { - switch (i) { - case 0 -> { - return UnimportedEnum.A; - } - case 1 -> { - return UnimportedEnum.B; - } - case 2 -> { - return UnimportedEnum.C; - } - - } - throw new RuntimeException("Unexpected int for UnimportedEnum:" + i); - } - - int toInt() { - switch (this) { - case A -> { - return 0; - } - case B -> { - return 1; - } - case C -> { - return 2; - } - - } - throw new RuntimeException("Unexpected variant for UnimportedEnum:" + this); - } - - -} diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/Utf16Wrap.java b/feature/tmp/src/main/dev/diplomattest/somelib/Utf16Wrap.java deleted file mode 100644 index b498c80..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/Utf16Wrap.java +++ /dev/null @@ -1,88 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - - -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.ref.Cleaner; -import java.util.List; -import static java.lang.foreign.ValueLayout.*; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -public class Utf16Wrap { - - MemorySegment internal; - Cleaner.Cleanable cleanable; - SegmentAllocator arena; - - List selfEdges = List.of(); - - - static class Utf16WrapCleaner implements Runnable { - - MemorySegment segment; - Utf16WrapCleaner(MemorySegment segment) { - this.segment = segment; - } - - public void run() { - somelib_h.Utf16Wrap_destroy(this.segment); - } - } - - Utf16Wrap() {} - Utf16Wrap(MemorySegment handle, List selfEdges) { - this.internal = handle; - this.selfEdges = selfEdges; - - - } - - public static Utf16Wrap fromUtf16(String input) { - - try (var arena = Arena.ofConfined()) { - var inputData = Arena.ofAuto().allocateFrom(input, StandardCharsets.UTF_16); - var inputLen = inputData.byteSize() - 1; // allocated strings are null terminated - var inputView = DiplomatString16View.allocate(Arena.ofAuto()); - DiplomatString16View.len(inputView, inputLen); - DiplomatString16View.data(inputView, inputData); - var nativeVal = somelib_h.Utf16Wrap_from_utf16(inputView); - - List selfEdges = List.of(); - - - - var returnVal = new Utf16Wrap(nativeVal, selfEdges); - return returnVal; - - } - } - - - public String getDebugStr() { - - - var writeable = somelib_h.diplomat_buffer_write_create(0); - somelib_h.Utf16Wrap_get_debug_str(internal, writeable); - var string = SliceUtils. readUtf8FromWriteable(writeable); - somelib_h.diplomat_buffer_write_destroy(writeable); - return string; - } - - public String borrowCont() { - - try (var arena = Arena.ofConfined()) { - - - var nativeVal = somelib_h.Utf16Wrap_borrow_cont(arena, internal); - - var returnVal = SliceUtils.readUtf16(nativeVal); - return returnVal; - - } - } - -} \ No newline at end of file diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields.java deleted file mode 100644 index 069d1f9..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct BorrowedFields { - * DiplomatString16View a; - * DiplomatStringView b; - * DiplomatStringView c; - * } - * } - */ -public class BorrowedFields { - - BorrowedFields() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - DiplomatString16View.layout().withName("a"), - DiplomatStringView.layout().withName("b"), - DiplomatStringView.layout().withName("c") - ).withName("BorrowedFields"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout a$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("a")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatString16View a - * } - */ - public static final GroupLayout a$layout() { - return a$LAYOUT; - } - - private static final long a$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatString16View a - * } - */ - public static final long a$offset() { - return a$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatString16View a - * } - */ - public static MemorySegment a(MemorySegment struct) { - return struct.asSlice(a$OFFSET, a$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatString16View a - * } - */ - public static void a(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, a$OFFSET, a$LAYOUT.byteSize()); - } - - private static final GroupLayout b$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("b")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatStringView b - * } - */ - public static final GroupLayout b$layout() { - return b$LAYOUT; - } - - private static final long b$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatStringView b - * } - */ - public static final long b$offset() { - return b$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatStringView b - * } - */ - public static MemorySegment b(MemorySegment struct) { - return struct.asSlice(b$OFFSET, b$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatStringView b - * } - */ - public static void b(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, b$OFFSET, b$LAYOUT.byteSize()); - } - - private static final GroupLayout c$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("c")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatStringView c - * } - */ - public static final GroupLayout c$layout() { - return c$LAYOUT; - } - - private static final long c$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatStringView c - * } - */ - public static final long c$offset() { - return c$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatStringView c - * } - */ - public static MemorySegment c(MemorySegment struct) { - return struct.asSlice(c$OFFSET, c$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatStringView c - * } - */ - public static void c(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, c$OFFSET, c$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning.java deleted file mode 100644 index f6ea5f2..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning.java +++ /dev/null @@ -1,127 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct BorrowedFieldsReturning { - * DiplomatStringView bytes; - * } - * } - */ -public class BorrowedFieldsReturning { - - BorrowedFieldsReturning() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - DiplomatStringView.layout().withName("bytes") - ).withName("BorrowedFieldsReturning"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout bytes$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("bytes")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatStringView bytes - * } - */ - public static final GroupLayout bytes$layout() { - return bytes$LAYOUT; - } - - private static final long bytes$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatStringView bytes - * } - */ - public static final long bytes$offset() { - return bytes$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatStringView bytes - * } - */ - public static MemorySegment bytes(MemorySegment struct) { - return struct.asSlice(bytes$OFFSET, bytes$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatStringView bytes - * } - */ - public static void bytes(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, bytes$OFFSET, bytes$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning_option.java deleted file mode 100644 index d58dc99..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsReturning_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct BorrowedFieldsReturning_option { - * union { - * BorrowedFieldsReturning ok; - * }; - * bool is_ok; - * } - * } - */ -public class BorrowedFieldsReturning_option { - - BorrowedFieldsReturning_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - BorrowedFieldsReturning.layout().withName("ok") - ).withName("$anon$18:48"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("BorrowedFieldsReturning_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$18:48"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * BorrowedFieldsReturning ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * BorrowedFieldsReturning ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * BorrowedFieldsReturning ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * BorrowedFieldsReturning ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds.java deleted file mode 100644 index ae8284f..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct BorrowedFieldsWithBounds { - * DiplomatString16View field_a; - * DiplomatStringView field_b; - * DiplomatStringView field_c; - * } - * } - */ -public class BorrowedFieldsWithBounds { - - BorrowedFieldsWithBounds() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - DiplomatString16View.layout().withName("field_a"), - DiplomatStringView.layout().withName("field_b"), - DiplomatStringView.layout().withName("field_c") - ).withName("BorrowedFieldsWithBounds"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout field_a$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("field_a")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatString16View field_a - * } - */ - public static final GroupLayout field_a$layout() { - return field_a$LAYOUT; - } - - private static final long field_a$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatString16View field_a - * } - */ - public static final long field_a$offset() { - return field_a$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatString16View field_a - * } - */ - public static MemorySegment field_a(MemorySegment struct) { - return struct.asSlice(field_a$OFFSET, field_a$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatString16View field_a - * } - */ - public static void field_a(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, field_a$OFFSET, field_a$LAYOUT.byteSize()); - } - - private static final GroupLayout field_b$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("field_b")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatStringView field_b - * } - */ - public static final GroupLayout field_b$layout() { - return field_b$LAYOUT; - } - - private static final long field_b$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatStringView field_b - * } - */ - public static final long field_b$offset() { - return field_b$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatStringView field_b - * } - */ - public static MemorySegment field_b(MemorySegment struct) { - return struct.asSlice(field_b$OFFSET, field_b$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatStringView field_b - * } - */ - public static void field_b(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, field_b$OFFSET, field_b$LAYOUT.byteSize()); - } - - private static final GroupLayout field_c$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("field_c")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatStringView field_c - * } - */ - public static final GroupLayout field_c$layout() { - return field_c$LAYOUT; - } - - private static final long field_c$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatStringView field_c - * } - */ - public static final long field_c$offset() { - return field_c$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatStringView field_c - * } - */ - public static MemorySegment field_c(MemorySegment struct) { - return struct.asSlice(field_c$OFFSET, field_c$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatStringView field_c - * } - */ - public static void field_c(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, field_c$OFFSET, field_c$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds_option.java deleted file mode 100644 index c48810c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFieldsWithBounds_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct BorrowedFieldsWithBounds_option { - * union { - * BorrowedFieldsWithBounds ok; - * }; - * bool is_ok; - * } - * } - */ -public class BorrowedFieldsWithBounds_option { - - BorrowedFieldsWithBounds_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - BorrowedFieldsWithBounds.layout().withName("ok") - ).withName("$anon$20:49"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("BorrowedFieldsWithBounds_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$20:49"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields_option.java deleted file mode 100644 index 0ff95db..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/BorrowedFields_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct BorrowedFields_option { - * union { - * BorrowedFields ok; - * }; - * bool is_ok; - * } - * } - */ -public class BorrowedFields_option { - - BorrowedFields_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - BorrowedFields.layout().withName("ok") - ).withName("$anon$20:39"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("BorrowedFields_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$20:39"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * BorrowedFields ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * BorrowedFields ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * BorrowedFields ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * BorrowedFields ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ContiguousEnum_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ContiguousEnum_option.java deleted file mode 100644 index 9a2a391..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ContiguousEnum_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct ContiguousEnum_option { - * union { - * ContiguousEnum ok; - * }; - * bool is_ok; - * } - * } - */ -public class ContiguousEnum_option { - - ContiguousEnum_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$21:39"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("ContiguousEnum_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$21:39"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * ContiguousEnum ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * ContiguousEnum ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * ContiguousEnum ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * ContiguousEnum ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA.java deleted file mode 100644 index ad7ef68..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA.java +++ /dev/null @@ -1,127 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct CyclicStructA { - * CyclicStructB a; - * } - * } - */ -public class CyclicStructA { - - CyclicStructA() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - CyclicStructB.layout().withName("a") - ).withName("CyclicStructA"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout a$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("a")); - - /** - * Layout for field: - * {@snippet lang=c : - * CyclicStructB a - * } - */ - public static final GroupLayout a$layout() { - return a$LAYOUT; - } - - private static final long a$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * CyclicStructB a - * } - */ - public static final long a$offset() { - return a$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * CyclicStructB a - * } - */ - public static MemorySegment a(MemorySegment struct) { - return struct.asSlice(a$OFFSET, a$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * CyclicStructB a - * } - */ - public static void a(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, a$OFFSET, a$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA_option.java deleted file mode 100644 index 7a58e5d..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructA_option.java +++ /dev/null @@ -1,177 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct CyclicStructA_option { - * union { - * CyclicStructA ok; - * }; - * bool is_ok; - * } - * } - */ -public class CyclicStructA_option { - - CyclicStructA_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - CyclicStructA.layout().withName("ok") - ).withName("$anon$19:38"), - somelib_h.C_BOOL.withName("is_ok") - ).withName("CyclicStructA_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$19:38"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * CyclicStructA ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * CyclicStructA ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * CyclicStructA ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * CyclicStructA ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB.java deleted file mode 100644 index 62095d8..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB.java +++ /dev/null @@ -1,127 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct CyclicStructB { - * uint8_t field; - * } - * } - */ -public class CyclicStructB { - - CyclicStructB() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_CHAR.withName("field") - ).withName("CyclicStructB"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte field$LAYOUT = (OfByte)$LAYOUT.select(groupElement("field")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint8_t field - * } - */ - public static final OfByte field$layout() { - return field$LAYOUT; - } - - private static final long field$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint8_t field - * } - */ - public static final long field$offset() { - return field$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint8_t field - * } - */ - public static byte field(MemorySegment struct) { - return struct.get(field$LAYOUT, field$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint8_t field - * } - */ - public static void field(MemorySegment struct, byte fieldValue) { - struct.set(field$LAYOUT, field$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB_option.java deleted file mode 100644 index 476c455..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/CyclicStructB_option.java +++ /dev/null @@ -1,177 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct CyclicStructB_option { - * union { - * CyclicStructB ok; - * }; - * bool is_ok; - * } - * } - */ -public class CyclicStructB_option { - - CyclicStructB_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - CyclicStructB.layout().withName("ok") - ).withName("$anon$18:38"), - somelib_h.C_BOOL.withName("is_ok") - ).withName("CyclicStructB_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$18:38"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * CyclicStructB ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * CyclicStructB ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * CyclicStructB ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * CyclicStructB ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolArray.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolArray.java deleted file mode 100644 index b4d3357..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolArray.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatBoolArray { - * const bool *data; - * size_t len; - * } - * } - */ -public class DiplomatBoolArray { - - DiplomatBoolArray() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatBoolArray"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolView.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolView.java deleted file mode 100644 index f72f81b..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolView.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatBoolView { - * const bool *data; - * size_t len; - * } - * } - */ -public class DiplomatBoolView { - - DiplomatBoolView() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatBoolView"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const bool *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolViewMut.java deleted file mode 100644 index 08bf3f4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatBoolViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatBoolViewMut { - * bool *data; - * size_t len; - * } - * } - */ -public class DiplomatBoolViewMut { - - DiplomatBoolViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatBoolViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * bool *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharArray.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharArray.java deleted file mode 100644 index ad43f41..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharArray.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatCharArray { - * const char32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatCharArray { - - DiplomatCharArray() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatCharArray"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharView.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharView.java deleted file mode 100644 index 6dc3f0e..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharView.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatCharView { - * const char32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatCharView { - - DiplomatCharView() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatCharView"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharViewMut.java deleted file mode 100644 index a147ed6..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatCharViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatCharViewMut { - * char32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatCharViewMut { - - DiplomatCharViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatCharViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * char32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32Array.java deleted file mode 100644 index 3483f69..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatF32Array { - * const float *data; - * size_t len; - * } - * } - */ -public class DiplomatF32Array { - - DiplomatF32Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatF32Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32View.java deleted file mode 100644 index ef9439b..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatF32View { - * const float *data; - * size_t len; - * } - * } - */ -public class DiplomatF32View { - - DiplomatF32View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatF32View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const float *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32ViewMut.java deleted file mode 100644 index 2c1ff7f..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF32ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatF32ViewMut { - * float *data; - * size_t len; - * } - * } - */ -public class DiplomatF32ViewMut { - - DiplomatF32ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatF32ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * float *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * float *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64Array.java deleted file mode 100644 index f31fa2f..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatF64Array { - * const double *data; - * size_t len; - * } - * } - */ -public class DiplomatF64Array { - - DiplomatF64Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatF64Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64View.java deleted file mode 100644 index d196096..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatF64View { - * const double *data; - * size_t len; - * } - * } - */ -public class DiplomatF64View { - - DiplomatF64View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatF64View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const double *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64ViewMut.java deleted file mode 100644 index b76f35e..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatF64ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatF64ViewMut { - * double *data; - * size_t len; - * } - * } - */ -public class DiplomatF64ViewMut { - - DiplomatF64ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatF64ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * double *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16Array.java deleted file mode 100644 index 08f0493..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI16Array { - * const int16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI16Array { - - DiplomatI16Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI16Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16View.java deleted file mode 100644 index 265552c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI16View { - * const int16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI16View { - - DiplomatI16View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI16View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16ViewMut.java deleted file mode 100644 index 54fefcc..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI16ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI16ViewMut { - * int16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI16ViewMut { - - DiplomatI16ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI16ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * int16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32Array.java deleted file mode 100644 index a33abc5..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI32Array { - * const int32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI32Array { - - DiplomatI32Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI32Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32View.java deleted file mode 100644 index d5c0eff..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI32View { - * const int32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI32View { - - DiplomatI32View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI32View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32ViewMut.java deleted file mode 100644 index ee22a4c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI32ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI32ViewMut { - * int32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI32ViewMut { - - DiplomatI32ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI32ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * int32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64Array.java deleted file mode 100644 index db76036..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI64Array { - * const int64_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI64Array { - - DiplomatI64Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI64Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64View.java deleted file mode 100644 index 2ae01c5..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI64View { - * const int64_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI64View { - - DiplomatI64View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI64View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int64_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64ViewMut.java deleted file mode 100644 index 44ffdab..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI64ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI64ViewMut { - * int64_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI64ViewMut { - - DiplomatI64ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI64ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * int64_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int64_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int64_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int64_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8Array.java deleted file mode 100644 index cea362b..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI8Array { - * const int8_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI8Array { - - DiplomatI8Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI8Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8View.java deleted file mode 100644 index c8240e1..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI8View { - * const int8_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI8View { - - DiplomatI8View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI8View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const int8_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8ViewMut.java deleted file mode 100644 index 3f93021..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatI8ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatI8ViewMut { - * int8_t *data; - * size_t len; - * } - * } - */ -public class DiplomatI8ViewMut { - - DiplomatI8ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatI8ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * int8_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int8_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int8_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int8_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeArray.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeArray.java deleted file mode 100644 index 4e4b5a2..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeArray.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatIsizeArray { - * const intptr_t *data; - * size_t len; - * } - * } - */ -public class DiplomatIsizeArray { - - DiplomatIsizeArray() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatIsizeArray"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeView.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeView.java deleted file mode 100644 index 953f1aa..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeView.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatIsizeView { - * const intptr_t *data; - * size_t len; - * } - * } - */ -public class DiplomatIsizeView { - - DiplomatIsizeView() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatIsizeView"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const intptr_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeViewMut.java deleted file mode 100644 index baa2ddd..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatIsizeViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatIsizeViewMut { - * intptr_t *data; - * size_t len; - * } - * } - */ -public class DiplomatIsizeViewMut { - - DiplomatIsizeViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatIsizeViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * intptr_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * intptr_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * intptr_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * intptr_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16Array.java deleted file mode 100644 index d69cc5c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatString16Array { - * const char16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatString16Array { - - DiplomatString16Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatString16Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16View.java deleted file mode 100644 index 192de99..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatString16View { - * const char16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatString16View { - - DiplomatString16View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatString16View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16ViewMut.java deleted file mode 100644 index c2da631..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatString16ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatString16ViewMut { - * char16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatString16ViewMut { - - DiplomatString16ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatString16ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * char16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringArray.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringArray.java deleted file mode 100644 index d7aa9f6..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringArray.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStringArray { - * const char *data; - * size_t len; - * } - * } - */ -public class DiplomatStringArray { - - DiplomatStringArray() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStringArray"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringView.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringView.java deleted file mode 100644 index 185d5af..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringView.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStringView { - * const char *data; - * size_t len; - * } - * } - */ -public class DiplomatStringView { - - DiplomatStringView() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStringView"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const char *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringViewMut.java deleted file mode 100644 index 676f124..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStringViewMut { - * char *data; - * size_t len; - * } - * } - */ -public class DiplomatStringViewMut { - - DiplomatStringViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStringViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * char *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16Array.java deleted file mode 100644 index b2c9354..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStrings16Array { - * const DiplomatString16View *data; - * size_t len; - * } - * } - */ -public class DiplomatStrings16Array { - - DiplomatStrings16Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStrings16Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16View.java deleted file mode 100644 index 3e10bbe..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStrings16View { - * const DiplomatString16View *data; - * size_t len; - * } - * } - */ -public class DiplomatStrings16View { - - DiplomatStrings16View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStrings16View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const DiplomatString16View *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16ViewMut.java deleted file mode 100644 index bf9559f..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStrings16ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStrings16ViewMut { - * DiplomatString16View *data; - * size_t len; - * } - * } - */ -public class DiplomatStrings16ViewMut { - - DiplomatStrings16ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStrings16ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatString16View *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatString16View *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatString16View *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatString16View *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsArray.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsArray.java deleted file mode 100644 index bef36d3..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsArray.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStringsArray { - * const DiplomatStringView *data; - * size_t len; - * } - * } - */ -public class DiplomatStringsArray { - - DiplomatStringsArray() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStringsArray"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsView.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsView.java deleted file mode 100644 index 9e16e26..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsView.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStringsView { - * const DiplomatStringView *data; - * size_t len; - * } - * } - */ -public class DiplomatStringsView { - - DiplomatStringsView() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStringsView"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const DiplomatStringView *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsViewMut.java deleted file mode 100644 index df60856..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatStringsViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatStringsViewMut { - * DiplomatStringView *data; - * size_t len; - * } - * } - */ -public class DiplomatStringsViewMut { - - DiplomatStringsViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatStringsViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * DiplomatStringView *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * DiplomatStringView *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * DiplomatStringView *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * DiplomatStringView *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16Array.java deleted file mode 100644 index 482eea7..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU16Array { - * const uint16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU16Array { - - DiplomatU16Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU16Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16View.java deleted file mode 100644 index a8c75ea..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU16View { - * const uint16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU16View { - - DiplomatU16View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU16View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16ViewMut.java deleted file mode 100644 index f4c4051..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU16ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU16ViewMut { - * uint16_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU16ViewMut { - - DiplomatU16ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU16ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint16_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint16_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint16_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint16_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32Array.java deleted file mode 100644 index 8ecc93d..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU32Array { - * const uint32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU32Array { - - DiplomatU32Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU32Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32View.java deleted file mode 100644 index 5b0e57b..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU32View { - * const uint32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU32View { - - DiplomatU32View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU32View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32ViewMut.java deleted file mode 100644 index e516c6b..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU32ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU32ViewMut { - * uint32_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU32ViewMut { - - DiplomatU32ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU32ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64Array.java deleted file mode 100644 index 5b407a9..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU64Array { - * const uint64_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU64Array { - - DiplomatU64Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU64Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64View.java deleted file mode 100644 index 2ec76ae..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU64View { - * const uint64_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU64View { - - DiplomatU64View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU64View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint64_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64ViewMut.java deleted file mode 100644 index 7e0d0b0..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU64ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU64ViewMut { - * uint64_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU64ViewMut { - - DiplomatU64ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU64ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8Array.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8Array.java deleted file mode 100644 index 66872b9..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8Array.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU8Array { - * const uint8_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU8Array { - - DiplomatU8Array() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU8Array"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8View.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8View.java deleted file mode 100644 index 3c66711..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8View.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU8View { - * const uint8_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU8View { - - DiplomatU8View() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU8View"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const uint8_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8ViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8ViewMut.java deleted file mode 100644 index f04cc0c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatU8ViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatU8ViewMut { - * uint8_t *data; - * size_t len; - * } - * } - */ -public class DiplomatU8ViewMut { - - DiplomatU8ViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatU8ViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint8_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint8_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint8_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint8_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeArray.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeArray.java deleted file mode 100644 index 21b119c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeArray.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatUsizeArray { - * const size_t *data; - * size_t len; - * } - * } - */ -public class DiplomatUsizeArray { - - DiplomatUsizeArray() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatUsizeArray"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeView.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeView.java deleted file mode 100644 index ba9b410..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeView.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatUsizeView { - * const size_t *data; - * size_t len; - * } - * } - */ -public class DiplomatUsizeView { - - DiplomatUsizeView() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatUsizeView"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * const size_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeViewMut.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeViewMut.java deleted file mode 100644 index 99c1929..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatUsizeViewMut.java +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatUsizeViewMut { - * size_t *data; - * size_t len; - * } - * } - */ -public class DiplomatUsizeViewMut { - - DiplomatUsizeViewMut() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("data"), - somelib_h.C_LONG.withName("len") - ).withName("DiplomatUsizeViewMut"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout data$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("data")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t *data - * } - */ - public static final AddressLayout data$layout() { - return data$LAYOUT; - } - - private static final long data$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t *data - * } - */ - public static final long data$offset() { - return data$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t *data - * } - */ - public static MemorySegment data(MemorySegment struct) { - return struct.get(data$LAYOUT, data$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t *data - * } - */ - public static void data(MemorySegment struct, MemorySegment fieldValue) { - struct.set(data$LAYOUT, data$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatWrite.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatWrite.java deleted file mode 100644 index 6da2825..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/DiplomatWrite.java +++ /dev/null @@ -1,512 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct DiplomatWrite { - * void *context; - * char *buf; - * size_t len; - * size_t cap; - * bool grow_failed; - * void (*flush)(struct DiplomatWrite *); - * bool (*grow)(struct DiplomatWrite *, size_t); - * } - * } - */ -public class DiplomatWrite { - - DiplomatWrite() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("context"), - somelib_h.C_POINTER.withName("buf"), - somelib_h.C_LONG.withName("len"), - somelib_h.C_LONG.withName("cap"), - somelib_h.C_BOOL.withName("grow_failed"), - MemoryLayout.paddingLayout(7), - somelib_h.C_POINTER.withName("flush"), - somelib_h.C_POINTER.withName("grow") - ).withName("DiplomatWrite"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout context$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("context")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *context - * } - */ - public static final AddressLayout context$layout() { - return context$LAYOUT; - } - - private static final long context$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * void *context - * } - */ - public static final long context$offset() { - return context$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *context - * } - */ - public static MemorySegment context(MemorySegment struct) { - return struct.get(context$LAYOUT, context$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *context - * } - */ - public static void context(MemorySegment struct, MemorySegment fieldValue) { - struct.set(context$LAYOUT, context$OFFSET, fieldValue); - } - - private static final AddressLayout buf$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("buf")); - - /** - * Layout for field: - * {@snippet lang=c : - * char *buf - * } - */ - public static final AddressLayout buf$layout() { - return buf$LAYOUT; - } - - private static final long buf$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char *buf - * } - */ - public static final long buf$offset() { - return buf$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char *buf - * } - */ - public static MemorySegment buf(MemorySegment struct) { - return struct.get(buf$LAYOUT, buf$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char *buf - * } - */ - public static void buf(MemorySegment struct, MemorySegment fieldValue) { - struct.set(buf$LAYOUT, buf$OFFSET, fieldValue); - } - - private static final OfLong len$LAYOUT = (OfLong)$LAYOUT.select(groupElement("len")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final OfLong len$layout() { - return len$LAYOUT; - } - - private static final long len$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static final long len$offset() { - return len$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static long len(MemorySegment struct) { - return struct.get(len$LAYOUT, len$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t len - * } - */ - public static void len(MemorySegment struct, long fieldValue) { - struct.set(len$LAYOUT, len$OFFSET, fieldValue); - } - - private static final OfLong cap$LAYOUT = (OfLong)$LAYOUT.select(groupElement("cap")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t cap - * } - */ - public static final OfLong cap$layout() { - return cap$LAYOUT; - } - - private static final long cap$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t cap - * } - */ - public static final long cap$offset() { - return cap$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t cap - * } - */ - public static long cap(MemorySegment struct) { - return struct.get(cap$LAYOUT, cap$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t cap - * } - */ - public static void cap(MemorySegment struct, long fieldValue) { - struct.set(cap$LAYOUT, cap$OFFSET, fieldValue); - } - - private static final OfBoolean grow_failed$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("grow_failed")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool grow_failed - * } - */ - public static final OfBoolean grow_failed$layout() { - return grow_failed$LAYOUT; - } - - private static final long grow_failed$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * bool grow_failed - * } - */ - public static final long grow_failed$offset() { - return grow_failed$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool grow_failed - * } - */ - public static boolean grow_failed(MemorySegment struct) { - return struct.get(grow_failed$LAYOUT, grow_failed$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool grow_failed - * } - */ - public static void grow_failed(MemorySegment struct, boolean fieldValue) { - struct.set(grow_failed$LAYOUT, grow_failed$OFFSET, fieldValue); - } - - /** - * {@snippet lang=c : - * void (*flush)(struct DiplomatWrite *) - * } - */ - public static class flush { - - flush() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment _x0); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(flush.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(flush.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment _x0) { - try { - DOWN$MH.invokeExact(funcPtr, _x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout flush$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("flush")); - - /** - * Layout for field: - * {@snippet lang=c : - * void (*flush)(struct DiplomatWrite *) - * } - */ - public static final AddressLayout flush$layout() { - return flush$LAYOUT; - } - - private static final long flush$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * void (*flush)(struct DiplomatWrite *) - * } - */ - public static final long flush$offset() { - return flush$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void (*flush)(struct DiplomatWrite *) - * } - */ - public static MemorySegment flush(MemorySegment struct) { - return struct.get(flush$LAYOUT, flush$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void (*flush)(struct DiplomatWrite *) - * } - */ - public static void flush(MemorySegment struct, MemorySegment fieldValue) { - struct.set(flush$LAYOUT, flush$OFFSET, fieldValue); - } - - /** - * {@snippet lang=c : - * bool (*grow)(struct DiplomatWrite *, size_t) - * } - */ - public static class grow { - - grow() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - boolean apply(MemorySegment _x0, long _x1); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_BOOL, - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(grow.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(grow.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static boolean invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { - try { - return (boolean) DOWN$MH.invokeExact(funcPtr, _x0, _x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout grow$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("grow")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool (*grow)(struct DiplomatWrite *, size_t) - * } - */ - public static final AddressLayout grow$layout() { - return grow$LAYOUT; - } - - private static final long grow$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * bool (*grow)(struct DiplomatWrite *, size_t) - * } - */ - public static final long grow$offset() { - return grow$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool (*grow)(struct DiplomatWrite *, size_t) - * } - */ - public static MemorySegment grow(MemorySegment struct) { - return struct.get(grow$LAYOUT, grow$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool (*grow)(struct DiplomatWrite *, size_t) - * } - */ - public static void grow(MemorySegment struct, MemorySegment fieldValue) { - struct.set(grow$LAYOUT, grow$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/FILE.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/FILE.java deleted file mode 100644 index c73dc11..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/FILE.java +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct __sFILE { - * unsigned char *_p; - * int _r; - * int _w; - * short _flags; - * short _file; - * struct __sbuf _bf; - * int _lbfsize; - * void *_cookie; - * int (* _Nullable _close)(void *); - * int (* _Nullable _read)(void *, char *, int); - * fpos_t (* _Nullable _seek)(void *, fpos_t, int); - * int (* _Nullable _write)(void *, const char *, int); - * struct __sbuf _ub; - * struct __sFILEX *_extra; - * int _ur; - * unsigned char _ubuf[3]; - * unsigned char _nbuf[1]; - * struct __sbuf _lb; - * int _blksize; - * fpos_t _offset; - * } FILE - * } - */ -public class FILE extends __sFILE { - - FILE() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct.java deleted file mode 100644 index 0ef6656..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct ImportedStruct { - * UnimportedEnum foo; - * uint8_t count; - * } - * } - */ -public class ImportedStruct { - - ImportedStruct() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_INT.withName("foo"), - somelib_h.C_CHAR.withName("count"), - MemoryLayout.paddingLayout(3) - ).withName("ImportedStruct"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt foo$LAYOUT = (OfInt)$LAYOUT.select(groupElement("foo")); - - /** - * Layout for field: - * {@snippet lang=c : - * UnimportedEnum foo - * } - */ - public static final OfInt foo$layout() { - return foo$LAYOUT; - } - - private static final long foo$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * UnimportedEnum foo - * } - */ - public static final long foo$offset() { - return foo$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * UnimportedEnum foo - * } - */ - public static int foo(MemorySegment struct) { - return struct.get(foo$LAYOUT, foo$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * UnimportedEnum foo - * } - */ - public static void foo(MemorySegment struct, int fieldValue) { - struct.set(foo$LAYOUT, foo$OFFSET, fieldValue); - } - - private static final OfByte count$LAYOUT = (OfByte)$LAYOUT.select(groupElement("count")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint8_t count - * } - */ - public static final OfByte count$layout() { - return count$LAYOUT; - } - - private static final long count$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * uint8_t count - * } - */ - public static final long count$offset() { - return count$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint8_t count - * } - */ - public static byte count(MemorySegment struct) { - return struct.get(count$LAYOUT, count$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint8_t count - * } - */ - public static void count(MemorySegment struct, byte fieldValue) { - struct.set(count$LAYOUT, count$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct_option.java deleted file mode 100644 index 37243ec..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/ImportedStruct_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct ImportedStruct_option { - * union { - * ImportedStruct ok; - * }; - * bool is_ok; - * } - * } - */ -public class ImportedStruct_option { - - ImportedStruct_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - ImportedStruct.layout().withName("ok") - ).withName("$anon$20:39"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("ImportedStruct_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$20:39"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * ImportedStruct ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * ImportedStruct ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * ImportedStruct ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * ImportedStruct ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyEnum_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyEnum_option.java deleted file mode 100644 index 69c0811..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyEnum_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct MyEnum_option { - * union { - * MyEnum ok; - * }; - * bool is_ok; - * } - * } - */ -public class MyEnum_option { - - MyEnum_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$23:31"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("MyEnum_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$23:31"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * MyEnum ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * MyEnum ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * MyEnum ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * MyEnum ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct.java deleted file mode 100644 index 4cd6b64..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct.java +++ /dev/null @@ -1,405 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct MyStruct { - * uint8_t a; - * bool b; - * uint8_t c; - * uint64_t d; - * int32_t e; - * char32_t f; - * MyEnum g; - * } - * } - */ -public class MyStruct { - - MyStruct() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_CHAR.withName("a"), - somelib_h.C_BOOL.withName("b"), - somelib_h.C_CHAR.withName("c"), - MemoryLayout.paddingLayout(5), - somelib_h.C_LONG_LONG.withName("d"), - somelib_h.C_INT.withName("e"), - somelib_h.C_INT.withName("f"), - somelib_h.C_INT.withName("g"), - MemoryLayout.paddingLayout(4) - ).withName("MyStruct"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte a$LAYOUT = (OfByte)$LAYOUT.select(groupElement("a")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint8_t a - * } - */ - public static final OfByte a$layout() { - return a$LAYOUT; - } - - private static final long a$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint8_t a - * } - */ - public static final long a$offset() { - return a$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint8_t a - * } - */ - public static byte a(MemorySegment struct) { - return struct.get(a$LAYOUT, a$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint8_t a - * } - */ - public static void a(MemorySegment struct, byte fieldValue) { - struct.set(a$LAYOUT, a$OFFSET, fieldValue); - } - - private static final OfBoolean b$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("b")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool b - * } - */ - public static final OfBoolean b$layout() { - return b$LAYOUT; - } - - private static final long b$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * bool b - * } - */ - public static final long b$offset() { - return b$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool b - * } - */ - public static boolean b(MemorySegment struct) { - return struct.get(b$LAYOUT, b$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool b - * } - */ - public static void b(MemorySegment struct, boolean fieldValue) { - struct.set(b$LAYOUT, b$OFFSET, fieldValue); - } - - private static final OfByte c$LAYOUT = (OfByte)$LAYOUT.select(groupElement("c")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint8_t c - * } - */ - public static final OfByte c$layout() { - return c$LAYOUT; - } - - private static final long c$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * uint8_t c - * } - */ - public static final long c$offset() { - return c$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint8_t c - * } - */ - public static byte c(MemorySegment struct) { - return struct.get(c$LAYOUT, c$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint8_t c - * } - */ - public static void c(MemorySegment struct, byte fieldValue) { - struct.set(c$LAYOUT, c$OFFSET, fieldValue); - } - - private static final OfLong d$LAYOUT = (OfLong)$LAYOUT.select(groupElement("d")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t d - * } - */ - public static final OfLong d$layout() { - return d$LAYOUT; - } - - private static final long d$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t d - * } - */ - public static final long d$offset() { - return d$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t d - * } - */ - public static long d(MemorySegment struct) { - return struct.get(d$LAYOUT, d$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t d - * } - */ - public static void d(MemorySegment struct, long fieldValue) { - struct.set(d$LAYOUT, d$OFFSET, fieldValue); - } - - private static final OfInt e$LAYOUT = (OfInt)$LAYOUT.select(groupElement("e")); - - /** - * Layout for field: - * {@snippet lang=c : - * int32_t e - * } - */ - public static final OfInt e$layout() { - return e$LAYOUT; - } - - private static final long e$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * int32_t e - * } - */ - public static final long e$offset() { - return e$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int32_t e - * } - */ - public static int e(MemorySegment struct) { - return struct.get(e$LAYOUT, e$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int32_t e - * } - */ - public static void e(MemorySegment struct, int fieldValue) { - struct.set(e$LAYOUT, e$OFFSET, fieldValue); - } - - private static final OfInt f$LAYOUT = (OfInt)$LAYOUT.select(groupElement("f")); - - /** - * Layout for field: - * {@snippet lang=c : - * char32_t f - * } - */ - public static final OfInt f$layout() { - return f$LAYOUT; - } - - private static final long f$OFFSET = 20; - - /** - * Offset for field: - * {@snippet lang=c : - * char32_t f - * } - */ - public static final long f$offset() { - return f$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char32_t f - * } - */ - public static int f(MemorySegment struct) { - return struct.get(f$LAYOUT, f$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char32_t f - * } - */ - public static void f(MemorySegment struct, int fieldValue) { - struct.set(f$LAYOUT, f$OFFSET, fieldValue); - } - - private static final OfInt g$LAYOUT = (OfInt)$LAYOUT.select(groupElement("g")); - - /** - * Layout for field: - * {@snippet lang=c : - * MyEnum g - * } - */ - public static final OfInt g$layout() { - return g$LAYOUT; - } - - private static final long g$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * MyEnum g - * } - */ - public static final long g$offset() { - return g$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * MyEnum g - * } - */ - public static int g(MemorySegment struct) { - return struct.get(g$LAYOUT, g$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * MyEnum g - * } - */ - public static void g(MemorySegment struct, int fieldValue) { - struct.set(g$LAYOUT, g$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct_option.java deleted file mode 100644 index 25582a4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/MyStruct_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct MyStruct_option { - * union { - * MyStruct ok; - * }; - * bool is_ok; - * } - * } - */ -public class MyStruct_option { - - MyStruct_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - MyStruct.layout().withName("ok") - ).withName("$anon$25:33"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("MyStruct_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$25:33"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * MyStruct ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * MyStruct ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * MyStruct ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * MyStruct ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields.java deleted file mode 100644 index f543e06..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct NestedBorrowedFields { - * BorrowedFields fields; - * BorrowedFieldsWithBounds bounds; - * BorrowedFieldsWithBounds bounds2; - * } - * } - */ -public class NestedBorrowedFields { - - NestedBorrowedFields() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - BorrowedFields.layout().withName("fields"), - BorrowedFieldsWithBounds.layout().withName("bounds"), - BorrowedFieldsWithBounds.layout().withName("bounds2") - ).withName("NestedBorrowedFields"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout fields$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fields")); - - /** - * Layout for field: - * {@snippet lang=c : - * BorrowedFields fields - * } - */ - public static final GroupLayout fields$layout() { - return fields$LAYOUT; - } - - private static final long fields$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * BorrowedFields fields - * } - */ - public static final long fields$offset() { - return fields$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * BorrowedFields fields - * } - */ - public static MemorySegment fields(MemorySegment struct) { - return struct.asSlice(fields$OFFSET, fields$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * BorrowedFields fields - * } - */ - public static void fields(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, fields$OFFSET, fields$LAYOUT.byteSize()); - } - - private static final GroupLayout bounds$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("bounds")); - - /** - * Layout for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds - * } - */ - public static final GroupLayout bounds$layout() { - return bounds$LAYOUT; - } - - private static final long bounds$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds - * } - */ - public static final long bounds$offset() { - return bounds$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds - * } - */ - public static MemorySegment bounds(MemorySegment struct) { - return struct.asSlice(bounds$OFFSET, bounds$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds - * } - */ - public static void bounds(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, bounds$OFFSET, bounds$LAYOUT.byteSize()); - } - - private static final GroupLayout bounds2$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("bounds2")); - - /** - * Layout for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds2 - * } - */ - public static final GroupLayout bounds2$layout() { - return bounds2$LAYOUT; - } - - private static final long bounds2$OFFSET = 96; - - /** - * Offset for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds2 - * } - */ - public static final long bounds2$offset() { - return bounds2$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds2 - * } - */ - public static MemorySegment bounds2(MemorySegment struct) { - return struct.asSlice(bounds2$OFFSET, bounds2$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * BorrowedFieldsWithBounds bounds2 - * } - */ - public static void bounds2(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, bounds2$OFFSET, bounds2$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields_option.java deleted file mode 100644 index 519f9bd..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/NestedBorrowedFields_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct NestedBorrowedFields_option { - * union { - * NestedBorrowedFields ok; - * }; - * bool is_ok; - * } - * } - */ -public class NestedBorrowedFields_option { - - NestedBorrowedFields_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - NestedBorrowedFields.layout().withName("ok") - ).withName("$anon$22:45"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("NestedBorrowedFields_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout ok$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("$anon$22:45"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * NestedBorrowedFields ok - * } - */ - public static final GroupLayout ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * NestedBorrowedFields ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * NestedBorrowedFields ok - * } - */ - public static MemorySegment ok(MemorySegment struct) { - return struct.asSlice(ok$OFFSET, ok$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * NestedBorrowedFields ok - * } - */ - public static void ok(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ok$OFFSET, ok$LAYOUT.byteSize()); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 144; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionBool.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionBool.java deleted file mode 100644 index d5b76f4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionBool.java +++ /dev/null @@ -1,177 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionBool { - * union { - * bool ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionBool { - - OptionBool() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_BOOL.withName("ok") - ).withName("$anon$65:1"), - somelib_h.C_BOOL.withName("is_ok") - ).withName("OptionBool"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfBoolean ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("$anon$65:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool ok - * } - */ - public static final OfBoolean ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * bool ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool ok - * } - */ - public static boolean ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool ok - * } - */ - public static void ok(MemorySegment struct, boolean fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionChar.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionChar.java deleted file mode 100644 index 725e7a3..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionChar.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionChar { - * union { - * char32_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionChar { - - OptionChar() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$66:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("OptionChar"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$66:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * char32_t ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char32_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char32_t ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char32_t ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF32.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF32.java deleted file mode 100644 index 3676aad..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF32.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionF32 { - * union { - * float ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionF32 { - - OptionF32() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_FLOAT.withName("ok") - ).withName("$anon$63:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("OptionF32"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfFloat ok$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("$anon$63:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * float ok - * } - */ - public static final OfFloat ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * float ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float ok - * } - */ - public static float ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float ok - * } - */ - public static void ok(MemorySegment struct, float fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF64.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF64.java deleted file mode 100644 index c229899..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionF64.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionF64 { - * union { - * double ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionF64 { - - OptionF64() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_DOUBLE.withName("ok") - ).withName("$anon$64:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("OptionF64"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble ok$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("$anon$64:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * double ok - * } - */ - public static final OfDouble ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double ok - * } - */ - public static double ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double ok - * } - */ - public static void ok(MemorySegment struct, double fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI16.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI16.java deleted file mode 100644 index 05771e5..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI16.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionI16 { - * union { - * int16_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionI16 { - - OptionI16() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_SHORT.withName("ok") - ).withName("$anon$55:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(1) - ).withName("OptionI16"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfShort ok$LAYOUT = (OfShort)$LAYOUT.select(groupElement("$anon$55:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * int16_t ok - * } - */ - public static final OfShort ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int16_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int16_t ok - * } - */ - public static short ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int16_t ok - * } - */ - public static void ok(MemorySegment struct, short fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI32.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI32.java deleted file mode 100644 index e551c46..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI32.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionI32 { - * union { - * int32_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionI32 { - - OptionI32() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$57:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("OptionI32"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$57:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * int32_t ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int32_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int32_t ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int32_t ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI64.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI64.java deleted file mode 100644 index df7b61d..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI64.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionI64 { - * union { - * int64_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionI64 { - - OptionI64() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_LONG_LONG.withName("ok") - ).withName("$anon$59:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("OptionI64"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong ok$LAYOUT = (OfLong)$LAYOUT.select(groupElement("$anon$59:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * int64_t ok - * } - */ - public static final OfLong ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int64_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int64_t ok - * } - */ - public static long ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int64_t ok - * } - */ - public static void ok(MemorySegment struct, long fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI8.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI8.java deleted file mode 100644 index b7326e6..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionI8.java +++ /dev/null @@ -1,177 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionI8 { - * union { - * int8_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionI8 { - - OptionI8() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_CHAR.withName("ok") - ).withName("$anon$53:1"), - somelib_h.C_BOOL.withName("is_ok") - ).withName("OptionI8"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte ok$LAYOUT = (OfByte)$LAYOUT.select(groupElement("$anon$53:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * int8_t ok - * } - */ - public static final OfByte ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int8_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int8_t ok - * } - */ - public static byte ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int8_t ok - * } - */ - public static void ok(MemorySegment struct, byte fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionIsize.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionIsize.java deleted file mode 100644 index 14b7355..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionIsize.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionIsize { - * union { - * intptr_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionIsize { - - OptionIsize() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_LONG.withName("ok") - ).withName("$anon$61:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("OptionIsize"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong ok$LAYOUT = (OfLong)$LAYOUT.select(groupElement("$anon$61:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * intptr_t ok - * } - */ - public static final OfLong ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * intptr_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * intptr_t ok - * } - */ - public static long ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * intptr_t ok - * } - */ - public static void ok(MemorySegment struct, long fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU16.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU16.java deleted file mode 100644 index 9e96cb0..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU16.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionU16 { - * union { - * uint16_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionU16 { - - OptionU16() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_SHORT.withName("ok") - ).withName("$anon$56:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(1) - ).withName("OptionU16"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfShort ok$LAYOUT = (OfShort)$LAYOUT.select(groupElement("$anon$56:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint16_t ok - * } - */ - public static final OfShort ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint16_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint16_t ok - * } - */ - public static short ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint16_t ok - * } - */ - public static void ok(MemorySegment struct, short fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU32.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU32.java deleted file mode 100644 index cbf82c4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU32.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionU32 { - * union { - * uint32_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionU32 { - - OptionU32() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$58:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("OptionU32"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$58:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint32_t ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint32_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint32_t ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint32_t ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU64.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU64.java deleted file mode 100644 index 612971f..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU64.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionU64 { - * union { - * uint64_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionU64 { - - OptionU64() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_LONG_LONG.withName("ok") - ).withName("$anon$60:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("OptionU64"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong ok$LAYOUT = (OfLong)$LAYOUT.select(groupElement("$anon$60:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint64_t ok - * } - */ - public static final OfLong ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint64_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint64_t ok - * } - */ - public static long ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint64_t ok - * } - */ - public static void ok(MemorySegment struct, long fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU8.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU8.java deleted file mode 100644 index e4878a0..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionU8.java +++ /dev/null @@ -1,177 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionU8 { - * union { - * uint8_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionU8 { - - OptionU8() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_CHAR.withName("ok") - ).withName("$anon$54:1"), - somelib_h.C_BOOL.withName("is_ok") - ).withName("OptionU8"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte ok$LAYOUT = (OfByte)$LAYOUT.select(groupElement("$anon$54:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * uint8_t ok - * } - */ - public static final OfByte ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * uint8_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * uint8_t ok - * } - */ - public static byte ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * uint8_t ok - * } - */ - public static void ok(MemorySegment struct, byte fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionUsize.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionUsize.java deleted file mode 100644 index d88ea49..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/OptionUsize.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct OptionUsize { - * union { - * size_t ok; - * }; - * bool is_ok; - * } - * } - */ -public class OptionUsize { - - OptionUsize() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_LONG.withName("ok") - ).withName("$anon$62:1"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(7) - ).withName("OptionUsize"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong ok$LAYOUT = (OfLong)$LAYOUT.select(groupElement("$anon$62:1"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * size_t ok - * } - */ - public static final OfLong ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * size_t ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * size_t ok - * } - */ - public static long ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * size_t ok - * } - */ - public static void ok(MemorySegment struct, long fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/UnimportedEnum_option.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/UnimportedEnum_option.java deleted file mode 100644 index 5a204c6..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/UnimportedEnum_option.java +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct UnimportedEnum_option { - * union { - * UnimportedEnum ok; - * }; - * bool is_ok; - * } - * } - */ -public class UnimportedEnum_option { - - UnimportedEnum_option() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.unionLayout( - somelib_h.C_INT.withName("ok") - ).withName("$anon$20:39"), - somelib_h.C_BOOL.withName("is_ok"), - MemoryLayout.paddingLayout(3) - ).withName("UnimportedEnum_option"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("$anon$20:39"), groupElement("ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * UnimportedEnum ok - * } - */ - public static final OfInt ok$layout() { - return ok$LAYOUT; - } - - private static final long ok$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * UnimportedEnum ok - * } - */ - public static final long ok$offset() { - return ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * UnimportedEnum ok - * } - */ - public static int ok(MemorySegment struct) { - return struct.get(ok$LAYOUT, ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * UnimportedEnum ok - * } - */ - public static void ok(MemorySegment struct, int fieldValue) { - struct.set(ok$LAYOUT, ok$OFFSET, fieldValue); - } - - private static final OfBoolean is_ok$LAYOUT = (OfBoolean)$LAYOUT.select(groupElement("is_ok")); - - /** - * Layout for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final OfBoolean is_ok$layout() { - return is_ok$LAYOUT; - } - - private static final long is_ok$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static final long is_ok$offset() { - return is_ok$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static boolean is_ok(MemorySegment struct) { - return struct.get(is_ok$LAYOUT, is_ok$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * bool is_ok - * } - */ - public static void is_ok(MemorySegment struct, boolean fieldValue) { - struct.set(is_ok$LAYOUT, is_ok$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_mbstate_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_mbstate_t.java deleted file mode 100644 index 53cbe98..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_mbstate_t.java +++ /dev/null @@ -1,26 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef __mbstate_t __darwin_mbstate_t - * } - */ -public class __darwin_mbstate_t extends __mbstate_t { - - __darwin_mbstate_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_attr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_attr_t.java deleted file mode 100644 index 5ec0ad4..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_attr_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_attr_t { - * long __sig; - * char __opaque[56]; - * } __darwin_pthread_attr_t - * } - */ -public class __darwin_pthread_attr_t extends _opaque_pthread_attr_t { - - __darwin_pthread_attr_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_cond_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_cond_t.java deleted file mode 100644 index 82e1d13..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_cond_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_cond_t { - * long __sig; - * char __opaque[40]; - * } __darwin_pthread_cond_t - * } - */ -public class __darwin_pthread_cond_t extends _opaque_pthread_cond_t { - - __darwin_pthread_cond_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_condattr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_condattr_t.java deleted file mode 100644 index 598f5a2..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_condattr_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_condattr_t { - * long __sig; - * char __opaque[8]; - * } __darwin_pthread_condattr_t - * } - */ -public class __darwin_pthread_condattr_t extends _opaque_pthread_condattr_t { - - __darwin_pthread_condattr_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_handler_rec.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_handler_rec.java deleted file mode 100644 index ea9c9af..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_handler_rec.java +++ /dev/null @@ -1,272 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec { - * void (*__routine)(void *); - * void *__arg; - * struct __darwin_pthread_handler_rec *__next; - * } - * } - */ -public class __darwin_pthread_handler_rec { - - __darwin_pthread_handler_rec() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("__routine"), - somelib_h.C_POINTER.withName("__arg"), - somelib_h.C_POINTER.withName("__next") - ).withName("__darwin_pthread_handler_rec"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - /** - * {@snippet lang=c : - * void (*__routine)(void *) - * } - */ - public static class __routine { - - __routine() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment _x0); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(__routine.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(__routine.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment _x0) { - try { - DOWN$MH.invokeExact(funcPtr, _x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout __routine$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("__routine")); - - /** - * Layout for field: - * {@snippet lang=c : - * void (*__routine)(void *) - * } - */ - public static final AddressLayout __routine$layout() { - return __routine$LAYOUT; - } - - private static final long __routine$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * void (*__routine)(void *) - * } - */ - public static final long __routine$offset() { - return __routine$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void (*__routine)(void *) - * } - */ - public static MemorySegment __routine(MemorySegment struct) { - return struct.get(__routine$LAYOUT, __routine$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void (*__routine)(void *) - * } - */ - public static void __routine(MemorySegment struct, MemorySegment fieldValue) { - struct.set(__routine$LAYOUT, __routine$OFFSET, fieldValue); - } - - private static final AddressLayout __arg$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("__arg")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *__arg - * } - */ - public static final AddressLayout __arg$layout() { - return __arg$LAYOUT; - } - - private static final long __arg$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * void *__arg - * } - */ - public static final long __arg$offset() { - return __arg$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *__arg - * } - */ - public static MemorySegment __arg(MemorySegment struct) { - return struct.get(__arg$LAYOUT, __arg$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *__arg - * } - */ - public static void __arg(MemorySegment struct, MemorySegment fieldValue) { - struct.set(__arg$LAYOUT, __arg$OFFSET, fieldValue); - } - - private static final AddressLayout __next$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("__next")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__next - * } - */ - public static final AddressLayout __next$layout() { - return __next$LAYOUT; - } - - private static final long __next$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__next - * } - */ - public static final long __next$offset() { - return __next$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__next - * } - */ - public static MemorySegment __next(MemorySegment struct) { - return struct.get(__next$LAYOUT, __next$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__next - * } - */ - public static void __next(MemorySegment struct, MemorySegment fieldValue) { - struct.set(__next$LAYOUT, __next$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutex_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutex_t.java deleted file mode 100644 index 60a2fde..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutex_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_mutex_t { - * long __sig; - * char __opaque[56]; - * } __darwin_pthread_mutex_t - * } - */ -public class __darwin_pthread_mutex_t extends _opaque_pthread_mutex_t { - - __darwin_pthread_mutex_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutexattr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutexattr_t.java deleted file mode 100644 index d0212ca..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_mutexattr_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_mutexattr_t { - * long __sig; - * char __opaque[8]; - * } __darwin_pthread_mutexattr_t - * } - */ -public class __darwin_pthread_mutexattr_t extends _opaque_pthread_mutexattr_t { - - __darwin_pthread_mutexattr_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_once_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_once_t.java deleted file mode 100644 index 7bd98a6..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_once_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_once_t { - * long __sig; - * char __opaque[8]; - * } __darwin_pthread_once_t - * } - */ -public class __darwin_pthread_once_t extends _opaque_pthread_once_t { - - __darwin_pthread_once_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlock_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlock_t.java deleted file mode 100644 index b39afdd..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlock_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_rwlock_t { - * long __sig; - * char __opaque[192]; - * } __darwin_pthread_rwlock_t - * } - */ -public class __darwin_pthread_rwlock_t extends _opaque_pthread_rwlock_t { - - __darwin_pthread_rwlock_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlockattr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlockattr_t.java deleted file mode 100644 index 1c415ff..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__darwin_pthread_rwlockattr_t.java +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * typedef struct _opaque_pthread_rwlockattr_t { - * long __sig; - * char __opaque[16]; - * } __darwin_pthread_rwlockattr_t - * } - */ -public class __darwin_pthread_rwlockattr_t extends _opaque_pthread_rwlockattr_t { - - __darwin_pthread_rwlockattr_t() { - // Should not be called directly - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__mbstate_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__mbstate_t.java deleted file mode 100644 index b83bd44..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__mbstate_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * union { - * char __mbstate8[128]; - * long long _mbstateL; - * } - * } - */ -public class __mbstate_t { - - __mbstate_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( - MemoryLayout.sequenceLayout(128, somelib_h.C_CHAR).withName("__mbstate8"), - somelib_h.C_LONG_LONG.withName("_mbstateL") - ).withName("$anon$54:9"); - - /** - * The layout of this union - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout __mbstate8$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__mbstate8")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static final SequenceLayout __mbstate8$layout() { - return __mbstate8$LAYOUT; - } - - private static final long __mbstate8$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static final long __mbstate8$offset() { - return __mbstate8$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static MemorySegment __mbstate8(MemorySegment union) { - return union.asSlice(__mbstate8$OFFSET, __mbstate8$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static void __mbstate8(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, __mbstate8$OFFSET, __mbstate8$LAYOUT.byteSize()); - } - - private static long[] __mbstate8$DIMS = { 128 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static long[] __mbstate8$dimensions() { - return __mbstate8$DIMS; - } - private static final VarHandle __mbstate8$ELEM_HANDLE = __mbstate8$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static byte __mbstate8(MemorySegment union, long index0) { - return (byte)__mbstate8$ELEM_HANDLE.get(union, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __mbstate8[128] - * } - */ - public static void __mbstate8(MemorySegment union, long index0, byte fieldValue) { - __mbstate8$ELEM_HANDLE.set(union, 0L, index0, fieldValue); - } - - private static final OfLong _mbstateL$LAYOUT = (OfLong)$LAYOUT.select(groupElement("_mbstateL")); - - /** - * Layout for field: - * {@snippet lang=c : - * long long _mbstateL - * } - */ - public static final OfLong _mbstateL$layout() { - return _mbstateL$LAYOUT; - } - - private static final long _mbstateL$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long long _mbstateL - * } - */ - public static final long _mbstateL$offset() { - return _mbstateL$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long long _mbstateL - * } - */ - public static long _mbstateL(MemorySegment union) { - return union.get(_mbstateL$LAYOUT, _mbstateL$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long long _mbstateL - * } - */ - public static void _mbstateL(MemorySegment union, long fieldValue) { - union.set(_mbstateL$LAYOUT, _mbstateL$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this union - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sFILE.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sFILE.java deleted file mode 100644 index 2da0db2..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sFILE.java +++ /dev/null @@ -1,1292 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct __sFILE { - * unsigned char *_p; - * int _r; - * int _w; - * short _flags; - * short _file; - * struct __sbuf _bf; - * int _lbfsize; - * void *_cookie; - * int (* _Nullable _close)(void *); - * int (* _Nullable _read)(void *, char *, int); - * fpos_t (* _Nullable _seek)(void *, fpos_t, int); - * int (* _Nullable _write)(void *, const char *, int); - * struct __sbuf _ub; - * struct __sFILEX *_extra; - * int _ur; - * unsigned char _ubuf[3]; - * unsigned char _nbuf[1]; - * struct __sbuf _lb; - * int _blksize; - * fpos_t _offset; - * } - * } - */ -public class __sFILE { - - __sFILE() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("_p"), - somelib_h.C_INT.withName("_r"), - somelib_h.C_INT.withName("_w"), - somelib_h.C_SHORT.withName("_flags"), - somelib_h.C_SHORT.withName("_file"), - MemoryLayout.paddingLayout(4), - __sbuf.layout().withName("_bf"), - somelib_h.C_INT.withName("_lbfsize"), - MemoryLayout.paddingLayout(4), - somelib_h.C_POINTER.withName("_cookie"), - somelib_h.C_POINTER.withName("_close"), - somelib_h.C_POINTER.withName("_read"), - somelib_h.C_POINTER.withName("_seek"), - somelib_h.C_POINTER.withName("_write"), - __sbuf.layout().withName("_ub"), - somelib_h.C_POINTER.withName("_extra"), - somelib_h.C_INT.withName("_ur"), - MemoryLayout.sequenceLayout(3, somelib_h.C_CHAR).withName("_ubuf"), - MemoryLayout.sequenceLayout(1, somelib_h.C_CHAR).withName("_nbuf"), - __sbuf.layout().withName("_lb"), - somelib_h.C_INT.withName("_blksize"), - MemoryLayout.paddingLayout(4), - somelib_h.C_LONG_LONG.withName("_offset") - ).withName("__sFILE"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout _p$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_p")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char *_p - * } - */ - public static final AddressLayout _p$layout() { - return _p$LAYOUT; - } - - private static final long _p$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char *_p - * } - */ - public static final long _p$offset() { - return _p$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char *_p - * } - */ - public static MemorySegment _p(MemorySegment struct) { - return struct.get(_p$LAYOUT, _p$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char *_p - * } - */ - public static void _p(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_p$LAYOUT, _p$OFFSET, fieldValue); - } - - private static final OfInt _r$LAYOUT = (OfInt)$LAYOUT.select(groupElement("_r")); - - /** - * Layout for field: - * {@snippet lang=c : - * int _r - * } - */ - public static final OfInt _r$layout() { - return _r$LAYOUT; - } - - private static final long _r$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int _r - * } - */ - public static final long _r$offset() { - return _r$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int _r - * } - */ - public static int _r(MemorySegment struct) { - return struct.get(_r$LAYOUT, _r$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int _r - * } - */ - public static void _r(MemorySegment struct, int fieldValue) { - struct.set(_r$LAYOUT, _r$OFFSET, fieldValue); - } - - private static final OfInt _w$LAYOUT = (OfInt)$LAYOUT.select(groupElement("_w")); - - /** - * Layout for field: - * {@snippet lang=c : - * int _w - * } - */ - public static final OfInt _w$layout() { - return _w$LAYOUT; - } - - private static final long _w$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * int _w - * } - */ - public static final long _w$offset() { - return _w$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int _w - * } - */ - public static int _w(MemorySegment struct) { - return struct.get(_w$LAYOUT, _w$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int _w - * } - */ - public static void _w(MemorySegment struct, int fieldValue) { - struct.set(_w$LAYOUT, _w$OFFSET, fieldValue); - } - - private static final OfShort _flags$LAYOUT = (OfShort)$LAYOUT.select(groupElement("_flags")); - - /** - * Layout for field: - * {@snippet lang=c : - * short _flags - * } - */ - public static final OfShort _flags$layout() { - return _flags$LAYOUT; - } - - private static final long _flags$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * short _flags - * } - */ - public static final long _flags$offset() { - return _flags$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * short _flags - * } - */ - public static short _flags(MemorySegment struct) { - return struct.get(_flags$LAYOUT, _flags$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * short _flags - * } - */ - public static void _flags(MemorySegment struct, short fieldValue) { - struct.set(_flags$LAYOUT, _flags$OFFSET, fieldValue); - } - - private static final OfShort _file$LAYOUT = (OfShort)$LAYOUT.select(groupElement("_file")); - - /** - * Layout for field: - * {@snippet lang=c : - * short _file - * } - */ - public static final OfShort _file$layout() { - return _file$LAYOUT; - } - - private static final long _file$OFFSET = 18; - - /** - * Offset for field: - * {@snippet lang=c : - * short _file - * } - */ - public static final long _file$offset() { - return _file$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * short _file - * } - */ - public static short _file(MemorySegment struct) { - return struct.get(_file$LAYOUT, _file$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * short _file - * } - */ - public static void _file(MemorySegment struct, short fieldValue) { - struct.set(_file$LAYOUT, _file$OFFSET, fieldValue); - } - - private static final GroupLayout _bf$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("_bf")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct __sbuf _bf - * } - */ - public static final GroupLayout _bf$layout() { - return _bf$LAYOUT; - } - - private static final long _bf$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * struct __sbuf _bf - * } - */ - public static final long _bf$offset() { - return _bf$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct __sbuf _bf - * } - */ - public static MemorySegment _bf(MemorySegment struct) { - return struct.asSlice(_bf$OFFSET, _bf$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct __sbuf _bf - * } - */ - public static void _bf(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, _bf$OFFSET, _bf$LAYOUT.byteSize()); - } - - private static final OfInt _lbfsize$LAYOUT = (OfInt)$LAYOUT.select(groupElement("_lbfsize")); - - /** - * Layout for field: - * {@snippet lang=c : - * int _lbfsize - * } - */ - public static final OfInt _lbfsize$layout() { - return _lbfsize$LAYOUT; - } - - private static final long _lbfsize$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * int _lbfsize - * } - */ - public static final long _lbfsize$offset() { - return _lbfsize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int _lbfsize - * } - */ - public static int _lbfsize(MemorySegment struct) { - return struct.get(_lbfsize$LAYOUT, _lbfsize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int _lbfsize - * } - */ - public static void _lbfsize(MemorySegment struct, int fieldValue) { - struct.set(_lbfsize$LAYOUT, _lbfsize$OFFSET, fieldValue); - } - - private static final AddressLayout _cookie$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_cookie")); - - /** - * Layout for field: - * {@snippet lang=c : - * void *_cookie - * } - */ - public static final AddressLayout _cookie$layout() { - return _cookie$LAYOUT; - } - - private static final long _cookie$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * void *_cookie - * } - */ - public static final long _cookie$offset() { - return _cookie$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * void *_cookie - * } - */ - public static MemorySegment _cookie(MemorySegment struct) { - return struct.get(_cookie$LAYOUT, _cookie$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * void *_cookie - * } - */ - public static void _cookie(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_cookie$LAYOUT, _cookie$OFFSET, fieldValue); - } - - /** - * {@snippet lang=c : - * int (* _Nullable _close)(void *) - * } - */ - public static class _close { - - _close() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(_close.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(_close.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout _close$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_close")); - - /** - * Layout for field: - * {@snippet lang=c : - * int (* _Nullable _close)(void *) - * } - */ - public static final AddressLayout _close$layout() { - return _close$LAYOUT; - } - - private static final long _close$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * int (* _Nullable _close)(void *) - * } - */ - public static final long _close$offset() { - return _close$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int (* _Nullable _close)(void *) - * } - */ - public static MemorySegment _close(MemorySegment struct) { - return struct.get(_close$LAYOUT, _close$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int (* _Nullable _close)(void *) - * } - */ - public static void _close(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_close$LAYOUT, _close$OFFSET, fieldValue); - } - - /** - * {@snippet lang=c : - * int (* _Nullable _read)(void *, char *, int) - * } - */ - public static class _read { - - _read() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, int _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(_read.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(_read.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout _read$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_read")); - - /** - * Layout for field: - * {@snippet lang=c : - * int (* _Nullable _read)(void *, char *, int) - * } - */ - public static final AddressLayout _read$layout() { - return _read$LAYOUT; - } - - private static final long _read$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * int (* _Nullable _read)(void *, char *, int) - * } - */ - public static final long _read$offset() { - return _read$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int (* _Nullable _read)(void *, char *, int) - * } - */ - public static MemorySegment _read(MemorySegment struct) { - return struct.get(_read$LAYOUT, _read$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int (* _Nullable _read)(void *, char *, int) - * } - */ - public static void _read(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_read$LAYOUT, _read$OFFSET, fieldValue); - } - - /** - * {@snippet lang=c : - * fpos_t (* _Nullable _seek)(void *, fpos_t, int) - * } - */ - public static class _seek { - - _seek() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - long apply(MemorySegment _x0, long _x1, int _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_LONG_LONG, - somelib_h.C_POINTER, - somelib_h.C_LONG_LONG, - somelib_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(_seek.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(_seek.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static long invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, int _x2) { - try { - return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout _seek$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_seek")); - - /** - * Layout for field: - * {@snippet lang=c : - * fpos_t (* _Nullable _seek)(void *, fpos_t, int) - * } - */ - public static final AddressLayout _seek$layout() { - return _seek$LAYOUT; - } - - private static final long _seek$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * fpos_t (* _Nullable _seek)(void *, fpos_t, int) - * } - */ - public static final long _seek$offset() { - return _seek$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * fpos_t (* _Nullable _seek)(void *, fpos_t, int) - * } - */ - public static MemorySegment _seek(MemorySegment struct) { - return struct.get(_seek$LAYOUT, _seek$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * fpos_t (* _Nullable _seek)(void *, fpos_t, int) - * } - */ - public static void _seek(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_seek$LAYOUT, _seek$OFFSET, fieldValue); - } - - /** - * {@snippet lang=c : - * int (* _Nullable _write)(void *, const char *, int) - * } - */ - public static class _write { - - _write() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, int _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(_write.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(_write.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout _write$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_write")); - - /** - * Layout for field: - * {@snippet lang=c : - * int (* _Nullable _write)(void *, const char *, int) - * } - */ - public static final AddressLayout _write$layout() { - return _write$LAYOUT; - } - - private static final long _write$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * int (* _Nullable _write)(void *, const char *, int) - * } - */ - public static final long _write$offset() { - return _write$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int (* _Nullable _write)(void *, const char *, int) - * } - */ - public static MemorySegment _write(MemorySegment struct) { - return struct.get(_write$LAYOUT, _write$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int (* _Nullable _write)(void *, const char *, int) - * } - */ - public static void _write(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_write$LAYOUT, _write$OFFSET, fieldValue); - } - - private static final GroupLayout _ub$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("_ub")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct __sbuf _ub - * } - */ - public static final GroupLayout _ub$layout() { - return _ub$LAYOUT; - } - - private static final long _ub$OFFSET = 88; - - /** - * Offset for field: - * {@snippet lang=c : - * struct __sbuf _ub - * } - */ - public static final long _ub$offset() { - return _ub$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct __sbuf _ub - * } - */ - public static MemorySegment _ub(MemorySegment struct) { - return struct.asSlice(_ub$OFFSET, _ub$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct __sbuf _ub - * } - */ - public static void _ub(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, _ub$OFFSET, _ub$LAYOUT.byteSize()); - } - - private static final AddressLayout _extra$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_extra")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct __sFILEX *_extra - * } - */ - public static final AddressLayout _extra$layout() { - return _extra$LAYOUT; - } - - private static final long _extra$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * struct __sFILEX *_extra - * } - */ - public static final long _extra$offset() { - return _extra$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct __sFILEX *_extra - * } - */ - public static MemorySegment _extra(MemorySegment struct) { - return struct.get(_extra$LAYOUT, _extra$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct __sFILEX *_extra - * } - */ - public static void _extra(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_extra$LAYOUT, _extra$OFFSET, fieldValue); - } - - private static final OfInt _ur$LAYOUT = (OfInt)$LAYOUT.select(groupElement("_ur")); - - /** - * Layout for field: - * {@snippet lang=c : - * int _ur - * } - */ - public static final OfInt _ur$layout() { - return _ur$LAYOUT; - } - - private static final long _ur$OFFSET = 112; - - /** - * Offset for field: - * {@snippet lang=c : - * int _ur - * } - */ - public static final long _ur$offset() { - return _ur$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int _ur - * } - */ - public static int _ur(MemorySegment struct) { - return struct.get(_ur$LAYOUT, _ur$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int _ur - * } - */ - public static void _ur(MemorySegment struct, int fieldValue) { - struct.set(_ur$LAYOUT, _ur$OFFSET, fieldValue); - } - - private static final SequenceLayout _ubuf$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("_ubuf")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static final SequenceLayout _ubuf$layout() { - return _ubuf$LAYOUT; - } - - private static final long _ubuf$OFFSET = 116; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static final long _ubuf$offset() { - return _ubuf$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static MemorySegment _ubuf(MemorySegment struct) { - return struct.asSlice(_ubuf$OFFSET, _ubuf$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static void _ubuf(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, _ubuf$OFFSET, _ubuf$LAYOUT.byteSize()); - } - - private static long[] _ubuf$DIMS = { 3 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static long[] _ubuf$dimensions() { - return _ubuf$DIMS; - } - private static final VarHandle _ubuf$ELEM_HANDLE = _ubuf$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static byte _ubuf(MemorySegment struct, long index0) { - return (byte)_ubuf$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * unsigned char _ubuf[3] - * } - */ - public static void _ubuf(MemorySegment struct, long index0, byte fieldValue) { - _ubuf$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final SequenceLayout _nbuf$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("_nbuf")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static final SequenceLayout _nbuf$layout() { - return _nbuf$LAYOUT; - } - - private static final long _nbuf$OFFSET = 119; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static final long _nbuf$offset() { - return _nbuf$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static MemorySegment _nbuf(MemorySegment struct) { - return struct.asSlice(_nbuf$OFFSET, _nbuf$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static void _nbuf(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, _nbuf$OFFSET, _nbuf$LAYOUT.byteSize()); - } - - private static long[] _nbuf$DIMS = { 1 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static long[] _nbuf$dimensions() { - return _nbuf$DIMS; - } - private static final VarHandle _nbuf$ELEM_HANDLE = _nbuf$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static byte _nbuf(MemorySegment struct, long index0) { - return (byte)_nbuf$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * unsigned char _nbuf[1] - * } - */ - public static void _nbuf(MemorySegment struct, long index0, byte fieldValue) { - _nbuf$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final GroupLayout _lb$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("_lb")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct __sbuf _lb - * } - */ - public static final GroupLayout _lb$layout() { - return _lb$LAYOUT; - } - - private static final long _lb$OFFSET = 120; - - /** - * Offset for field: - * {@snippet lang=c : - * struct __sbuf _lb - * } - */ - public static final long _lb$offset() { - return _lb$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct __sbuf _lb - * } - */ - public static MemorySegment _lb(MemorySegment struct) { - return struct.asSlice(_lb$OFFSET, _lb$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct __sbuf _lb - * } - */ - public static void _lb(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, _lb$OFFSET, _lb$LAYOUT.byteSize()); - } - - private static final OfInt _blksize$LAYOUT = (OfInt)$LAYOUT.select(groupElement("_blksize")); - - /** - * Layout for field: - * {@snippet lang=c : - * int _blksize - * } - */ - public static final OfInt _blksize$layout() { - return _blksize$LAYOUT; - } - - private static final long _blksize$OFFSET = 136; - - /** - * Offset for field: - * {@snippet lang=c : - * int _blksize - * } - */ - public static final long _blksize$offset() { - return _blksize$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int _blksize - * } - */ - public static int _blksize(MemorySegment struct) { - return struct.get(_blksize$LAYOUT, _blksize$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int _blksize - * } - */ - public static void _blksize(MemorySegment struct, int fieldValue) { - struct.set(_blksize$LAYOUT, _blksize$OFFSET, fieldValue); - } - - private static final OfLong _offset$LAYOUT = (OfLong)$LAYOUT.select(groupElement("_offset")); - - /** - * Layout for field: - * {@snippet lang=c : - * fpos_t _offset - * } - */ - public static final OfLong _offset$layout() { - return _offset$LAYOUT; - } - - private static final long _offset$OFFSET = 144; - - /** - * Offset for field: - * {@snippet lang=c : - * fpos_t _offset - * } - */ - public static final long _offset$offset() { - return _offset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * fpos_t _offset - * } - */ - public static long _offset(MemorySegment struct) { - return struct.get(_offset$LAYOUT, _offset$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * fpos_t _offset - * } - */ - public static void _offset(MemorySegment struct, long fieldValue) { - struct.set(_offset$LAYOUT, _offset$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sbuf.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sbuf.java deleted file mode 100644 index c4fd8a3..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/__sbuf.java +++ /dev/null @@ -1,174 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct __sbuf { - * unsigned char *_base; - * int _size; - * } - * } - */ -public class __sbuf { - - __sbuf() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_POINTER.withName("_base"), - somelib_h.C_INT.withName("_size"), - MemoryLayout.paddingLayout(4) - ).withName("__sbuf"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout _base$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("_base")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char *_base - * } - */ - public static final AddressLayout _base$layout() { - return _base$LAYOUT; - } - - private static final long _base$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char *_base - * } - */ - public static final long _base$offset() { - return _base$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char *_base - * } - */ - public static MemorySegment _base(MemorySegment struct) { - return struct.get(_base$LAYOUT, _base$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char *_base - * } - */ - public static void _base(MemorySegment struct, MemorySegment fieldValue) { - struct.set(_base$LAYOUT, _base$OFFSET, fieldValue); - } - - private static final OfInt _size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("_size")); - - /** - * Layout for field: - * {@snippet lang=c : - * int _size - * } - */ - public static final OfInt _size$layout() { - return _size$LAYOUT; - } - - private static final long _size$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int _size - * } - */ - public static final long _size$offset() { - return _size$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int _size - * } - */ - public static int _size(MemorySegment struct) { - return struct.get(_size$LAYOUT, _size$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int _size - * } - */ - public static void _size(MemorySegment struct, int fieldValue) { - struct.set(_size$LAYOUT, _size$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_attr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_attr_t.java deleted file mode 100644 index 1da474a..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_attr_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_attr_t { - * long __sig; - * char __opaque[56]; - * } - * } - */ -public class _opaque_pthread_attr_t { - - _opaque_pthread_attr_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(56, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_attr_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 56 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_cond_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_cond_t.java deleted file mode 100644 index d558a7c..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_cond_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_cond_t { - * long __sig; - * char __opaque[40]; - * } - * } - */ -public class _opaque_pthread_cond_t { - - _opaque_pthread_cond_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(40, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_cond_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 40 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[40] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_condattr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_condattr_t.java deleted file mode 100644 index 02538b0..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_condattr_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_condattr_t { - * long __sig; - * char __opaque[8]; - * } - * } - */ -public class _opaque_pthread_condattr_t { - - _opaque_pthread_condattr_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(8, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_condattr_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 8 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutex_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutex_t.java deleted file mode 100644 index 6d772cc..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutex_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_mutex_t { - * long __sig; - * char __opaque[56]; - * } - * } - */ -public class _opaque_pthread_mutex_t { - - _opaque_pthread_mutex_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(56, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_mutex_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 56 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[56] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutexattr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutexattr_t.java deleted file mode 100644 index 5910bf3..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_mutexattr_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_mutexattr_t { - * long __sig; - * char __opaque[8]; - * } - * } - */ -public class _opaque_pthread_mutexattr_t { - - _opaque_pthread_mutexattr_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(8, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_mutexattr_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 8 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_once_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_once_t.java deleted file mode 100644 index b64f81d..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_once_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_once_t { - * long __sig; - * char __opaque[8]; - * } - * } - */ -public class _opaque_pthread_once_t { - - _opaque_pthread_once_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(8, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_once_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 8 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[8] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlock_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlock_t.java deleted file mode 100644 index 8341224..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlock_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_rwlock_t { - * long __sig; - * char __opaque[192]; - * } - * } - */ -public class _opaque_pthread_rwlock_t { - - _opaque_pthread_rwlock_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(192, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_rwlock_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 192 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[192] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlockattr_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlockattr_t.java deleted file mode 100644 index ef84d97..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_rwlockattr_t.java +++ /dev/null @@ -1,206 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_rwlockattr_t { - * long __sig; - * char __opaque[16]; - * } - * } - */ -public class _opaque_pthread_rwlockattr_t { - - _opaque_pthread_rwlockattr_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - MemoryLayout.sequenceLayout(16, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_rwlockattr_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 16 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[16] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_t.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_t.java deleted file mode 100644 index 1fe6ced..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/_opaque_pthread_t.java +++ /dev/null @@ -1,252 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct _opaque_pthread_t { - * long __sig; - * struct __darwin_pthread_handler_rec *__cleanup_stack; - * char __opaque[8176]; - * } - * } - */ -public class _opaque_pthread_t { - - _opaque_pthread_t() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - somelib_h.C_LONG.withName("__sig"), - somelib_h.C_POINTER.withName("__cleanup_stack"), - MemoryLayout.sequenceLayout(8176, somelib_h.C_CHAR).withName("__opaque") - ).withName("_opaque_pthread_t"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfLong __sig$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__sig")); - - /** - * Layout for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final OfLong __sig$layout() { - return __sig$LAYOUT; - } - - private static final long __sig$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static final long __sig$offset() { - return __sig$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static long __sig(MemorySegment struct) { - return struct.get(__sig$LAYOUT, __sig$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * long __sig - * } - */ - public static void __sig(MemorySegment struct, long fieldValue) { - struct.set(__sig$LAYOUT, __sig$OFFSET, fieldValue); - } - - private static final AddressLayout __cleanup_stack$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("__cleanup_stack")); - - /** - * Layout for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__cleanup_stack - * } - */ - public static final AddressLayout __cleanup_stack$layout() { - return __cleanup_stack$LAYOUT; - } - - private static final long __cleanup_stack$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__cleanup_stack - * } - */ - public static final long __cleanup_stack$offset() { - return __cleanup_stack$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__cleanup_stack - * } - */ - public static MemorySegment __cleanup_stack(MemorySegment struct) { - return struct.get(__cleanup_stack$LAYOUT, __cleanup_stack$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * struct __darwin_pthread_handler_rec *__cleanup_stack - * } - */ - public static void __cleanup_stack(MemorySegment struct, MemorySegment fieldValue) { - struct.set(__cleanup_stack$LAYOUT, __cleanup_stack$OFFSET, fieldValue); - } - - private static final SequenceLayout __opaque$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__opaque")); - - /** - * Layout for field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static final SequenceLayout __opaque$layout() { - return __opaque$LAYOUT; - } - - private static final long __opaque$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static final long __opaque$offset() { - return __opaque$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static MemorySegment __opaque(MemorySegment struct) { - return struct.asSlice(__opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static void __opaque(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, __opaque$OFFSET, __opaque$LAYOUT.byteSize()); - } - - private static long[] __opaque$DIMS = { 8176 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static long[] __opaque$dimensions() { - return __opaque$DIMS; - } - private static final VarHandle __opaque$ELEM_HANDLE = __opaque$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static byte __opaque(MemorySegment struct, long index0) { - return (byte)__opaque$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char __opaque[8176] - * } - */ - public static void __opaque(MemorySegment struct, long index0, byte fieldValue) { - __opaque$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { - return reinterpret(addr, 1, arena, cleanup); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code elementCount * layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x0.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x0.java deleted file mode 100644 index 1afd882..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x0.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * int (* _Nullable)(void *, char *, int) - * } - */ -public class funopen$x0 { - - funopen$x0() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, int _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(funopen$x0.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(funopen$x0.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x1.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x1.java deleted file mode 100644 index 3dca887..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x1.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * int (* _Nullable)(void *, const char *, int) - * } - */ -public class funopen$x1 { - - funopen$x1() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, int _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(funopen$x1.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(funopen$x1.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x2.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x2.java deleted file mode 100644 index 0fe263b..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x2.java +++ /dev/null @@ -1,70 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * fpos_t (* _Nullable)(void *, fpos_t, int) - * } - */ -public class funopen$x2 { - - funopen$x2() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - long apply(MemorySegment _x0, long _x1, int _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_LONG_LONG, - somelib_h.C_POINTER, - somelib_h.C_LONG_LONG, - somelib_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(funopen$x2.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(funopen$x2.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static long invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, int _x2) { - try { - return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x3.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x3.java deleted file mode 100644 index dd516ce..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/funopen$x3.java +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * int (* _Nullable)(void *) - * } - */ -public class funopen$x3 { - - funopen$x3() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = somelib_h.upcallHandle(funopen$x3.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(funopen$x3.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/somelib_h.java b/feature/tmp/src/main/dev/diplomattest/somelib/ntv/somelib_h.java deleted file mode 100644 index 0709c01..0000000 --- a/feature/tmp/src/main/dev/diplomattest/somelib/ntv/somelib_h.java +++ /dev/null @@ -1,15429 +0,0 @@ -// Generated by jextract - -package dev.diplomattest.somelib.ntv; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -public class somelib_h { - - somelib_h() { - // Should not be called directly - } - - static final Arena LIBRARY_ARENA = Arena.ofAuto(); - static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); - - static void traceDowncall(String name, Object... args) { - String traceArgs = Arrays.stream(args) - .map(Object::toString) - .collect(Collectors.joining(", ")); - System.out.printf("%s(%s)\n", name, traceArgs); - } - - static MemorySegment findOrThrow(String symbol) { - return SYMBOL_LOOKUP.find(symbol) - .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); - } catch (ReflectiveOperationException ex) { - throw new AssertionError(ex); - } - } - - static MemoryLayout align(MemoryLayout layout, long align) { - return switch (layout) { - case PaddingLayout p -> p; - case ValueLayout v -> v.withByteAlignment(align); - case GroupLayout g -> { - MemoryLayout[] alignedMembers = g.memberLayouts().stream() - .map(m -> align(m, align)).toArray(MemoryLayout[]::new); - yield g instanceof StructLayout ? - MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); - } - case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); - }; - } - - static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("somelib"), LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; - public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; - public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; - public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; - public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; - public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; - public static final AddressLayout C_POINTER = ValueLayout.ADDRESS - .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); - public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; - private static final int __has_safe_buffers = (int)0L; - /** - * {@snippet lang=c : - * #define __has_safe_buffers 0 - * } - */ - public static int __has_safe_buffers() { - return __has_safe_buffers; - } - private static final int __DARWIN_ONLY_64_BIT_INO_T = (int)1L; - /** - * {@snippet lang=c : - * #define __DARWIN_ONLY_64_BIT_INO_T 1 - * } - */ - public static int __DARWIN_ONLY_64_BIT_INO_T() { - return __DARWIN_ONLY_64_BIT_INO_T; - } - private static final int __DARWIN_ONLY_UNIX_CONFORMANCE = (int)1L; - /** - * {@snippet lang=c : - * #define __DARWIN_ONLY_UNIX_CONFORMANCE 1 - * } - */ - public static int __DARWIN_ONLY_UNIX_CONFORMANCE() { - return __DARWIN_ONLY_UNIX_CONFORMANCE; - } - private static final int __DARWIN_ONLY_VERS_1050 = (int)1L; - /** - * {@snippet lang=c : - * #define __DARWIN_ONLY_VERS_1050 1 - * } - */ - public static int __DARWIN_ONLY_VERS_1050() { - return __DARWIN_ONLY_VERS_1050; - } - private static final int __DARWIN_UNIX03 = (int)1L; - /** - * {@snippet lang=c : - * #define __DARWIN_UNIX03 1 - * } - */ - public static int __DARWIN_UNIX03() { - return __DARWIN_UNIX03; - } - private static final int __DARWIN_64_BIT_INO_T = (int)1L; - /** - * {@snippet lang=c : - * #define __DARWIN_64_BIT_INO_T 1 - * } - */ - public static int __DARWIN_64_BIT_INO_T() { - return __DARWIN_64_BIT_INO_T; - } - private static final int __DARWIN_VERS_1050 = (int)1L; - /** - * {@snippet lang=c : - * #define __DARWIN_VERS_1050 1 - * } - */ - public static int __DARWIN_VERS_1050() { - return __DARWIN_VERS_1050; - } - private static final int __DARWIN_NON_CANCELABLE = (int)0L; - /** - * {@snippet lang=c : - * #define __DARWIN_NON_CANCELABLE 0 - * } - */ - public static int __DARWIN_NON_CANCELABLE() { - return __DARWIN_NON_CANCELABLE; - } - private static final int __STDC_WANT_LIB_EXT1__ = (int)1L; - /** - * {@snippet lang=c : - * #define __STDC_WANT_LIB_EXT1__ 1 - * } - */ - public static int __STDC_WANT_LIB_EXT1__() { - return __STDC_WANT_LIB_EXT1__; - } - private static final int __DARWIN_NO_LONG_LONG = (int)0L; - /** - * {@snippet lang=c : - * #define __DARWIN_NO_LONG_LONG 0 - * } - */ - public static int __DARWIN_NO_LONG_LONG() { - return __DARWIN_NO_LONG_LONG; - } - private static final int _DARWIN_FEATURE_64_BIT_INODE = (int)1L; - /** - * {@snippet lang=c : - * #define _DARWIN_FEATURE_64_BIT_INODE 1 - * } - */ - public static int _DARWIN_FEATURE_64_BIT_INODE() { - return _DARWIN_FEATURE_64_BIT_INODE; - } - private static final int _DARWIN_FEATURE_ONLY_64_BIT_INODE = (int)1L; - /** - * {@snippet lang=c : - * #define _DARWIN_FEATURE_ONLY_64_BIT_INODE 1 - * } - */ - public static int _DARWIN_FEATURE_ONLY_64_BIT_INODE() { - return _DARWIN_FEATURE_ONLY_64_BIT_INODE; - } - private static final int _DARWIN_FEATURE_ONLY_VERS_1050 = (int)1L; - /** - * {@snippet lang=c : - * #define _DARWIN_FEATURE_ONLY_VERS_1050 1 - * } - */ - public static int _DARWIN_FEATURE_ONLY_VERS_1050() { - return _DARWIN_FEATURE_ONLY_VERS_1050; - } - private static final int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = (int)1L; - /** - * {@snippet lang=c : - * #define _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE 1 - * } - */ - public static int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE() { - return _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE; - } - private static final int _DARWIN_FEATURE_UNIX_CONFORMANCE = (int)3L; - /** - * {@snippet lang=c : - * #define _DARWIN_FEATURE_UNIX_CONFORMANCE 3 - * } - */ - public static int _DARWIN_FEATURE_UNIX_CONFORMANCE() { - return _DARWIN_FEATURE_UNIX_CONFORMANCE; - } - private static final int __has_ptrcheck = (int)0L; - /** - * {@snippet lang=c : - * #define __has_ptrcheck 0 - * } - */ - public static int __has_ptrcheck() { - return __has_ptrcheck; - } - private static final int true_ = (int)1L; - /** - * {@snippet lang=c : - * #define true 1 - * } - */ - public static int true_() { - return true_; - } - private static final int false_ = (int)0L; - /** - * {@snippet lang=c : - * #define false 0 - * } - */ - public static int false_() { - return false_; - } - private static final int __bool_true_false_are_defined = (int)1L; - /** - * {@snippet lang=c : - * #define __bool_true_false_are_defined 1 - * } - */ - public static int __bool_true_false_are_defined() { - return __bool_true_false_are_defined; - } - private static final int __WORDSIZE = (int)64L; - /** - * {@snippet lang=c : - * #define __WORDSIZE 64 - * } - */ - public static int __WORDSIZE() { - return __WORDSIZE; - } - private static final int __PTHREAD_SIZE__ = (int)8176L; - /** - * {@snippet lang=c : - * #define __PTHREAD_SIZE__ 8176 - * } - */ - public static int __PTHREAD_SIZE__() { - return __PTHREAD_SIZE__; - } - private static final int __PTHREAD_ATTR_SIZE__ = (int)56L; - /** - * {@snippet lang=c : - * #define __PTHREAD_ATTR_SIZE__ 56 - * } - */ - public static int __PTHREAD_ATTR_SIZE__() { - return __PTHREAD_ATTR_SIZE__; - } - private static final int __PTHREAD_MUTEXATTR_SIZE__ = (int)8L; - /** - * {@snippet lang=c : - * #define __PTHREAD_MUTEXATTR_SIZE__ 8 - * } - */ - public static int __PTHREAD_MUTEXATTR_SIZE__() { - return __PTHREAD_MUTEXATTR_SIZE__; - } - private static final int __PTHREAD_MUTEX_SIZE__ = (int)56L; - /** - * {@snippet lang=c : - * #define __PTHREAD_MUTEX_SIZE__ 56 - * } - */ - public static int __PTHREAD_MUTEX_SIZE__() { - return __PTHREAD_MUTEX_SIZE__; - } - private static final int __PTHREAD_CONDATTR_SIZE__ = (int)8L; - /** - * {@snippet lang=c : - * #define __PTHREAD_CONDATTR_SIZE__ 8 - * } - */ - public static int __PTHREAD_CONDATTR_SIZE__() { - return __PTHREAD_CONDATTR_SIZE__; - } - private static final int __PTHREAD_COND_SIZE__ = (int)40L; - /** - * {@snippet lang=c : - * #define __PTHREAD_COND_SIZE__ 40 - * } - */ - public static int __PTHREAD_COND_SIZE__() { - return __PTHREAD_COND_SIZE__; - } - private static final int __PTHREAD_ONCE_SIZE__ = (int)8L; - /** - * {@snippet lang=c : - * #define __PTHREAD_ONCE_SIZE__ 8 - * } - */ - public static int __PTHREAD_ONCE_SIZE__() { - return __PTHREAD_ONCE_SIZE__; - } - private static final int __PTHREAD_RWLOCK_SIZE__ = (int)192L; - /** - * {@snippet lang=c : - * #define __PTHREAD_RWLOCK_SIZE__ 192 - * } - */ - public static int __PTHREAD_RWLOCK_SIZE__() { - return __PTHREAD_RWLOCK_SIZE__; - } - private static final int __PTHREAD_RWLOCKATTR_SIZE__ = (int)16L; - /** - * {@snippet lang=c : - * #define __PTHREAD_RWLOCKATTR_SIZE__ 16 - * } - */ - public static int __PTHREAD_RWLOCKATTR_SIZE__() { - return __PTHREAD_RWLOCKATTR_SIZE__; - } - private static final int INT8_MAX = (int)127L; - /** - * {@snippet lang=c : - * #define INT8_MAX 127 - * } - */ - public static int INT8_MAX() { - return INT8_MAX; - } - private static final int INT16_MAX = (int)32767L; - /** - * {@snippet lang=c : - * #define INT16_MAX 32767 - * } - */ - public static int INT16_MAX() { - return INT16_MAX; - } - private static final int INT32_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT32_MAX 2147483647 - * } - */ - public static int INT32_MAX() { - return INT32_MAX; - } - private static final int UINT8_MAX = (int)255L; - /** - * {@snippet lang=c : - * #define UINT8_MAX 255 - * } - */ - public static int UINT8_MAX() { - return UINT8_MAX; - } - private static final int UINT16_MAX = (int)65535L; - /** - * {@snippet lang=c : - * #define UINT16_MAX 65535 - * } - */ - public static int UINT16_MAX() { - return UINT16_MAX; - } - private static final int __API_TO_BE_DEPRECATED = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED() { - return __API_TO_BE_DEPRECATED; - } - private static final int __API_TO_BE_DEPRECATED_MACOS = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_MACOS 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_MACOS() { - return __API_TO_BE_DEPRECATED_MACOS; - } - private static final int __API_TO_BE_DEPRECATED_IOS = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_IOS 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_IOS() { - return __API_TO_BE_DEPRECATED_IOS; - } - private static final int __API_TO_BE_DEPRECATED_MACCATALYST = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_MACCATALYST 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_MACCATALYST() { - return __API_TO_BE_DEPRECATED_MACCATALYST; - } - private static final int __API_TO_BE_DEPRECATED_WATCHOS = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_WATCHOS 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_WATCHOS() { - return __API_TO_BE_DEPRECATED_WATCHOS; - } - private static final int __API_TO_BE_DEPRECATED_TVOS = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_TVOS 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_TVOS() { - return __API_TO_BE_DEPRECATED_TVOS; - } - private static final int __API_TO_BE_DEPRECATED_DRIVERKIT = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_DRIVERKIT 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_DRIVERKIT() { - return __API_TO_BE_DEPRECATED_DRIVERKIT; - } - private static final int __API_TO_BE_DEPRECATED_VISIONOS = (int)100000L; - /** - * {@snippet lang=c : - * #define __API_TO_BE_DEPRECATED_VISIONOS 100000 - * } - */ - public static int __API_TO_BE_DEPRECATED_VISIONOS() { - return __API_TO_BE_DEPRECATED_VISIONOS; - } - private static final int __MAC_10_0 = (int)1000L; - /** - * {@snippet lang=c : - * #define __MAC_10_0 1000 - * } - */ - public static int __MAC_10_0() { - return __MAC_10_0; - } - private static final int __MAC_10_1 = (int)1010L; - /** - * {@snippet lang=c : - * #define __MAC_10_1 1010 - * } - */ - public static int __MAC_10_1() { - return __MAC_10_1; - } - private static final int __MAC_10_2 = (int)1020L; - /** - * {@snippet lang=c : - * #define __MAC_10_2 1020 - * } - */ - public static int __MAC_10_2() { - return __MAC_10_2; - } - private static final int __MAC_10_3 = (int)1030L; - /** - * {@snippet lang=c : - * #define __MAC_10_3 1030 - * } - */ - public static int __MAC_10_3() { - return __MAC_10_3; - } - private static final int __MAC_10_4 = (int)1040L; - /** - * {@snippet lang=c : - * #define __MAC_10_4 1040 - * } - */ - public static int __MAC_10_4() { - return __MAC_10_4; - } - private static final int __MAC_10_5 = (int)1050L; - /** - * {@snippet lang=c : - * #define __MAC_10_5 1050 - * } - */ - public static int __MAC_10_5() { - return __MAC_10_5; - } - private static final int __MAC_10_6 = (int)1060L; - /** - * {@snippet lang=c : - * #define __MAC_10_6 1060 - * } - */ - public static int __MAC_10_6() { - return __MAC_10_6; - } - private static final int __MAC_10_7 = (int)1070L; - /** - * {@snippet lang=c : - * #define __MAC_10_7 1070 - * } - */ - public static int __MAC_10_7() { - return __MAC_10_7; - } - private static final int __MAC_10_8 = (int)1080L; - /** - * {@snippet lang=c : - * #define __MAC_10_8 1080 - * } - */ - public static int __MAC_10_8() { - return __MAC_10_8; - } - private static final int __MAC_10_9 = (int)1090L; - /** - * {@snippet lang=c : - * #define __MAC_10_9 1090 - * } - */ - public static int __MAC_10_9() { - return __MAC_10_9; - } - private static final int __MAC_10_10 = (int)101000L; - /** - * {@snippet lang=c : - * #define __MAC_10_10 101000 - * } - */ - public static int __MAC_10_10() { - return __MAC_10_10; - } - private static final int __MAC_10_10_2 = (int)101002L; - /** - * {@snippet lang=c : - * #define __MAC_10_10_2 101002 - * } - */ - public static int __MAC_10_10_2() { - return __MAC_10_10_2; - } - private static final int __MAC_10_10_3 = (int)101003L; - /** - * {@snippet lang=c : - * #define __MAC_10_10_3 101003 - * } - */ - public static int __MAC_10_10_3() { - return __MAC_10_10_3; - } - private static final int __MAC_10_11 = (int)101100L; - /** - * {@snippet lang=c : - * #define __MAC_10_11 101100 - * } - */ - public static int __MAC_10_11() { - return __MAC_10_11; - } - private static final int __MAC_10_11_2 = (int)101102L; - /** - * {@snippet lang=c : - * #define __MAC_10_11_2 101102 - * } - */ - public static int __MAC_10_11_2() { - return __MAC_10_11_2; - } - private static final int __MAC_10_11_3 = (int)101103L; - /** - * {@snippet lang=c : - * #define __MAC_10_11_3 101103 - * } - */ - public static int __MAC_10_11_3() { - return __MAC_10_11_3; - } - private static final int __MAC_10_11_4 = (int)101104L; - /** - * {@snippet lang=c : - * #define __MAC_10_11_4 101104 - * } - */ - public static int __MAC_10_11_4() { - return __MAC_10_11_4; - } - private static final int __MAC_10_12 = (int)101200L; - /** - * {@snippet lang=c : - * #define __MAC_10_12 101200 - * } - */ - public static int __MAC_10_12() { - return __MAC_10_12; - } - private static final int __MAC_10_12_1 = (int)101201L; - /** - * {@snippet lang=c : - * #define __MAC_10_12_1 101201 - * } - */ - public static int __MAC_10_12_1() { - return __MAC_10_12_1; - } - private static final int __MAC_10_12_2 = (int)101202L; - /** - * {@snippet lang=c : - * #define __MAC_10_12_2 101202 - * } - */ - public static int __MAC_10_12_2() { - return __MAC_10_12_2; - } - private static final int __MAC_10_12_4 = (int)101204L; - /** - * {@snippet lang=c : - * #define __MAC_10_12_4 101204 - * } - */ - public static int __MAC_10_12_4() { - return __MAC_10_12_4; - } - private static final int __MAC_10_13 = (int)101300L; - /** - * {@snippet lang=c : - * #define __MAC_10_13 101300 - * } - */ - public static int __MAC_10_13() { - return __MAC_10_13; - } - private static final int __MAC_10_13_1 = (int)101301L; - /** - * {@snippet lang=c : - * #define __MAC_10_13_1 101301 - * } - */ - public static int __MAC_10_13_1() { - return __MAC_10_13_1; - } - private static final int __MAC_10_13_2 = (int)101302L; - /** - * {@snippet lang=c : - * #define __MAC_10_13_2 101302 - * } - */ - public static int __MAC_10_13_2() { - return __MAC_10_13_2; - } - private static final int __MAC_10_13_4 = (int)101304L; - /** - * {@snippet lang=c : - * #define __MAC_10_13_4 101304 - * } - */ - public static int __MAC_10_13_4() { - return __MAC_10_13_4; - } - private static final int __MAC_10_14 = (int)101400L; - /** - * {@snippet lang=c : - * #define __MAC_10_14 101400 - * } - */ - public static int __MAC_10_14() { - return __MAC_10_14; - } - private static final int __MAC_10_14_1 = (int)101401L; - /** - * {@snippet lang=c : - * #define __MAC_10_14_1 101401 - * } - */ - public static int __MAC_10_14_1() { - return __MAC_10_14_1; - } - private static final int __MAC_10_14_4 = (int)101404L; - /** - * {@snippet lang=c : - * #define __MAC_10_14_4 101404 - * } - */ - public static int __MAC_10_14_4() { - return __MAC_10_14_4; - } - private static final int __MAC_10_14_5 = (int)101405L; - /** - * {@snippet lang=c : - * #define __MAC_10_14_5 101405 - * } - */ - public static int __MAC_10_14_5() { - return __MAC_10_14_5; - } - private static final int __MAC_10_14_6 = (int)101406L; - /** - * {@snippet lang=c : - * #define __MAC_10_14_6 101406 - * } - */ - public static int __MAC_10_14_6() { - return __MAC_10_14_6; - } - private static final int __MAC_10_15 = (int)101500L; - /** - * {@snippet lang=c : - * #define __MAC_10_15 101500 - * } - */ - public static int __MAC_10_15() { - return __MAC_10_15; - } - private static final int __MAC_10_15_1 = (int)101501L; - /** - * {@snippet lang=c : - * #define __MAC_10_15_1 101501 - * } - */ - public static int __MAC_10_15_1() { - return __MAC_10_15_1; - } - private static final int __MAC_10_15_4 = (int)101504L; - /** - * {@snippet lang=c : - * #define __MAC_10_15_4 101504 - * } - */ - public static int __MAC_10_15_4() { - return __MAC_10_15_4; - } - private static final int __MAC_10_16 = (int)101600L; - /** - * {@snippet lang=c : - * #define __MAC_10_16 101600 - * } - */ - public static int __MAC_10_16() { - return __MAC_10_16; - } - private static final int __MAC_11_0 = (int)110000L; - /** - * {@snippet lang=c : - * #define __MAC_11_0 110000 - * } - */ - public static int __MAC_11_0() { - return __MAC_11_0; - } - private static final int __MAC_11_1 = (int)110100L; - /** - * {@snippet lang=c : - * #define __MAC_11_1 110100 - * } - */ - public static int __MAC_11_1() { - return __MAC_11_1; - } - private static final int __MAC_11_3 = (int)110300L; - /** - * {@snippet lang=c : - * #define __MAC_11_3 110300 - * } - */ - public static int __MAC_11_3() { - return __MAC_11_3; - } - private static final int __MAC_11_4 = (int)110400L; - /** - * {@snippet lang=c : - * #define __MAC_11_4 110400 - * } - */ - public static int __MAC_11_4() { - return __MAC_11_4; - } - private static final int __MAC_11_5 = (int)110500L; - /** - * {@snippet lang=c : - * #define __MAC_11_5 110500 - * } - */ - public static int __MAC_11_5() { - return __MAC_11_5; - } - private static final int __MAC_11_6 = (int)110600L; - /** - * {@snippet lang=c : - * #define __MAC_11_6 110600 - * } - */ - public static int __MAC_11_6() { - return __MAC_11_6; - } - private static final int __MAC_12_0 = (int)120000L; - /** - * {@snippet lang=c : - * #define __MAC_12_0 120000 - * } - */ - public static int __MAC_12_0() { - return __MAC_12_0; - } - private static final int __MAC_12_1 = (int)120100L; - /** - * {@snippet lang=c : - * #define __MAC_12_1 120100 - * } - */ - public static int __MAC_12_1() { - return __MAC_12_1; - } - private static final int __MAC_12_2 = (int)120200L; - /** - * {@snippet lang=c : - * #define __MAC_12_2 120200 - * } - */ - public static int __MAC_12_2() { - return __MAC_12_2; - } - private static final int __MAC_12_3 = (int)120300L; - /** - * {@snippet lang=c : - * #define __MAC_12_3 120300 - * } - */ - public static int __MAC_12_3() { - return __MAC_12_3; - } - private static final int __MAC_12_4 = (int)120400L; - /** - * {@snippet lang=c : - * #define __MAC_12_4 120400 - * } - */ - public static int __MAC_12_4() { - return __MAC_12_4; - } - private static final int __MAC_12_5 = (int)120500L; - /** - * {@snippet lang=c : - * #define __MAC_12_5 120500 - * } - */ - public static int __MAC_12_5() { - return __MAC_12_5; - } - private static final int __MAC_12_6 = (int)120600L; - /** - * {@snippet lang=c : - * #define __MAC_12_6 120600 - * } - */ - public static int __MAC_12_6() { - return __MAC_12_6; - } - private static final int __MAC_12_7 = (int)120700L; - /** - * {@snippet lang=c : - * #define __MAC_12_7 120700 - * } - */ - public static int __MAC_12_7() { - return __MAC_12_7; - } - private static final int __MAC_13_0 = (int)130000L; - /** - * {@snippet lang=c : - * #define __MAC_13_0 130000 - * } - */ - public static int __MAC_13_0() { - return __MAC_13_0; - } - private static final int __MAC_13_1 = (int)130100L; - /** - * {@snippet lang=c : - * #define __MAC_13_1 130100 - * } - */ - public static int __MAC_13_1() { - return __MAC_13_1; - } - private static final int __MAC_13_2 = (int)130200L; - /** - * {@snippet lang=c : - * #define __MAC_13_2 130200 - * } - */ - public static int __MAC_13_2() { - return __MAC_13_2; - } - private static final int __MAC_13_3 = (int)130300L; - /** - * {@snippet lang=c : - * #define __MAC_13_3 130300 - * } - */ - public static int __MAC_13_3() { - return __MAC_13_3; - } - private static final int __MAC_13_4 = (int)130400L; - /** - * {@snippet lang=c : - * #define __MAC_13_4 130400 - * } - */ - public static int __MAC_13_4() { - return __MAC_13_4; - } - private static final int __MAC_13_5 = (int)130500L; - /** - * {@snippet lang=c : - * #define __MAC_13_5 130500 - * } - */ - public static int __MAC_13_5() { - return __MAC_13_5; - } - private static final int __MAC_13_6 = (int)130600L; - /** - * {@snippet lang=c : - * #define __MAC_13_6 130600 - * } - */ - public static int __MAC_13_6() { - return __MAC_13_6; - } - private static final int __MAC_14_0 = (int)140000L; - /** - * {@snippet lang=c : - * #define __MAC_14_0 140000 - * } - */ - public static int __MAC_14_0() { - return __MAC_14_0; - } - private static final int __MAC_14_1 = (int)140100L; - /** - * {@snippet lang=c : - * #define __MAC_14_1 140100 - * } - */ - public static int __MAC_14_1() { - return __MAC_14_1; - } - private static final int __MAC_14_2 = (int)140200L; - /** - * {@snippet lang=c : - * #define __MAC_14_2 140200 - * } - */ - public static int __MAC_14_2() { - return __MAC_14_2; - } - private static final int __MAC_14_3 = (int)140300L; - /** - * {@snippet lang=c : - * #define __MAC_14_3 140300 - * } - */ - public static int __MAC_14_3() { - return __MAC_14_3; - } - private static final int __MAC_14_4 = (int)140400L; - /** - * {@snippet lang=c : - * #define __MAC_14_4 140400 - * } - */ - public static int __MAC_14_4() { - return __MAC_14_4; - } - private static final int __MAC_14_5 = (int)140500L; - /** - * {@snippet lang=c : - * #define __MAC_14_5 140500 - * } - */ - public static int __MAC_14_5() { - return __MAC_14_5; - } - private static final int __IPHONE_2_0 = (int)20000L; - /** - * {@snippet lang=c : - * #define __IPHONE_2_0 20000 - * } - */ - public static int __IPHONE_2_0() { - return __IPHONE_2_0; - } - private static final int __IPHONE_2_1 = (int)20100L; - /** - * {@snippet lang=c : - * #define __IPHONE_2_1 20100 - * } - */ - public static int __IPHONE_2_1() { - return __IPHONE_2_1; - } - private static final int __IPHONE_2_2 = (int)20200L; - /** - * {@snippet lang=c : - * #define __IPHONE_2_2 20200 - * } - */ - public static int __IPHONE_2_2() { - return __IPHONE_2_2; - } - private static final int __IPHONE_3_0 = (int)30000L; - /** - * {@snippet lang=c : - * #define __IPHONE_3_0 30000 - * } - */ - public static int __IPHONE_3_0() { - return __IPHONE_3_0; - } - private static final int __IPHONE_3_1 = (int)30100L; - /** - * {@snippet lang=c : - * #define __IPHONE_3_1 30100 - * } - */ - public static int __IPHONE_3_1() { - return __IPHONE_3_1; - } - private static final int __IPHONE_3_2 = (int)30200L; - /** - * {@snippet lang=c : - * #define __IPHONE_3_2 30200 - * } - */ - public static int __IPHONE_3_2() { - return __IPHONE_3_2; - } - private static final int __IPHONE_4_0 = (int)40000L; - /** - * {@snippet lang=c : - * #define __IPHONE_4_0 40000 - * } - */ - public static int __IPHONE_4_0() { - return __IPHONE_4_0; - } - private static final int __IPHONE_4_1 = (int)40100L; - /** - * {@snippet lang=c : - * #define __IPHONE_4_1 40100 - * } - */ - public static int __IPHONE_4_1() { - return __IPHONE_4_1; - } - private static final int __IPHONE_4_2 = (int)40200L; - /** - * {@snippet lang=c : - * #define __IPHONE_4_2 40200 - * } - */ - public static int __IPHONE_4_2() { - return __IPHONE_4_2; - } - private static final int __IPHONE_4_3 = (int)40300L; - /** - * {@snippet lang=c : - * #define __IPHONE_4_3 40300 - * } - */ - public static int __IPHONE_4_3() { - return __IPHONE_4_3; - } - private static final int __IPHONE_5_0 = (int)50000L; - /** - * {@snippet lang=c : - * #define __IPHONE_5_0 50000 - * } - */ - public static int __IPHONE_5_0() { - return __IPHONE_5_0; - } - private static final int __IPHONE_5_1 = (int)50100L; - /** - * {@snippet lang=c : - * #define __IPHONE_5_1 50100 - * } - */ - public static int __IPHONE_5_1() { - return __IPHONE_5_1; - } - private static final int __IPHONE_6_0 = (int)60000L; - /** - * {@snippet lang=c : - * #define __IPHONE_6_0 60000 - * } - */ - public static int __IPHONE_6_0() { - return __IPHONE_6_0; - } - private static final int __IPHONE_6_1 = (int)60100L; - /** - * {@snippet lang=c : - * #define __IPHONE_6_1 60100 - * } - */ - public static int __IPHONE_6_1() { - return __IPHONE_6_1; - } - private static final int __IPHONE_7_0 = (int)70000L; - /** - * {@snippet lang=c : - * #define __IPHONE_7_0 70000 - * } - */ - public static int __IPHONE_7_0() { - return __IPHONE_7_0; - } - private static final int __IPHONE_7_1 = (int)70100L; - /** - * {@snippet lang=c : - * #define __IPHONE_7_1 70100 - * } - */ - public static int __IPHONE_7_1() { - return __IPHONE_7_1; - } - private static final int __IPHONE_8_0 = (int)80000L; - /** - * {@snippet lang=c : - * #define __IPHONE_8_0 80000 - * } - */ - public static int __IPHONE_8_0() { - return __IPHONE_8_0; - } - private static final int __IPHONE_8_1 = (int)80100L; - /** - * {@snippet lang=c : - * #define __IPHONE_8_1 80100 - * } - */ - public static int __IPHONE_8_1() { - return __IPHONE_8_1; - } - private static final int __IPHONE_8_2 = (int)80200L; - /** - * {@snippet lang=c : - * #define __IPHONE_8_2 80200 - * } - */ - public static int __IPHONE_8_2() { - return __IPHONE_8_2; - } - private static final int __IPHONE_8_3 = (int)80300L; - /** - * {@snippet lang=c : - * #define __IPHONE_8_3 80300 - * } - */ - public static int __IPHONE_8_3() { - return __IPHONE_8_3; - } - private static final int __IPHONE_8_4 = (int)80400L; - /** - * {@snippet lang=c : - * #define __IPHONE_8_4 80400 - * } - */ - public static int __IPHONE_8_4() { - return __IPHONE_8_4; - } - private static final int __IPHONE_9_0 = (int)90000L; - /** - * {@snippet lang=c : - * #define __IPHONE_9_0 90000 - * } - */ - public static int __IPHONE_9_0() { - return __IPHONE_9_0; - } - private static final int __IPHONE_9_1 = (int)90100L; - /** - * {@snippet lang=c : - * #define __IPHONE_9_1 90100 - * } - */ - public static int __IPHONE_9_1() { - return __IPHONE_9_1; - } - private static final int __IPHONE_9_2 = (int)90200L; - /** - * {@snippet lang=c : - * #define __IPHONE_9_2 90200 - * } - */ - public static int __IPHONE_9_2() { - return __IPHONE_9_2; - } - private static final int __IPHONE_9_3 = (int)90300L; - /** - * {@snippet lang=c : - * #define __IPHONE_9_3 90300 - * } - */ - public static int __IPHONE_9_3() { - return __IPHONE_9_3; - } - private static final int __IPHONE_10_0 = (int)100000L; - /** - * {@snippet lang=c : - * #define __IPHONE_10_0 100000 - * } - */ - public static int __IPHONE_10_0() { - return __IPHONE_10_0; - } - private static final int __IPHONE_10_1 = (int)100100L; - /** - * {@snippet lang=c : - * #define __IPHONE_10_1 100100 - * } - */ - public static int __IPHONE_10_1() { - return __IPHONE_10_1; - } - private static final int __IPHONE_10_2 = (int)100200L; - /** - * {@snippet lang=c : - * #define __IPHONE_10_2 100200 - * } - */ - public static int __IPHONE_10_2() { - return __IPHONE_10_2; - } - private static final int __IPHONE_10_3 = (int)100300L; - /** - * {@snippet lang=c : - * #define __IPHONE_10_3 100300 - * } - */ - public static int __IPHONE_10_3() { - return __IPHONE_10_3; - } - private static final int __IPHONE_11_0 = (int)110000L; - /** - * {@snippet lang=c : - * #define __IPHONE_11_0 110000 - * } - */ - public static int __IPHONE_11_0() { - return __IPHONE_11_0; - } - private static final int __IPHONE_11_1 = (int)110100L; - /** - * {@snippet lang=c : - * #define __IPHONE_11_1 110100 - * } - */ - public static int __IPHONE_11_1() { - return __IPHONE_11_1; - } - private static final int __IPHONE_11_2 = (int)110200L; - /** - * {@snippet lang=c : - * #define __IPHONE_11_2 110200 - * } - */ - public static int __IPHONE_11_2() { - return __IPHONE_11_2; - } - private static final int __IPHONE_11_3 = (int)110300L; - /** - * {@snippet lang=c : - * #define __IPHONE_11_3 110300 - * } - */ - public static int __IPHONE_11_3() { - return __IPHONE_11_3; - } - private static final int __IPHONE_11_4 = (int)110400L; - /** - * {@snippet lang=c : - * #define __IPHONE_11_4 110400 - * } - */ - public static int __IPHONE_11_4() { - return __IPHONE_11_4; - } - private static final int __IPHONE_12_0 = (int)120000L; - /** - * {@snippet lang=c : - * #define __IPHONE_12_0 120000 - * } - */ - public static int __IPHONE_12_0() { - return __IPHONE_12_0; - } - private static final int __IPHONE_12_1 = (int)120100L; - /** - * {@snippet lang=c : - * #define __IPHONE_12_1 120100 - * } - */ - public static int __IPHONE_12_1() { - return __IPHONE_12_1; - } - private static final int __IPHONE_12_2 = (int)120200L; - /** - * {@snippet lang=c : - * #define __IPHONE_12_2 120200 - * } - */ - public static int __IPHONE_12_2() { - return __IPHONE_12_2; - } - private static final int __IPHONE_12_3 = (int)120300L; - /** - * {@snippet lang=c : - * #define __IPHONE_12_3 120300 - * } - */ - public static int __IPHONE_12_3() { - return __IPHONE_12_3; - } - private static final int __IPHONE_12_4 = (int)120400L; - /** - * {@snippet lang=c : - * #define __IPHONE_12_4 120400 - * } - */ - public static int __IPHONE_12_4() { - return __IPHONE_12_4; - } - private static final int __IPHONE_13_0 = (int)130000L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_0 130000 - * } - */ - public static int __IPHONE_13_0() { - return __IPHONE_13_0; - } - private static final int __IPHONE_13_1 = (int)130100L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_1 130100 - * } - */ - public static int __IPHONE_13_1() { - return __IPHONE_13_1; - } - private static final int __IPHONE_13_2 = (int)130200L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_2 130200 - * } - */ - public static int __IPHONE_13_2() { - return __IPHONE_13_2; - } - private static final int __IPHONE_13_3 = (int)130300L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_3 130300 - * } - */ - public static int __IPHONE_13_3() { - return __IPHONE_13_3; - } - private static final int __IPHONE_13_4 = (int)130400L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_4 130400 - * } - */ - public static int __IPHONE_13_4() { - return __IPHONE_13_4; - } - private static final int __IPHONE_13_5 = (int)130500L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_5 130500 - * } - */ - public static int __IPHONE_13_5() { - return __IPHONE_13_5; - } - private static final int __IPHONE_13_6 = (int)130600L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_6 130600 - * } - */ - public static int __IPHONE_13_6() { - return __IPHONE_13_6; - } - private static final int __IPHONE_13_7 = (int)130700L; - /** - * {@snippet lang=c : - * #define __IPHONE_13_7 130700 - * } - */ - public static int __IPHONE_13_7() { - return __IPHONE_13_7; - } - private static final int __IPHONE_14_0 = (int)140000L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_0 140000 - * } - */ - public static int __IPHONE_14_0() { - return __IPHONE_14_0; - } - private static final int __IPHONE_14_1 = (int)140100L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_1 140100 - * } - */ - public static int __IPHONE_14_1() { - return __IPHONE_14_1; - } - private static final int __IPHONE_14_2 = (int)140200L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_2 140200 - * } - */ - public static int __IPHONE_14_2() { - return __IPHONE_14_2; - } - private static final int __IPHONE_14_3 = (int)140300L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_3 140300 - * } - */ - public static int __IPHONE_14_3() { - return __IPHONE_14_3; - } - private static final int __IPHONE_14_5 = (int)140500L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_5 140500 - * } - */ - public static int __IPHONE_14_5() { - return __IPHONE_14_5; - } - private static final int __IPHONE_14_4 = (int)140400L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_4 140400 - * } - */ - public static int __IPHONE_14_4() { - return __IPHONE_14_4; - } - private static final int __IPHONE_14_6 = (int)140600L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_6 140600 - * } - */ - public static int __IPHONE_14_6() { - return __IPHONE_14_6; - } - private static final int __IPHONE_14_7 = (int)140700L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_7 140700 - * } - */ - public static int __IPHONE_14_7() { - return __IPHONE_14_7; - } - private static final int __IPHONE_14_8 = (int)140800L; - /** - * {@snippet lang=c : - * #define __IPHONE_14_8 140800 - * } - */ - public static int __IPHONE_14_8() { - return __IPHONE_14_8; - } - private static final int __IPHONE_15_0 = (int)150000L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_0 150000 - * } - */ - public static int __IPHONE_15_0() { - return __IPHONE_15_0; - } - private static final int __IPHONE_15_1 = (int)150100L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_1 150100 - * } - */ - public static int __IPHONE_15_1() { - return __IPHONE_15_1; - } - private static final int __IPHONE_15_2 = (int)150200L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_2 150200 - * } - */ - public static int __IPHONE_15_2() { - return __IPHONE_15_2; - } - private static final int __IPHONE_15_3 = (int)150300L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_3 150300 - * } - */ - public static int __IPHONE_15_3() { - return __IPHONE_15_3; - } - private static final int __IPHONE_15_4 = (int)150400L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_4 150400 - * } - */ - public static int __IPHONE_15_4() { - return __IPHONE_15_4; - } - private static final int __IPHONE_15_5 = (int)150500L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_5 150500 - * } - */ - public static int __IPHONE_15_5() { - return __IPHONE_15_5; - } - private static final int __IPHONE_15_6 = (int)150600L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_6 150600 - * } - */ - public static int __IPHONE_15_6() { - return __IPHONE_15_6; - } - private static final int __IPHONE_15_7 = (int)150700L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_7 150700 - * } - */ - public static int __IPHONE_15_7() { - return __IPHONE_15_7; - } - private static final int __IPHONE_15_8 = (int)150800L; - /** - * {@snippet lang=c : - * #define __IPHONE_15_8 150800 - * } - */ - public static int __IPHONE_15_8() { - return __IPHONE_15_8; - } - private static final int __IPHONE_16_0 = (int)160000L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_0 160000 - * } - */ - public static int __IPHONE_16_0() { - return __IPHONE_16_0; - } - private static final int __IPHONE_16_1 = (int)160100L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_1 160100 - * } - */ - public static int __IPHONE_16_1() { - return __IPHONE_16_1; - } - private static final int __IPHONE_16_2 = (int)160200L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_2 160200 - * } - */ - public static int __IPHONE_16_2() { - return __IPHONE_16_2; - } - private static final int __IPHONE_16_3 = (int)160300L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_3 160300 - * } - */ - public static int __IPHONE_16_3() { - return __IPHONE_16_3; - } - private static final int __IPHONE_16_4 = (int)160400L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_4 160400 - * } - */ - public static int __IPHONE_16_4() { - return __IPHONE_16_4; - } - private static final int __IPHONE_16_5 = (int)160500L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_5 160500 - * } - */ - public static int __IPHONE_16_5() { - return __IPHONE_16_5; - } - private static final int __IPHONE_16_6 = (int)160600L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_6 160600 - * } - */ - public static int __IPHONE_16_6() { - return __IPHONE_16_6; - } - private static final int __IPHONE_16_7 = (int)160700L; - /** - * {@snippet lang=c : - * #define __IPHONE_16_7 160700 - * } - */ - public static int __IPHONE_16_7() { - return __IPHONE_16_7; - } - private static final int __IPHONE_17_0 = (int)170000L; - /** - * {@snippet lang=c : - * #define __IPHONE_17_0 170000 - * } - */ - public static int __IPHONE_17_0() { - return __IPHONE_17_0; - } - private static final int __IPHONE_17_1 = (int)170100L; - /** - * {@snippet lang=c : - * #define __IPHONE_17_1 170100 - * } - */ - public static int __IPHONE_17_1() { - return __IPHONE_17_1; - } - private static final int __IPHONE_17_2 = (int)170200L; - /** - * {@snippet lang=c : - * #define __IPHONE_17_2 170200 - * } - */ - public static int __IPHONE_17_2() { - return __IPHONE_17_2; - } - private static final int __IPHONE_17_3 = (int)170300L; - /** - * {@snippet lang=c : - * #define __IPHONE_17_3 170300 - * } - */ - public static int __IPHONE_17_3() { - return __IPHONE_17_3; - } - private static final int __IPHONE_17_4 = (int)170400L; - /** - * {@snippet lang=c : - * #define __IPHONE_17_4 170400 - * } - */ - public static int __IPHONE_17_4() { - return __IPHONE_17_4; - } - private static final int __IPHONE_17_5 = (int)170500L; - /** - * {@snippet lang=c : - * #define __IPHONE_17_5 170500 - * } - */ - public static int __IPHONE_17_5() { - return __IPHONE_17_5; - } - private static final int __WATCHOS_1_0 = (int)10000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_1_0 10000 - * } - */ - public static int __WATCHOS_1_0() { - return __WATCHOS_1_0; - } - private static final int __WATCHOS_2_0 = (int)20000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_2_0 20000 - * } - */ - public static int __WATCHOS_2_0() { - return __WATCHOS_2_0; - } - private static final int __WATCHOS_2_1 = (int)20100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_2_1 20100 - * } - */ - public static int __WATCHOS_2_1() { - return __WATCHOS_2_1; - } - private static final int __WATCHOS_2_2 = (int)20200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_2_2 20200 - * } - */ - public static int __WATCHOS_2_2() { - return __WATCHOS_2_2; - } - private static final int __WATCHOS_3_0 = (int)30000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_3_0 30000 - * } - */ - public static int __WATCHOS_3_0() { - return __WATCHOS_3_0; - } - private static final int __WATCHOS_3_1 = (int)30100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_3_1 30100 - * } - */ - public static int __WATCHOS_3_1() { - return __WATCHOS_3_1; - } - private static final int __WATCHOS_3_1_1 = (int)30101L; - /** - * {@snippet lang=c : - * #define __WATCHOS_3_1_1 30101 - * } - */ - public static int __WATCHOS_3_1_1() { - return __WATCHOS_3_1_1; - } - private static final int __WATCHOS_3_2 = (int)30200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_3_2 30200 - * } - */ - public static int __WATCHOS_3_2() { - return __WATCHOS_3_2; - } - private static final int __WATCHOS_4_0 = (int)40000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_4_0 40000 - * } - */ - public static int __WATCHOS_4_0() { - return __WATCHOS_4_0; - } - private static final int __WATCHOS_4_1 = (int)40100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_4_1 40100 - * } - */ - public static int __WATCHOS_4_1() { - return __WATCHOS_4_1; - } - private static final int __WATCHOS_4_2 = (int)40200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_4_2 40200 - * } - */ - public static int __WATCHOS_4_2() { - return __WATCHOS_4_2; - } - private static final int __WATCHOS_4_3 = (int)40300L; - /** - * {@snippet lang=c : - * #define __WATCHOS_4_3 40300 - * } - */ - public static int __WATCHOS_4_3() { - return __WATCHOS_4_3; - } - private static final int __WATCHOS_5_0 = (int)50000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_5_0 50000 - * } - */ - public static int __WATCHOS_5_0() { - return __WATCHOS_5_0; - } - private static final int __WATCHOS_5_1 = (int)50100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_5_1 50100 - * } - */ - public static int __WATCHOS_5_1() { - return __WATCHOS_5_1; - } - private static final int __WATCHOS_5_2 = (int)50200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_5_2 50200 - * } - */ - public static int __WATCHOS_5_2() { - return __WATCHOS_5_2; - } - private static final int __WATCHOS_5_3 = (int)50300L; - /** - * {@snippet lang=c : - * #define __WATCHOS_5_3 50300 - * } - */ - public static int __WATCHOS_5_3() { - return __WATCHOS_5_3; - } - private static final int __WATCHOS_6_0 = (int)60000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_6_0 60000 - * } - */ - public static int __WATCHOS_6_0() { - return __WATCHOS_6_0; - } - private static final int __WATCHOS_6_1 = (int)60100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_6_1 60100 - * } - */ - public static int __WATCHOS_6_1() { - return __WATCHOS_6_1; - } - private static final int __WATCHOS_6_2 = (int)60200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_6_2 60200 - * } - */ - public static int __WATCHOS_6_2() { - return __WATCHOS_6_2; - } - private static final int __WATCHOS_7_0 = (int)70000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_0 70000 - * } - */ - public static int __WATCHOS_7_0() { - return __WATCHOS_7_0; - } - private static final int __WATCHOS_7_1 = (int)70100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_1 70100 - * } - */ - public static int __WATCHOS_7_1() { - return __WATCHOS_7_1; - } - private static final int __WATCHOS_7_2 = (int)70200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_2 70200 - * } - */ - public static int __WATCHOS_7_2() { - return __WATCHOS_7_2; - } - private static final int __WATCHOS_7_3 = (int)70300L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_3 70300 - * } - */ - public static int __WATCHOS_7_3() { - return __WATCHOS_7_3; - } - private static final int __WATCHOS_7_4 = (int)70400L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_4 70400 - * } - */ - public static int __WATCHOS_7_4() { - return __WATCHOS_7_4; - } - private static final int __WATCHOS_7_5 = (int)70500L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_5 70500 - * } - */ - public static int __WATCHOS_7_5() { - return __WATCHOS_7_5; - } - private static final int __WATCHOS_7_6 = (int)70600L; - /** - * {@snippet lang=c : - * #define __WATCHOS_7_6 70600 - * } - */ - public static int __WATCHOS_7_6() { - return __WATCHOS_7_6; - } - private static final int __WATCHOS_8_0 = (int)80000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_0 80000 - * } - */ - public static int __WATCHOS_8_0() { - return __WATCHOS_8_0; - } - private static final int __WATCHOS_8_1 = (int)80100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_1 80100 - * } - */ - public static int __WATCHOS_8_1() { - return __WATCHOS_8_1; - } - private static final int __WATCHOS_8_3 = (int)80300L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_3 80300 - * } - */ - public static int __WATCHOS_8_3() { - return __WATCHOS_8_3; - } - private static final int __WATCHOS_8_4 = (int)80400L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_4 80400 - * } - */ - public static int __WATCHOS_8_4() { - return __WATCHOS_8_4; - } - private static final int __WATCHOS_8_5 = (int)80500L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_5 80500 - * } - */ - public static int __WATCHOS_8_5() { - return __WATCHOS_8_5; - } - private static final int __WATCHOS_8_6 = (int)80600L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_6 80600 - * } - */ - public static int __WATCHOS_8_6() { - return __WATCHOS_8_6; - } - private static final int __WATCHOS_8_7 = (int)80700L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_7 80700 - * } - */ - public static int __WATCHOS_8_7() { - return __WATCHOS_8_7; - } - private static final int __WATCHOS_8_8 = (int)80800L; - /** - * {@snippet lang=c : - * #define __WATCHOS_8_8 80800 - * } - */ - public static int __WATCHOS_8_8() { - return __WATCHOS_8_8; - } - private static final int __WATCHOS_9_0 = (int)90000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_0 90000 - * } - */ - public static int __WATCHOS_9_0() { - return __WATCHOS_9_0; - } - private static final int __WATCHOS_9_1 = (int)90100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_1 90100 - * } - */ - public static int __WATCHOS_9_1() { - return __WATCHOS_9_1; - } - private static final int __WATCHOS_9_2 = (int)90200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_2 90200 - * } - */ - public static int __WATCHOS_9_2() { - return __WATCHOS_9_2; - } - private static final int __WATCHOS_9_3 = (int)90300L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_3 90300 - * } - */ - public static int __WATCHOS_9_3() { - return __WATCHOS_9_3; - } - private static final int __WATCHOS_9_4 = (int)90400L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_4 90400 - * } - */ - public static int __WATCHOS_9_4() { - return __WATCHOS_9_4; - } - private static final int __WATCHOS_9_5 = (int)90500L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_5 90500 - * } - */ - public static int __WATCHOS_9_5() { - return __WATCHOS_9_5; - } - private static final int __WATCHOS_9_6 = (int)90600L; - /** - * {@snippet lang=c : - * #define __WATCHOS_9_6 90600 - * } - */ - public static int __WATCHOS_9_6() { - return __WATCHOS_9_6; - } - private static final int __WATCHOS_10_0 = (int)100000L; - /** - * {@snippet lang=c : - * #define __WATCHOS_10_0 100000 - * } - */ - public static int __WATCHOS_10_0() { - return __WATCHOS_10_0; - } - private static final int __WATCHOS_10_1 = (int)100100L; - /** - * {@snippet lang=c : - * #define __WATCHOS_10_1 100100 - * } - */ - public static int __WATCHOS_10_1() { - return __WATCHOS_10_1; - } - private static final int __WATCHOS_10_2 = (int)100200L; - /** - * {@snippet lang=c : - * #define __WATCHOS_10_2 100200 - * } - */ - public static int __WATCHOS_10_2() { - return __WATCHOS_10_2; - } - private static final int __WATCHOS_10_3 = (int)100300L; - /** - * {@snippet lang=c : - * #define __WATCHOS_10_3 100300 - * } - */ - public static int __WATCHOS_10_3() { - return __WATCHOS_10_3; - } - private static final int __WATCHOS_10_4 = (int)100400L; - /** - * {@snippet lang=c : - * #define __WATCHOS_10_4 100400 - * } - */ - public static int __WATCHOS_10_4() { - return __WATCHOS_10_4; - } - private static final int __WATCHOS_10_5 = (int)100500L; - /** - * {@snippet lang=c : - * #define __WATCHOS_10_5 100500 - * } - */ - public static int __WATCHOS_10_5() { - return __WATCHOS_10_5; - } - private static final int __TVOS_9_0 = (int)90000L; - /** - * {@snippet lang=c : - * #define __TVOS_9_0 90000 - * } - */ - public static int __TVOS_9_0() { - return __TVOS_9_0; - } - private static final int __TVOS_9_1 = (int)90100L; - /** - * {@snippet lang=c : - * #define __TVOS_9_1 90100 - * } - */ - public static int __TVOS_9_1() { - return __TVOS_9_1; - } - private static final int __TVOS_9_2 = (int)90200L; - /** - * {@snippet lang=c : - * #define __TVOS_9_2 90200 - * } - */ - public static int __TVOS_9_2() { - return __TVOS_9_2; - } - private static final int __TVOS_10_0 = (int)100000L; - /** - * {@snippet lang=c : - * #define __TVOS_10_0 100000 - * } - */ - public static int __TVOS_10_0() { - return __TVOS_10_0; - } - private static final int __TVOS_10_0_1 = (int)100001L; - /** - * {@snippet lang=c : - * #define __TVOS_10_0_1 100001 - * } - */ - public static int __TVOS_10_0_1() { - return __TVOS_10_0_1; - } - private static final int __TVOS_10_1 = (int)100100L; - /** - * {@snippet lang=c : - * #define __TVOS_10_1 100100 - * } - */ - public static int __TVOS_10_1() { - return __TVOS_10_1; - } - private static final int __TVOS_10_2 = (int)100200L; - /** - * {@snippet lang=c : - * #define __TVOS_10_2 100200 - * } - */ - public static int __TVOS_10_2() { - return __TVOS_10_2; - } - private static final int __TVOS_11_0 = (int)110000L; - /** - * {@snippet lang=c : - * #define __TVOS_11_0 110000 - * } - */ - public static int __TVOS_11_0() { - return __TVOS_11_0; - } - private static final int __TVOS_11_1 = (int)110100L; - /** - * {@snippet lang=c : - * #define __TVOS_11_1 110100 - * } - */ - public static int __TVOS_11_1() { - return __TVOS_11_1; - } - private static final int __TVOS_11_2 = (int)110200L; - /** - * {@snippet lang=c : - * #define __TVOS_11_2 110200 - * } - */ - public static int __TVOS_11_2() { - return __TVOS_11_2; - } - private static final int __TVOS_11_3 = (int)110300L; - /** - * {@snippet lang=c : - * #define __TVOS_11_3 110300 - * } - */ - public static int __TVOS_11_3() { - return __TVOS_11_3; - } - private static final int __TVOS_11_4 = (int)110400L; - /** - * {@snippet lang=c : - * #define __TVOS_11_4 110400 - * } - */ - public static int __TVOS_11_4() { - return __TVOS_11_4; - } - private static final int __TVOS_12_0 = (int)120000L; - /** - * {@snippet lang=c : - * #define __TVOS_12_0 120000 - * } - */ - public static int __TVOS_12_0() { - return __TVOS_12_0; - } - private static final int __TVOS_12_1 = (int)120100L; - /** - * {@snippet lang=c : - * #define __TVOS_12_1 120100 - * } - */ - public static int __TVOS_12_1() { - return __TVOS_12_1; - } - private static final int __TVOS_12_2 = (int)120200L; - /** - * {@snippet lang=c : - * #define __TVOS_12_2 120200 - * } - */ - public static int __TVOS_12_2() { - return __TVOS_12_2; - } - private static final int __TVOS_12_3 = (int)120300L; - /** - * {@snippet lang=c : - * #define __TVOS_12_3 120300 - * } - */ - public static int __TVOS_12_3() { - return __TVOS_12_3; - } - private static final int __TVOS_12_4 = (int)120400L; - /** - * {@snippet lang=c : - * #define __TVOS_12_4 120400 - * } - */ - public static int __TVOS_12_4() { - return __TVOS_12_4; - } - private static final int __TVOS_13_0 = (int)130000L; - /** - * {@snippet lang=c : - * #define __TVOS_13_0 130000 - * } - */ - public static int __TVOS_13_0() { - return __TVOS_13_0; - } - private static final int __TVOS_13_2 = (int)130200L; - /** - * {@snippet lang=c : - * #define __TVOS_13_2 130200 - * } - */ - public static int __TVOS_13_2() { - return __TVOS_13_2; - } - private static final int __TVOS_13_3 = (int)130300L; - /** - * {@snippet lang=c : - * #define __TVOS_13_3 130300 - * } - */ - public static int __TVOS_13_3() { - return __TVOS_13_3; - } - private static final int __TVOS_13_4 = (int)130400L; - /** - * {@snippet lang=c : - * #define __TVOS_13_4 130400 - * } - */ - public static int __TVOS_13_4() { - return __TVOS_13_4; - } - private static final int __TVOS_14_0 = (int)140000L; - /** - * {@snippet lang=c : - * #define __TVOS_14_0 140000 - * } - */ - public static int __TVOS_14_0() { - return __TVOS_14_0; - } - private static final int __TVOS_14_1 = (int)140100L; - /** - * {@snippet lang=c : - * #define __TVOS_14_1 140100 - * } - */ - public static int __TVOS_14_1() { - return __TVOS_14_1; - } - private static final int __TVOS_14_2 = (int)140200L; - /** - * {@snippet lang=c : - * #define __TVOS_14_2 140200 - * } - */ - public static int __TVOS_14_2() { - return __TVOS_14_2; - } - private static final int __TVOS_14_3 = (int)140300L; - /** - * {@snippet lang=c : - * #define __TVOS_14_3 140300 - * } - */ - public static int __TVOS_14_3() { - return __TVOS_14_3; - } - private static final int __TVOS_14_5 = (int)140500L; - /** - * {@snippet lang=c : - * #define __TVOS_14_5 140500 - * } - */ - public static int __TVOS_14_5() { - return __TVOS_14_5; - } - private static final int __TVOS_14_6 = (int)140600L; - /** - * {@snippet lang=c : - * #define __TVOS_14_6 140600 - * } - */ - public static int __TVOS_14_6() { - return __TVOS_14_6; - } - private static final int __TVOS_14_7 = (int)140700L; - /** - * {@snippet lang=c : - * #define __TVOS_14_7 140700 - * } - */ - public static int __TVOS_14_7() { - return __TVOS_14_7; - } - private static final int __TVOS_15_0 = (int)150000L; - /** - * {@snippet lang=c : - * #define __TVOS_15_0 150000 - * } - */ - public static int __TVOS_15_0() { - return __TVOS_15_0; - } - private static final int __TVOS_15_1 = (int)150100L; - /** - * {@snippet lang=c : - * #define __TVOS_15_1 150100 - * } - */ - public static int __TVOS_15_1() { - return __TVOS_15_1; - } - private static final int __TVOS_15_2 = (int)150200L; - /** - * {@snippet lang=c : - * #define __TVOS_15_2 150200 - * } - */ - public static int __TVOS_15_2() { - return __TVOS_15_2; - } - private static final int __TVOS_15_3 = (int)150300L; - /** - * {@snippet lang=c : - * #define __TVOS_15_3 150300 - * } - */ - public static int __TVOS_15_3() { - return __TVOS_15_3; - } - private static final int __TVOS_15_4 = (int)150400L; - /** - * {@snippet lang=c : - * #define __TVOS_15_4 150400 - * } - */ - public static int __TVOS_15_4() { - return __TVOS_15_4; - } - private static final int __TVOS_15_5 = (int)150500L; - /** - * {@snippet lang=c : - * #define __TVOS_15_5 150500 - * } - */ - public static int __TVOS_15_5() { - return __TVOS_15_5; - } - private static final int __TVOS_15_6 = (int)150600L; - /** - * {@snippet lang=c : - * #define __TVOS_15_6 150600 - * } - */ - public static int __TVOS_15_6() { - return __TVOS_15_6; - } - private static final int __TVOS_16_0 = (int)160000L; - /** - * {@snippet lang=c : - * #define __TVOS_16_0 160000 - * } - */ - public static int __TVOS_16_0() { - return __TVOS_16_0; - } - private static final int __TVOS_16_1 = (int)160100L; - /** - * {@snippet lang=c : - * #define __TVOS_16_1 160100 - * } - */ - public static int __TVOS_16_1() { - return __TVOS_16_1; - } - private static final int __TVOS_16_2 = (int)160200L; - /** - * {@snippet lang=c : - * #define __TVOS_16_2 160200 - * } - */ - public static int __TVOS_16_2() { - return __TVOS_16_2; - } - private static final int __TVOS_16_3 = (int)160300L; - /** - * {@snippet lang=c : - * #define __TVOS_16_3 160300 - * } - */ - public static int __TVOS_16_3() { - return __TVOS_16_3; - } - private static final int __TVOS_16_4 = (int)160400L; - /** - * {@snippet lang=c : - * #define __TVOS_16_4 160400 - * } - */ - public static int __TVOS_16_4() { - return __TVOS_16_4; - } - private static final int __TVOS_16_5 = (int)160500L; - /** - * {@snippet lang=c : - * #define __TVOS_16_5 160500 - * } - */ - public static int __TVOS_16_5() { - return __TVOS_16_5; - } - private static final int __TVOS_16_6 = (int)160600L; - /** - * {@snippet lang=c : - * #define __TVOS_16_6 160600 - * } - */ - public static int __TVOS_16_6() { - return __TVOS_16_6; - } - private static final int __TVOS_17_0 = (int)170000L; - /** - * {@snippet lang=c : - * #define __TVOS_17_0 170000 - * } - */ - public static int __TVOS_17_0() { - return __TVOS_17_0; - } - private static final int __TVOS_17_1 = (int)170100L; - /** - * {@snippet lang=c : - * #define __TVOS_17_1 170100 - * } - */ - public static int __TVOS_17_1() { - return __TVOS_17_1; - } - private static final int __TVOS_17_2 = (int)170200L; - /** - * {@snippet lang=c : - * #define __TVOS_17_2 170200 - * } - */ - public static int __TVOS_17_2() { - return __TVOS_17_2; - } - private static final int __TVOS_17_3 = (int)170300L; - /** - * {@snippet lang=c : - * #define __TVOS_17_3 170300 - * } - */ - public static int __TVOS_17_3() { - return __TVOS_17_3; - } - private static final int __TVOS_17_4 = (int)170400L; - /** - * {@snippet lang=c : - * #define __TVOS_17_4 170400 - * } - */ - public static int __TVOS_17_4() { - return __TVOS_17_4; - } - private static final int __TVOS_17_5 = (int)170500L; - /** - * {@snippet lang=c : - * #define __TVOS_17_5 170500 - * } - */ - public static int __TVOS_17_5() { - return __TVOS_17_5; - } - private static final int __BRIDGEOS_2_0 = (int)20000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_2_0 20000 - * } - */ - public static int __BRIDGEOS_2_0() { - return __BRIDGEOS_2_0; - } - private static final int __BRIDGEOS_3_0 = (int)30000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_3_0 30000 - * } - */ - public static int __BRIDGEOS_3_0() { - return __BRIDGEOS_3_0; - } - private static final int __BRIDGEOS_3_1 = (int)30100L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_3_1 30100 - * } - */ - public static int __BRIDGEOS_3_1() { - return __BRIDGEOS_3_1; - } - private static final int __BRIDGEOS_3_4 = (int)30400L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_3_4 30400 - * } - */ - public static int __BRIDGEOS_3_4() { - return __BRIDGEOS_3_4; - } - private static final int __BRIDGEOS_4_0 = (int)40000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_4_0 40000 - * } - */ - public static int __BRIDGEOS_4_0() { - return __BRIDGEOS_4_0; - } - private static final int __BRIDGEOS_4_1 = (int)40100L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_4_1 40100 - * } - */ - public static int __BRIDGEOS_4_1() { - return __BRIDGEOS_4_1; - } - private static final int __BRIDGEOS_5_0 = (int)50000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_5_0 50000 - * } - */ - public static int __BRIDGEOS_5_0() { - return __BRIDGEOS_5_0; - } - private static final int __BRIDGEOS_5_1 = (int)50100L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_5_1 50100 - * } - */ - public static int __BRIDGEOS_5_1() { - return __BRIDGEOS_5_1; - } - private static final int __BRIDGEOS_5_3 = (int)50300L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_5_3 50300 - * } - */ - public static int __BRIDGEOS_5_3() { - return __BRIDGEOS_5_3; - } - private static final int __BRIDGEOS_6_0 = (int)60000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_6_0 60000 - * } - */ - public static int __BRIDGEOS_6_0() { - return __BRIDGEOS_6_0; - } - private static final int __BRIDGEOS_6_2 = (int)60200L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_6_2 60200 - * } - */ - public static int __BRIDGEOS_6_2() { - return __BRIDGEOS_6_2; - } - private static final int __BRIDGEOS_6_4 = (int)60400L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_6_4 60400 - * } - */ - public static int __BRIDGEOS_6_4() { - return __BRIDGEOS_6_4; - } - private static final int __BRIDGEOS_6_5 = (int)60500L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_6_5 60500 - * } - */ - public static int __BRIDGEOS_6_5() { - return __BRIDGEOS_6_5; - } - private static final int __BRIDGEOS_6_6 = (int)60600L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_6_6 60600 - * } - */ - public static int __BRIDGEOS_6_6() { - return __BRIDGEOS_6_6; - } - private static final int __BRIDGEOS_7_0 = (int)70000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_7_0 70000 - * } - */ - public static int __BRIDGEOS_7_0() { - return __BRIDGEOS_7_0; - } - private static final int __BRIDGEOS_7_1 = (int)70100L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_7_1 70100 - * } - */ - public static int __BRIDGEOS_7_1() { - return __BRIDGEOS_7_1; - } - private static final int __BRIDGEOS_7_2 = (int)70200L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_7_2 70200 - * } - */ - public static int __BRIDGEOS_7_2() { - return __BRIDGEOS_7_2; - } - private static final int __BRIDGEOS_7_3 = (int)70300L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_7_3 70300 - * } - */ - public static int __BRIDGEOS_7_3() { - return __BRIDGEOS_7_3; - } - private static final int __BRIDGEOS_7_4 = (int)70400L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_7_4 70400 - * } - */ - public static int __BRIDGEOS_7_4() { - return __BRIDGEOS_7_4; - } - private static final int __BRIDGEOS_7_6 = (int)70600L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_7_6 70600 - * } - */ - public static int __BRIDGEOS_7_6() { - return __BRIDGEOS_7_6; - } - private static final int __BRIDGEOS_8_0 = (int)80000L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_8_0 80000 - * } - */ - public static int __BRIDGEOS_8_0() { - return __BRIDGEOS_8_0; - } - private static final int __BRIDGEOS_8_1 = (int)80100L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_8_1 80100 - * } - */ - public static int __BRIDGEOS_8_1() { - return __BRIDGEOS_8_1; - } - private static final int __BRIDGEOS_8_2 = (int)80200L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_8_2 80200 - * } - */ - public static int __BRIDGEOS_8_2() { - return __BRIDGEOS_8_2; - } - private static final int __BRIDGEOS_8_3 = (int)80300L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_8_3 80300 - * } - */ - public static int __BRIDGEOS_8_3() { - return __BRIDGEOS_8_3; - } - private static final int __BRIDGEOS_8_4 = (int)80400L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_8_4 80400 - * } - */ - public static int __BRIDGEOS_8_4() { - return __BRIDGEOS_8_4; - } - private static final int __BRIDGEOS_8_5 = (int)80500L; - /** - * {@snippet lang=c : - * #define __BRIDGEOS_8_5 80500 - * } - */ - public static int __BRIDGEOS_8_5() { - return __BRIDGEOS_8_5; - } - private static final int __DRIVERKIT_19_0 = (int)190000L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_19_0 190000 - * } - */ - public static int __DRIVERKIT_19_0() { - return __DRIVERKIT_19_0; - } - private static final int __DRIVERKIT_20_0 = (int)200000L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_20_0 200000 - * } - */ - public static int __DRIVERKIT_20_0() { - return __DRIVERKIT_20_0; - } - private static final int __DRIVERKIT_21_0 = (int)210000L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_21_0 210000 - * } - */ - public static int __DRIVERKIT_21_0() { - return __DRIVERKIT_21_0; - } - private static final int __DRIVERKIT_22_0 = (int)220000L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_22_0 220000 - * } - */ - public static int __DRIVERKIT_22_0() { - return __DRIVERKIT_22_0; - } - private static final int __DRIVERKIT_22_4 = (int)220400L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_22_4 220400 - * } - */ - public static int __DRIVERKIT_22_4() { - return __DRIVERKIT_22_4; - } - private static final int __DRIVERKIT_22_5 = (int)220500L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_22_5 220500 - * } - */ - public static int __DRIVERKIT_22_5() { - return __DRIVERKIT_22_5; - } - private static final int __DRIVERKIT_22_6 = (int)220600L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_22_6 220600 - * } - */ - public static int __DRIVERKIT_22_6() { - return __DRIVERKIT_22_6; - } - private static final int __DRIVERKIT_23_0 = (int)230000L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_23_0 230000 - * } - */ - public static int __DRIVERKIT_23_0() { - return __DRIVERKIT_23_0; - } - private static final int __DRIVERKIT_23_1 = (int)230100L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_23_1 230100 - * } - */ - public static int __DRIVERKIT_23_1() { - return __DRIVERKIT_23_1; - } - private static final int __DRIVERKIT_23_2 = (int)230200L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_23_2 230200 - * } - */ - public static int __DRIVERKIT_23_2() { - return __DRIVERKIT_23_2; - } - private static final int __DRIVERKIT_23_3 = (int)230300L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_23_3 230300 - * } - */ - public static int __DRIVERKIT_23_3() { - return __DRIVERKIT_23_3; - } - private static final int __DRIVERKIT_23_4 = (int)230400L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_23_4 230400 - * } - */ - public static int __DRIVERKIT_23_4() { - return __DRIVERKIT_23_4; - } - private static final int __DRIVERKIT_23_5 = (int)230500L; - /** - * {@snippet lang=c : - * #define __DRIVERKIT_23_5 230500 - * } - */ - public static int __DRIVERKIT_23_5() { - return __DRIVERKIT_23_5; - } - private static final int __VISIONOS_1_0 = (int)10000L; - /** - * {@snippet lang=c : - * #define __VISIONOS_1_0 10000 - * } - */ - public static int __VISIONOS_1_0() { - return __VISIONOS_1_0; - } - private static final int __VISIONOS_1_1 = (int)10100L; - /** - * {@snippet lang=c : - * #define __VISIONOS_1_1 10100 - * } - */ - public static int __VISIONOS_1_1() { - return __VISIONOS_1_1; - } - private static final int __VISIONOS_1_2 = (int)10200L; - /** - * {@snippet lang=c : - * #define __VISIONOS_1_2 10200 - * } - */ - public static int __VISIONOS_1_2() { - return __VISIONOS_1_2; - } - private static final int __ENABLE_LEGACY_MAC_AVAILABILITY = (int)1L; - /** - * {@snippet lang=c : - * #define __ENABLE_LEGACY_MAC_AVAILABILITY 1 - * } - */ - public static int __ENABLE_LEGACY_MAC_AVAILABILITY() { - return __ENABLE_LEGACY_MAC_AVAILABILITY; - } - private static final int _FORTIFY_SOURCE = (int)2L; - /** - * {@snippet lang=c : - * #define _FORTIFY_SOURCE 2 - * } - */ - public static int _FORTIFY_SOURCE() { - return _FORTIFY_SOURCE; - } - private static final int RENAME_SECLUDE = (int)1L; - /** - * {@snippet lang=c : - * #define RENAME_SECLUDE 1 - * } - */ - public static int RENAME_SECLUDE() { - return RENAME_SECLUDE; - } - private static final int RENAME_SWAP = (int)2L; - /** - * {@snippet lang=c : - * #define RENAME_SWAP 2 - * } - */ - public static int RENAME_SWAP() { - return RENAME_SWAP; - } - private static final int RENAME_EXCL = (int)4L; - /** - * {@snippet lang=c : - * #define RENAME_EXCL 4 - * } - */ - public static int RENAME_EXCL() { - return RENAME_EXCL; - } - private static final int RENAME_RESERVED1 = (int)8L; - /** - * {@snippet lang=c : - * #define RENAME_RESERVED1 8 - * } - */ - public static int RENAME_RESERVED1() { - return RENAME_RESERVED1; - } - private static final int RENAME_NOFOLLOW_ANY = (int)16L; - /** - * {@snippet lang=c : - * #define RENAME_NOFOLLOW_ANY 16 - * } - */ - public static int RENAME_NOFOLLOW_ANY() { - return RENAME_NOFOLLOW_ANY; - } - private static final int SEEK_SET = (int)0L; - /** - * {@snippet lang=c : - * #define SEEK_SET 0 - * } - */ - public static int SEEK_SET() { - return SEEK_SET; - } - private static final int SEEK_CUR = (int)1L; - /** - * {@snippet lang=c : - * #define SEEK_CUR 1 - * } - */ - public static int SEEK_CUR() { - return SEEK_CUR; - } - private static final int SEEK_END = (int)2L; - /** - * {@snippet lang=c : - * #define SEEK_END 2 - * } - */ - public static int SEEK_END() { - return SEEK_END; - } - private static final int SEEK_HOLE = (int)3L; - /** - * {@snippet lang=c : - * #define SEEK_HOLE 3 - * } - */ - public static int SEEK_HOLE() { - return SEEK_HOLE; - } - private static final int SEEK_DATA = (int)4L; - /** - * {@snippet lang=c : - * #define SEEK_DATA 4 - * } - */ - public static int SEEK_DATA() { - return SEEK_DATA; - } - private static final int __SLBF = (int)1L; - /** - * {@snippet lang=c : - * #define __SLBF 1 - * } - */ - public static int __SLBF() { - return __SLBF; - } - private static final int __SNBF = (int)2L; - /** - * {@snippet lang=c : - * #define __SNBF 2 - * } - */ - public static int __SNBF() { - return __SNBF; - } - private static final int __SRD = (int)4L; - /** - * {@snippet lang=c : - * #define __SRD 4 - * } - */ - public static int __SRD() { - return __SRD; - } - private static final int __SWR = (int)8L; - /** - * {@snippet lang=c : - * #define __SWR 8 - * } - */ - public static int __SWR() { - return __SWR; - } - private static final int __SRW = (int)16L; - /** - * {@snippet lang=c : - * #define __SRW 16 - * } - */ - public static int __SRW() { - return __SRW; - } - private static final int __SEOF = (int)32L; - /** - * {@snippet lang=c : - * #define __SEOF 32 - * } - */ - public static int __SEOF() { - return __SEOF; - } - private static final int __SERR = (int)64L; - /** - * {@snippet lang=c : - * #define __SERR 64 - * } - */ - public static int __SERR() { - return __SERR; - } - private static final int __SMBF = (int)128L; - /** - * {@snippet lang=c : - * #define __SMBF 128 - * } - */ - public static int __SMBF() { - return __SMBF; - } - private static final int __SAPP = (int)256L; - /** - * {@snippet lang=c : - * #define __SAPP 256 - * } - */ - public static int __SAPP() { - return __SAPP; - } - private static final int __SSTR = (int)512L; - /** - * {@snippet lang=c : - * #define __SSTR 512 - * } - */ - public static int __SSTR() { - return __SSTR; - } - private static final int __SOPT = (int)1024L; - /** - * {@snippet lang=c : - * #define __SOPT 1024 - * } - */ - public static int __SOPT() { - return __SOPT; - } - private static final int __SNPT = (int)2048L; - /** - * {@snippet lang=c : - * #define __SNPT 2048 - * } - */ - public static int __SNPT() { - return __SNPT; - } - private static final int __SOFF = (int)4096L; - /** - * {@snippet lang=c : - * #define __SOFF 4096 - * } - */ - public static int __SOFF() { - return __SOFF; - } - private static final int __SMOD = (int)8192L; - /** - * {@snippet lang=c : - * #define __SMOD 8192 - * } - */ - public static int __SMOD() { - return __SMOD; - } - private static final int __SALC = (int)16384L; - /** - * {@snippet lang=c : - * #define __SALC 16384 - * } - */ - public static int __SALC() { - return __SALC; - } - private static final int __SIGN = (int)32768L; - /** - * {@snippet lang=c : - * #define __SIGN 32768 - * } - */ - public static int __SIGN() { - return __SIGN; - } - private static final int _IOFBF = (int)0L; - /** - * {@snippet lang=c : - * #define _IOFBF 0 - * } - */ - public static int _IOFBF() { - return _IOFBF; - } - private static final int _IOLBF = (int)1L; - /** - * {@snippet lang=c : - * #define _IOLBF 1 - * } - */ - public static int _IOLBF() { - return _IOLBF; - } - private static final int _IONBF = (int)2L; - /** - * {@snippet lang=c : - * #define _IONBF 2 - * } - */ - public static int _IONBF() { - return _IONBF; - } - private static final int BUFSIZ = (int)1024L; - /** - * {@snippet lang=c : - * #define BUFSIZ 1024 - * } - */ - public static int BUFSIZ() { - return BUFSIZ; - } - private static final int FOPEN_MAX = (int)20L; - /** - * {@snippet lang=c : - * #define FOPEN_MAX 20 - * } - */ - public static int FOPEN_MAX() { - return FOPEN_MAX; - } - private static final int FILENAME_MAX = (int)1024L; - /** - * {@snippet lang=c : - * #define FILENAME_MAX 1024 - * } - */ - public static int FILENAME_MAX() { - return FILENAME_MAX; - } - private static final int L_tmpnam = (int)1024L; - /** - * {@snippet lang=c : - * #define L_tmpnam 1024 - * } - */ - public static int L_tmpnam() { - return L_tmpnam; - } - private static final int TMP_MAX = (int)308915776L; - /** - * {@snippet lang=c : - * #define TMP_MAX 308915776 - * } - */ - public static int TMP_MAX() { - return TMP_MAX; - } - private static final int L_ctermid = (int)1024L; - /** - * {@snippet lang=c : - * #define L_ctermid 1024 - * } - */ - public static int L_ctermid() { - return L_ctermid; - } - private static final int _USE_FORTIFY_LEVEL = (int)2L; - /** - * {@snippet lang=c : - * #define _USE_FORTIFY_LEVEL 2 - * } - */ - public static int _USE_FORTIFY_LEVEL() { - return _USE_FORTIFY_LEVEL; - } - - private static class __assert_rtn { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("__assert_rtn"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void __assert_rtn(const char *, const char *, int, const char *) - * } - */ - public static FunctionDescriptor __assert_rtn$descriptor() { - return __assert_rtn.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void __assert_rtn(const char *, const char *, int, const char *) - * } - */ - public static MethodHandle __assert_rtn$handle() { - return __assert_rtn.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void __assert_rtn(const char *, const char *, int, const char *) - * } - */ - public static MemorySegment __assert_rtn$address() { - return __assert_rtn.ADDR; - } - - /** - * {@snippet lang=c : - * void __assert_rtn(const char *, const char *, int, const char *) - * } - */ - public static void __assert_rtn(MemorySegment x0, MemorySegment x1, int x2, MemorySegment x3) { - var mh$ = __assert_rtn.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__assert_rtn", x0, x1, x2, x3); - } - mh$.invokeExact(x0, x1, x2, x3); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet lang=c : - * typedef long ptrdiff_t - * } - */ - public static final OfLong ptrdiff_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long size_t - * } - */ - public static final OfLong size_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long rsize_t - * } - */ - public static final OfLong rsize_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef int wchar_t - * } - */ - public static final OfInt wchar_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef signed char int8_t - * } - */ - public static final OfByte int8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef short int16_t - * } - */ - public static final OfShort int16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef int int32_t - * } - */ - public static final OfInt int32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef long long int64_t - * } - */ - public static final OfLong int64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned char uint8_t - * } - */ - public static final OfByte uint8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef unsigned short uint16_t - * } - */ - public static final OfShort uint16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef unsigned int uint32_t - * } - */ - public static final OfInt uint32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long long uint64_t - * } - */ - public static final OfLong uint64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int8_t int_least8_t - * } - */ - public static final OfByte int_least8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef int16_t int_least16_t - * } - */ - public static final OfShort int_least16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef int32_t int_least32_t - * } - */ - public static final OfInt int_least32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef int64_t int_least64_t - * } - */ - public static final OfLong int_least64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef uint8_t uint_least8_t - * } - */ - public static final OfByte uint_least8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef uint16_t uint_least16_t - * } - */ - public static final OfShort uint_least16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef uint32_t uint_least32_t - * } - */ - public static final OfInt uint_least32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef uint64_t uint_least64_t - * } - */ - public static final OfLong uint_least64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int8_t int_fast8_t - * } - */ - public static final OfByte int_fast8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef int16_t int_fast16_t - * } - */ - public static final OfShort int_fast16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef int32_t int_fast32_t - * } - */ - public static final OfInt int_fast32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef int64_t int_fast64_t - * } - */ - public static final OfLong int_fast64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef uint8_t uint_fast8_t - * } - */ - public static final OfByte uint_fast8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef uint16_t uint_fast16_t - * } - */ - public static final OfShort uint_fast16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef uint32_t uint_fast32_t - * } - */ - public static final OfInt uint_fast32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef uint64_t uint_fast64_t - * } - */ - public static final OfLong uint_fast64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef signed char __int8_t - * } - */ - public static final OfByte __int8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef unsigned char __uint8_t - * } - */ - public static final OfByte __uint8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef short __int16_t - * } - */ - public static final OfShort __int16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef unsigned short __uint16_t - * } - */ - public static final OfShort __uint16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef int __int32_t - * } - */ - public static final OfInt __int32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned int __uint32_t - * } - */ - public static final OfInt __uint32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef long long __int64_t - * } - */ - public static final OfLong __int64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long long __uint64_t - * } - */ - public static final OfLong __uint64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef long __darwin_intptr_t - * } - */ - public static final OfLong __darwin_intptr_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef unsigned int __darwin_natural_t - * } - */ - public static final OfInt __darwin_natural_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef int __darwin_ct_rune_t - * } - */ - public static final OfInt __darwin_ct_rune_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef long __darwin_ptrdiff_t - * } - */ - public static final OfLong __darwin_ptrdiff_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long __darwin_size_t - * } - */ - public static final OfLong __darwin_size_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef __builtin_va_list __darwin_va_list - * } - */ - public static final AddressLayout __darwin_va_list = somelib_h.C_POINTER; - /** - * {@snippet lang=c : - * typedef int __darwin_wchar_t - * } - */ - public static final OfInt __darwin_wchar_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __darwin_wchar_t __darwin_rune_t - * } - */ - public static final OfInt __darwin_rune_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef int __darwin_wint_t - * } - */ - public static final OfInt __darwin_wint_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long __darwin_clock_t - * } - */ - public static final OfLong __darwin_clock_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_socklen_t - * } - */ - public static final OfInt __darwin_socklen_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef long __darwin_ssize_t - * } - */ - public static final OfLong __darwin_ssize_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef long __darwin_time_t - * } - */ - public static final OfLong __darwin_time_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef __int64_t __darwin_blkcnt_t - * } - */ - public static final OfLong __darwin_blkcnt_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef __int32_t __darwin_blksize_t - * } - */ - public static final OfInt __darwin_blksize_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __int32_t __darwin_dev_t - * } - */ - public static final OfInt __darwin_dev_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned int __darwin_fsblkcnt_t - * } - */ - public static final OfInt __darwin_fsblkcnt_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned int __darwin_fsfilcnt_t - * } - */ - public static final OfInt __darwin_fsfilcnt_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_gid_t - * } - */ - public static final OfInt __darwin_gid_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_id_t - * } - */ - public static final OfInt __darwin_id_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint64_t __darwin_ino64_t - * } - */ - public static final OfLong __darwin_ino64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef __darwin_ino64_t __darwin_ino_t - * } - */ - public static final OfLong __darwin_ino_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef __darwin_natural_t __darwin_mach_port_name_t - * } - */ - public static final OfInt __darwin_mach_port_name_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __darwin_mach_port_name_t __darwin_mach_port_t - * } - */ - public static final OfInt __darwin_mach_port_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint16_t __darwin_mode_t - * } - */ - public static final OfShort __darwin_mode_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef __int64_t __darwin_off_t - * } - */ - public static final OfLong __darwin_off_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef __int32_t __darwin_pid_t - * } - */ - public static final OfInt __darwin_pid_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_sigset_t - * } - */ - public static final OfInt __darwin_sigset_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __int32_t __darwin_suseconds_t - * } - */ - public static final OfInt __darwin_suseconds_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_uid_t - * } - */ - public static final OfInt __darwin_uid_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_useconds_t - * } - */ - public static final OfInt __darwin_useconds_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long __darwin_pthread_key_t - * } - */ - public static final OfLong __darwin_pthread_key_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef struct _opaque_pthread_t { - * long __sig; - * struct __darwin_pthread_handler_rec *__cleanup_stack; - * char __opaque[8176]; - * } *__darwin_pthread_t - * } - */ - public static final AddressLayout __darwin_pthread_t = somelib_h.C_POINTER; - /** - * {@snippet lang=c : - * typedef unsigned char u_int8_t - * } - */ - public static final OfByte u_int8_t = somelib_h.C_CHAR; - /** - * {@snippet lang=c : - * typedef unsigned short u_int16_t - * } - */ - public static final OfShort u_int16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef unsigned int u_int32_t - * } - */ - public static final OfInt u_int32_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef unsigned long long u_int64_t - * } - */ - public static final OfLong u_int64_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int64_t register_t - * } - */ - public static final OfLong register_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long uintptr_t - * } - */ - public static final OfLong uintptr_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef u_int64_t user_addr_t - * } - */ - public static final OfLong user_addr_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef u_int64_t user_size_t - * } - */ - public static final OfLong user_size_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int64_t user_ssize_t - * } - */ - public static final OfLong user_ssize_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int64_t user_long_t - * } - */ - public static final OfLong user_long_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef u_int64_t user_ulong_t - * } - */ - public static final OfLong user_ulong_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int64_t user_time_t - * } - */ - public static final OfLong user_time_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef int64_t user_off_t - * } - */ - public static final OfLong user_off_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef u_int64_t syscall_arg_t - * } - */ - public static final OfLong syscall_arg_t = somelib_h.C_LONG_LONG; - /** - * {@snippet lang=c : - * typedef __darwin_intptr_t intptr_t - * } - */ - public static final OfLong intptr_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef long intmax_t - * } - */ - public static final OfLong intmax_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef unsigned long uintmax_t - * } - */ - public static final OfLong uintmax_t = somelib_h.C_LONG; - /** - * {@snippet lang=c : - * typedef uint_least16_t char16_t - * } - */ - public static final OfShort char16_t = somelib_h.C_SHORT; - /** - * {@snippet lang=c : - * typedef uint_least32_t char32_t - * } - */ - public static final OfInt char32_t = somelib_h.C_INT; - - private static class diplomat_is_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_BOOL, - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("diplomat_is_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * bool diplomat_is_str(const char *buf, size_t len) - * } - */ - public static FunctionDescriptor diplomat_is_str$descriptor() { - return diplomat_is_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * bool diplomat_is_str(const char *buf, size_t len) - * } - */ - public static MethodHandle diplomat_is_str$handle() { - return diplomat_is_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * bool diplomat_is_str(const char *buf, size_t len) - * } - */ - public static MemorySegment diplomat_is_str$address() { - return diplomat_is_str.ADDR; - } - - /** - * {@snippet lang=c : - * bool diplomat_is_str(const char *buf, size_t len) - * } - */ - public static boolean diplomat_is_str(MemorySegment buf, long len) { - var mh$ = diplomat_is_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("diplomat_is_str", buf, len); - } - return (boolean)mh$.invokeExact(buf, len); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class diplomat_simple_write { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - DiplomatWrite.layout(), - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("diplomat_simple_write"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * DiplomatWrite diplomat_simple_write(char *buf, size_t buf_size) - * } - */ - public static FunctionDescriptor diplomat_simple_write$descriptor() { - return diplomat_simple_write.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * DiplomatWrite diplomat_simple_write(char *buf, size_t buf_size) - * } - */ - public static MethodHandle diplomat_simple_write$handle() { - return diplomat_simple_write.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * DiplomatWrite diplomat_simple_write(char *buf, size_t buf_size) - * } - */ - public static MemorySegment diplomat_simple_write$address() { - return diplomat_simple_write.ADDR; - } - - /** - * {@snippet lang=c : - * DiplomatWrite diplomat_simple_write(char *buf, size_t buf_size) - * } - */ - public static MemorySegment diplomat_simple_write(SegmentAllocator allocator, MemorySegment buf, long buf_size) { - var mh$ = diplomat_simple_write.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("diplomat_simple_write", allocator, buf, buf_size); - } - return (MemorySegment)mh$.invokeExact(allocator, buf, buf_size); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class diplomat_buffer_write_create { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("diplomat_buffer_write_create"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * DiplomatWrite *diplomat_buffer_write_create(size_t cap) - * } - */ - public static FunctionDescriptor diplomat_buffer_write_create$descriptor() { - return diplomat_buffer_write_create.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * DiplomatWrite *diplomat_buffer_write_create(size_t cap) - * } - */ - public static MethodHandle diplomat_buffer_write_create$handle() { - return diplomat_buffer_write_create.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * DiplomatWrite *diplomat_buffer_write_create(size_t cap) - * } - */ - public static MemorySegment diplomat_buffer_write_create$address() { - return diplomat_buffer_write_create.ADDR; - } - - /** - * {@snippet lang=c : - * DiplomatWrite *diplomat_buffer_write_create(size_t cap) - * } - */ - public static MemorySegment diplomat_buffer_write_create(long cap) { - var mh$ = diplomat_buffer_write_create.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("diplomat_buffer_write_create", cap); - } - return (MemorySegment)mh$.invokeExact(cap); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class diplomat_buffer_write_get_bytes { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("diplomat_buffer_write_get_bytes"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *diplomat_buffer_write_get_bytes(DiplomatWrite *t) - * } - */ - public static FunctionDescriptor diplomat_buffer_write_get_bytes$descriptor() { - return diplomat_buffer_write_get_bytes.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *diplomat_buffer_write_get_bytes(DiplomatWrite *t) - * } - */ - public static MethodHandle diplomat_buffer_write_get_bytes$handle() { - return diplomat_buffer_write_get_bytes.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *diplomat_buffer_write_get_bytes(DiplomatWrite *t) - * } - */ - public static MemorySegment diplomat_buffer_write_get_bytes$address() { - return diplomat_buffer_write_get_bytes.ADDR; - } - - /** - * {@snippet lang=c : - * char *diplomat_buffer_write_get_bytes(DiplomatWrite *t) - * } - */ - public static MemorySegment diplomat_buffer_write_get_bytes(MemorySegment t) { - var mh$ = diplomat_buffer_write_get_bytes.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("diplomat_buffer_write_get_bytes", t); - } - return (MemorySegment)mh$.invokeExact(t); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class diplomat_buffer_write_len { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("diplomat_buffer_write_len"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t diplomat_buffer_write_len(DiplomatWrite *t) - * } - */ - public static FunctionDescriptor diplomat_buffer_write_len$descriptor() { - return diplomat_buffer_write_len.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t diplomat_buffer_write_len(DiplomatWrite *t) - * } - */ - public static MethodHandle diplomat_buffer_write_len$handle() { - return diplomat_buffer_write_len.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t diplomat_buffer_write_len(DiplomatWrite *t) - * } - */ - public static MemorySegment diplomat_buffer_write_len$address() { - return diplomat_buffer_write_len.ADDR; - } - - /** - * {@snippet lang=c : - * size_t diplomat_buffer_write_len(DiplomatWrite *t) - * } - */ - public static long diplomat_buffer_write_len(MemorySegment t) { - var mh$ = diplomat_buffer_write_len.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("diplomat_buffer_write_len", t); - } - return (long)mh$.invokeExact(t); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class diplomat_buffer_write_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("diplomat_buffer_write_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void diplomat_buffer_write_destroy(DiplomatWrite *t) - * } - */ - public static FunctionDescriptor diplomat_buffer_write_destroy$descriptor() { - return diplomat_buffer_write_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void diplomat_buffer_write_destroy(DiplomatWrite *t) - * } - */ - public static MethodHandle diplomat_buffer_write_destroy$handle() { - return diplomat_buffer_write_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void diplomat_buffer_write_destroy(DiplomatWrite *t) - * } - */ - public static MemorySegment diplomat_buffer_write_destroy$address() { - return diplomat_buffer_write_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void diplomat_buffer_write_destroy(DiplomatWrite *t) - * } - */ - public static void diplomat_buffer_write_destroy(MemorySegment t) { - var mh$ = diplomat_buffer_write_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("diplomat_buffer_write_destroy", t); - } - mh$.invokeExact(t); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet lang=c : - * typedef int __darwin_nl_item - * } - */ - public static final OfInt __darwin_nl_item = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef int __darwin_wctrans_t - * } - */ - public static final OfInt __darwin_wctrans_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __uint32_t __darwin_wctype_t - * } - */ - public static final OfInt __darwin_wctype_t = somelib_h.C_INT; - /** - * {@snippet lang=c : - * typedef __darwin_va_list va_list - * } - */ - public static final AddressLayout va_list = somelib_h.C_POINTER; - - private static class renameat { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("renameat"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int renameat(int, const char *, int, const char *) - * } - */ - public static FunctionDescriptor renameat$descriptor() { - return renameat.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int renameat(int, const char *, int, const char *) - * } - */ - public static MethodHandle renameat$handle() { - return renameat.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int renameat(int, const char *, int, const char *) - * } - */ - public static MemorySegment renameat$address() { - return renameat.ADDR; - } - - /** - * {@snippet lang=c : - * int renameat(int, const char *, int, const char *) - * } - */ - public static int renameat(int x0, MemorySegment x1, int x2, MemorySegment x3) { - var mh$ = renameat.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("renameat", x0, x1, x2, x3); - } - return (int)mh$.invokeExact(x0, x1, x2, x3); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class renamex_np { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("renamex_np"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int renamex_np(const char *, const char *, unsigned int) - * } - */ - public static FunctionDescriptor renamex_np$descriptor() { - return renamex_np.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int renamex_np(const char *, const char *, unsigned int) - * } - */ - public static MethodHandle renamex_np$handle() { - return renamex_np.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int renamex_np(const char *, const char *, unsigned int) - * } - */ - public static MemorySegment renamex_np$address() { - return renamex_np.ADDR; - } - - /** - * {@snippet lang=c : - * int renamex_np(const char *, const char *, unsigned int) - * } - */ - public static int renamex_np(MemorySegment x0, MemorySegment x1, int x2) { - var mh$ = renamex_np.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("renamex_np", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class renameatx_np { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("renameatx_np"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int renameatx_np(int, const char *, int, const char *, unsigned int) - * } - */ - public static FunctionDescriptor renameatx_np$descriptor() { - return renameatx_np.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int renameatx_np(int, const char *, int, const char *, unsigned int) - * } - */ - public static MethodHandle renameatx_np$handle() { - return renameatx_np.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int renameatx_np(int, const char *, int, const char *, unsigned int) - * } - */ - public static MemorySegment renameatx_np$address() { - return renameatx_np.ADDR; - } - - /** - * {@snippet lang=c : - * int renameatx_np(int, const char *, int, const char *, unsigned int) - * } - */ - public static int renameatx_np(int x0, MemorySegment x1, int x2, MemorySegment x3, int x4) { - var mh$ = renameatx_np.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("renameatx_np", x0, x1, x2, x3, x4); - } - return (int)mh$.invokeExact(x0, x1, x2, x3, x4); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet lang=c : - * typedef __darwin_off_t fpos_t - * } - */ - public static final OfLong fpos_t = somelib_h.C_LONG_LONG; - - private static class __stdinp$constants { - public static final AddressLayout LAYOUT = somelib_h.C_POINTER; - public static final MemorySegment SEGMENT = somelib_h.findOrThrow("__stdinp").reinterpret(LAYOUT.byteSize()); - } - - /** - * Layout for variable: - * {@snippet lang=c : - * extern FILE *__stdinp - * } - */ - public static AddressLayout __stdinp$layout() { - return __stdinp$constants.LAYOUT; - } - - /** - * Segment for variable: - * {@snippet lang=c : - * extern FILE *__stdinp - * } - */ - public static MemorySegment __stdinp$segment() { - return __stdinp$constants.SEGMENT; - } - - /** - * Getter for variable: - * {@snippet lang=c : - * extern FILE *__stdinp - * } - */ - public static MemorySegment __stdinp() { - return __stdinp$constants.SEGMENT.get(__stdinp$constants.LAYOUT, 0L); - } - - /** - * Setter for variable: - * {@snippet lang=c : - * extern FILE *__stdinp - * } - */ - public static void __stdinp(MemorySegment varValue) { - __stdinp$constants.SEGMENT.set(__stdinp$constants.LAYOUT, 0L, varValue); - } - - private static class __stdoutp$constants { - public static final AddressLayout LAYOUT = somelib_h.C_POINTER; - public static final MemorySegment SEGMENT = somelib_h.findOrThrow("__stdoutp").reinterpret(LAYOUT.byteSize()); - } - - /** - * Layout for variable: - * {@snippet lang=c : - * extern FILE *__stdoutp - * } - */ - public static AddressLayout __stdoutp$layout() { - return __stdoutp$constants.LAYOUT; - } - - /** - * Segment for variable: - * {@snippet lang=c : - * extern FILE *__stdoutp - * } - */ - public static MemorySegment __stdoutp$segment() { - return __stdoutp$constants.SEGMENT; - } - - /** - * Getter for variable: - * {@snippet lang=c : - * extern FILE *__stdoutp - * } - */ - public static MemorySegment __stdoutp() { - return __stdoutp$constants.SEGMENT.get(__stdoutp$constants.LAYOUT, 0L); - } - - /** - * Setter for variable: - * {@snippet lang=c : - * extern FILE *__stdoutp - * } - */ - public static void __stdoutp(MemorySegment varValue) { - __stdoutp$constants.SEGMENT.set(__stdoutp$constants.LAYOUT, 0L, varValue); - } - - private static class __stderrp$constants { - public static final AddressLayout LAYOUT = somelib_h.C_POINTER; - public static final MemorySegment SEGMENT = somelib_h.findOrThrow("__stderrp").reinterpret(LAYOUT.byteSize()); - } - - /** - * Layout for variable: - * {@snippet lang=c : - * extern FILE *__stderrp - * } - */ - public static AddressLayout __stderrp$layout() { - return __stderrp$constants.LAYOUT; - } - - /** - * Segment for variable: - * {@snippet lang=c : - * extern FILE *__stderrp - * } - */ - public static MemorySegment __stderrp$segment() { - return __stderrp$constants.SEGMENT; - } - - /** - * Getter for variable: - * {@snippet lang=c : - * extern FILE *__stderrp - * } - */ - public static MemorySegment __stderrp() { - return __stderrp$constants.SEGMENT.get(__stderrp$constants.LAYOUT, 0L); - } - - /** - * Setter for variable: - * {@snippet lang=c : - * extern FILE *__stderrp - * } - */ - public static void __stderrp(MemorySegment varValue) { - __stderrp$constants.SEGMENT.set(__stderrp$constants.LAYOUT, 0L, varValue); - } - - private static class clearerr { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("clearerr"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void clearerr(FILE *) - * } - */ - public static FunctionDescriptor clearerr$descriptor() { - return clearerr.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void clearerr(FILE *) - * } - */ - public static MethodHandle clearerr$handle() { - return clearerr.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void clearerr(FILE *) - * } - */ - public static MemorySegment clearerr$address() { - return clearerr.ADDR; - } - - /** - * {@snippet lang=c : - * void clearerr(FILE *) - * } - */ - public static void clearerr(MemorySegment x0) { - var mh$ = clearerr.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("clearerr", x0); - } - mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fclose { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fclose"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fclose(FILE *) - * } - */ - public static FunctionDescriptor fclose$descriptor() { - return fclose.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fclose(FILE *) - * } - */ - public static MethodHandle fclose$handle() { - return fclose.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fclose(FILE *) - * } - */ - public static MemorySegment fclose$address() { - return fclose.ADDR; - } - - /** - * {@snippet lang=c : - * int fclose(FILE *) - * } - */ - public static int fclose(MemorySegment x0) { - var mh$ = fclose.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fclose", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class feof { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("feof"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int feof(FILE *) - * } - */ - public static FunctionDescriptor feof$descriptor() { - return feof.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int feof(FILE *) - * } - */ - public static MethodHandle feof$handle() { - return feof.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int feof(FILE *) - * } - */ - public static MemorySegment feof$address() { - return feof.ADDR; - } - - /** - * {@snippet lang=c : - * int feof(FILE *) - * } - */ - public static int feof(MemorySegment x0) { - var mh$ = feof.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("feof", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class ferror { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ferror"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int ferror(FILE *) - * } - */ - public static FunctionDescriptor ferror$descriptor() { - return ferror.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int ferror(FILE *) - * } - */ - public static MethodHandle ferror$handle() { - return ferror.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int ferror(FILE *) - * } - */ - public static MemorySegment ferror$address() { - return ferror.ADDR; - } - - /** - * {@snippet lang=c : - * int ferror(FILE *) - * } - */ - public static int ferror(MemorySegment x0) { - var mh$ = ferror.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ferror", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fflush { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fflush"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fflush(FILE *) - * } - */ - public static FunctionDescriptor fflush$descriptor() { - return fflush.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fflush(FILE *) - * } - */ - public static MethodHandle fflush$handle() { - return fflush.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fflush(FILE *) - * } - */ - public static MemorySegment fflush$address() { - return fflush.ADDR; - } - - /** - * {@snippet lang=c : - * int fflush(FILE *) - * } - */ - public static int fflush(MemorySegment x0) { - var mh$ = fflush.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fflush", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fgetc { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fgetc"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fgetc(FILE *) - * } - */ - public static FunctionDescriptor fgetc$descriptor() { - return fgetc.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fgetc(FILE *) - * } - */ - public static MethodHandle fgetc$handle() { - return fgetc.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fgetc(FILE *) - * } - */ - public static MemorySegment fgetc$address() { - return fgetc.ADDR; - } - - /** - * {@snippet lang=c : - * int fgetc(FILE *) - * } - */ - public static int fgetc(MemorySegment x0) { - var mh$ = fgetc.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fgetc", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fgetpos { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fgetpos"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fgetpos(FILE *restrict, fpos_t *) - * } - */ - public static FunctionDescriptor fgetpos$descriptor() { - return fgetpos.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fgetpos(FILE *restrict, fpos_t *) - * } - */ - public static MethodHandle fgetpos$handle() { - return fgetpos.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fgetpos(FILE *restrict, fpos_t *) - * } - */ - public static MemorySegment fgetpos$address() { - return fgetpos.ADDR; - } - - /** - * {@snippet lang=c : - * int fgetpos(FILE *restrict, fpos_t *) - * } - */ - public static int fgetpos(MemorySegment x0, MemorySegment x1) { - var mh$ = fgetpos.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fgetpos", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fgets { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fgets"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *fgets(char *restrict, int, FILE *) - * } - */ - public static FunctionDescriptor fgets$descriptor() { - return fgets.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *fgets(char *restrict, int, FILE *) - * } - */ - public static MethodHandle fgets$handle() { - return fgets.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *fgets(char *restrict, int, FILE *) - * } - */ - public static MemorySegment fgets$address() { - return fgets.ADDR; - } - - /** - * {@snippet lang=c : - * char *fgets(char *restrict, int, FILE *) - * } - */ - public static MemorySegment fgets(MemorySegment x0, int x1, MemorySegment x2) { - var mh$ = fgets.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fgets", x0, x1, x2); - } - return (MemorySegment)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fopen { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fopen"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *fopen(const char *restrict __filename, const char *restrict __mode) - * } - */ - public static FunctionDescriptor fopen$descriptor() { - return fopen.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *fopen(const char *restrict __filename, const char *restrict __mode) - * } - */ - public static MethodHandle fopen$handle() { - return fopen.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *fopen(const char *restrict __filename, const char *restrict __mode) - * } - */ - public static MemorySegment fopen$address() { - return fopen.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *fopen(const char *restrict __filename, const char *restrict __mode) - * } - */ - public static MemorySegment fopen(MemorySegment __filename, MemorySegment __mode) { - var mh$ = fopen.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fopen", __filename, __mode); - } - return (MemorySegment)mh$.invokeExact(__filename, __mode); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int fprintf(FILE *restrict, const char *restrict, ...) - * } - */ - public static class fprintf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("fprintf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private fprintf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int fprintf(FILE *restrict, const char *restrict, ...) - * } - */ - public static fprintf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new fprintf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, MemorySegment x1, Object... x2) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fprintf", x0, x1, x2); - } - return (int)spreader.invokeExact(x0, x1, x2); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class fputc { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fputc"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fputc(int, FILE *) - * } - */ - public static FunctionDescriptor fputc$descriptor() { - return fputc.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fputc(int, FILE *) - * } - */ - public static MethodHandle fputc$handle() { - return fputc.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fputc(int, FILE *) - * } - */ - public static MemorySegment fputc$address() { - return fputc.ADDR; - } - - /** - * {@snippet lang=c : - * int fputc(int, FILE *) - * } - */ - public static int fputc(int x0, MemorySegment x1) { - var mh$ = fputc.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fputc", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fputs { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fputs"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fputs(const char *restrict, FILE *restrict) - * } - */ - public static FunctionDescriptor fputs$descriptor() { - return fputs.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fputs(const char *restrict, FILE *restrict) - * } - */ - public static MethodHandle fputs$handle() { - return fputs.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fputs(const char *restrict, FILE *restrict) - * } - */ - public static MemorySegment fputs$address() { - return fputs.ADDR; - } - - /** - * {@snippet lang=c : - * int fputs(const char *restrict, FILE *restrict) - * } - */ - public static int fputs(MemorySegment x0, MemorySegment x1) { - var mh$ = fputs.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fputs", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fread { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fread"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * unsigned long fread(void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static FunctionDescriptor fread$descriptor() { - return fread.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * unsigned long fread(void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static MethodHandle fread$handle() { - return fread.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * unsigned long fread(void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static MemorySegment fread$address() { - return fread.ADDR; - } - - /** - * {@snippet lang=c : - * unsigned long fread(void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static long fread(MemorySegment __ptr, long __size, long __nitems, MemorySegment __stream) { - var mh$ = fread.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fread", __ptr, __size, __nitems, __stream); - } - return (long)mh$.invokeExact(__ptr, __size, __nitems, __stream); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class freopen { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("freopen"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *freopen(const char *restrict, const char *restrict, FILE *restrict) - * } - */ - public static FunctionDescriptor freopen$descriptor() { - return freopen.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *freopen(const char *restrict, const char *restrict, FILE *restrict) - * } - */ - public static MethodHandle freopen$handle() { - return freopen.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *freopen(const char *restrict, const char *restrict, FILE *restrict) - * } - */ - public static MemorySegment freopen$address() { - return freopen.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *freopen(const char *restrict, const char *restrict, FILE *restrict) - * } - */ - public static MemorySegment freopen(MemorySegment x0, MemorySegment x1, MemorySegment x2) { - var mh$ = freopen.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("freopen", x0, x1, x2); - } - return (MemorySegment)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int fscanf(FILE *restrict, const char *restrict, ...) - * } - */ - public static class fscanf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("fscanf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private fscanf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int fscanf(FILE *restrict, const char *restrict, ...) - * } - */ - public static fscanf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new fscanf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, MemorySegment x1, Object... x2) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fscanf", x0, x1, x2); - } - return (int)spreader.invokeExact(x0, x1, x2); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class fseek { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fseek"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fseek(FILE *, long, int) - * } - */ - public static FunctionDescriptor fseek$descriptor() { - return fseek.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fseek(FILE *, long, int) - * } - */ - public static MethodHandle fseek$handle() { - return fseek.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fseek(FILE *, long, int) - * } - */ - public static MemorySegment fseek$address() { - return fseek.ADDR; - } - - /** - * {@snippet lang=c : - * int fseek(FILE *, long, int) - * } - */ - public static int fseek(MemorySegment x0, long x1, int x2) { - var mh$ = fseek.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fseek", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fsetpos { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fsetpos"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fsetpos(FILE *, const fpos_t *) - * } - */ - public static FunctionDescriptor fsetpos$descriptor() { - return fsetpos.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fsetpos(FILE *, const fpos_t *) - * } - */ - public static MethodHandle fsetpos$handle() { - return fsetpos.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fsetpos(FILE *, const fpos_t *) - * } - */ - public static MemorySegment fsetpos$address() { - return fsetpos.ADDR; - } - - /** - * {@snippet lang=c : - * int fsetpos(FILE *, const fpos_t *) - * } - */ - public static int fsetpos(MemorySegment x0, MemorySegment x1) { - var mh$ = fsetpos.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fsetpos", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class ftell { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ftell"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * long ftell(FILE *) - * } - */ - public static FunctionDescriptor ftell$descriptor() { - return ftell.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * long ftell(FILE *) - * } - */ - public static MethodHandle ftell$handle() { - return ftell.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * long ftell(FILE *) - * } - */ - public static MemorySegment ftell$address() { - return ftell.ADDR; - } - - /** - * {@snippet lang=c : - * long ftell(FILE *) - * } - */ - public static long ftell(MemorySegment x0) { - var mh$ = ftell.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ftell", x0); - } - return (long)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fwrite { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fwrite"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * unsigned long fwrite(const void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static FunctionDescriptor fwrite$descriptor() { - return fwrite.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * unsigned long fwrite(const void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static MethodHandle fwrite$handle() { - return fwrite.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * unsigned long fwrite(const void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static MemorySegment fwrite$address() { - return fwrite.ADDR; - } - - /** - * {@snippet lang=c : - * unsigned long fwrite(const void *restrict __ptr, size_t __size, size_t __nitems, FILE *restrict __stream) - * } - */ - public static long fwrite(MemorySegment __ptr, long __size, long __nitems, MemorySegment __stream) { - var mh$ = fwrite.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fwrite", __ptr, __size, __nitems, __stream); - } - return (long)mh$.invokeExact(__ptr, __size, __nitems, __stream); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getc { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getc"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int getc(FILE *) - * } - */ - public static FunctionDescriptor getc$descriptor() { - return getc.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int getc(FILE *) - * } - */ - public static MethodHandle getc$handle() { - return getc.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int getc(FILE *) - * } - */ - public static MemorySegment getc$address() { - return getc.ADDR; - } - - /** - * {@snippet lang=c : - * int getc(FILE *) - * } - */ - public static int getc(MemorySegment x0) { - var mh$ = getc.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getc", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getchar { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getchar"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int getchar() - * } - */ - public static FunctionDescriptor getchar$descriptor() { - return getchar.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int getchar() - * } - */ - public static MethodHandle getchar$handle() { - return getchar.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int getchar() - * } - */ - public static MemorySegment getchar$address() { - return getchar.ADDR; - } - - /** - * {@snippet lang=c : - * int getchar() - * } - */ - public static int getchar() { - var mh$ = getchar.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getchar"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class gets { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("gets"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *gets(char *) - * } - */ - public static FunctionDescriptor gets$descriptor() { - return gets.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *gets(char *) - * } - */ - public static MethodHandle gets$handle() { - return gets.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *gets(char *) - * } - */ - public static MemorySegment gets$address() { - return gets.ADDR; - } - - /** - * {@snippet lang=c : - * char *gets(char *) - * } - */ - public static MemorySegment gets(MemorySegment x0) { - var mh$ = gets.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("gets", x0); - } - return (MemorySegment)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class perror { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("perror"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void perror(const char *) - * } - */ - public static FunctionDescriptor perror$descriptor() { - return perror.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void perror(const char *) - * } - */ - public static MethodHandle perror$handle() { - return perror.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void perror(const char *) - * } - */ - public static MemorySegment perror$address() { - return perror.ADDR; - } - - /** - * {@snippet lang=c : - * void perror(const char *) - * } - */ - public static void perror(MemorySegment x0) { - var mh$ = perror.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("perror", x0); - } - mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int printf(const char *restrict, ...) - * } - */ - public static class printf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("printf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private printf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int printf(const char *restrict, ...) - * } - */ - public static printf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new printf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, Object... x1) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("printf", x0, x1); - } - return (int)spreader.invokeExact(x0, x1); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class putc { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("putc"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int putc(int, FILE *) - * } - */ - public static FunctionDescriptor putc$descriptor() { - return putc.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int putc(int, FILE *) - * } - */ - public static MethodHandle putc$handle() { - return putc.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int putc(int, FILE *) - * } - */ - public static MemorySegment putc$address() { - return putc.ADDR; - } - - /** - * {@snippet lang=c : - * int putc(int, FILE *) - * } - */ - public static int putc(int x0, MemorySegment x1) { - var mh$ = putc.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("putc", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class putchar { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("putchar"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int putchar(int) - * } - */ - public static FunctionDescriptor putchar$descriptor() { - return putchar.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int putchar(int) - * } - */ - public static MethodHandle putchar$handle() { - return putchar.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int putchar(int) - * } - */ - public static MemorySegment putchar$address() { - return putchar.ADDR; - } - - /** - * {@snippet lang=c : - * int putchar(int) - * } - */ - public static int putchar(int x0) { - var mh$ = putchar.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("putchar", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class puts { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("puts"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int puts(const char *) - * } - */ - public static FunctionDescriptor puts$descriptor() { - return puts.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int puts(const char *) - * } - */ - public static MethodHandle puts$handle() { - return puts.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int puts(const char *) - * } - */ - public static MemorySegment puts$address() { - return puts.ADDR; - } - - /** - * {@snippet lang=c : - * int puts(const char *) - * } - */ - public static int puts(MemorySegment x0) { - var mh$ = puts.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("puts", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class remove { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("remove"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int remove(const char *) - * } - */ - public static FunctionDescriptor remove$descriptor() { - return remove.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int remove(const char *) - * } - */ - public static MethodHandle remove$handle() { - return remove.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int remove(const char *) - * } - */ - public static MemorySegment remove$address() { - return remove.ADDR; - } - - /** - * {@snippet lang=c : - * int remove(const char *) - * } - */ - public static int remove(MemorySegment x0) { - var mh$ = remove.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("remove", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class rename { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("rename"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int rename(const char *__old, const char *__new) - * } - */ - public static FunctionDescriptor rename$descriptor() { - return rename.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int rename(const char *__old, const char *__new) - * } - */ - public static MethodHandle rename$handle() { - return rename.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int rename(const char *__old, const char *__new) - * } - */ - public static MemorySegment rename$address() { - return rename.ADDR; - } - - /** - * {@snippet lang=c : - * int rename(const char *__old, const char *__new) - * } - */ - public static int rename(MemorySegment __old, MemorySegment __new) { - var mh$ = rename.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("rename", __old, __new); - } - return (int)mh$.invokeExact(__old, __new); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class rewind { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("rewind"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void rewind(FILE *) - * } - */ - public static FunctionDescriptor rewind$descriptor() { - return rewind.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void rewind(FILE *) - * } - */ - public static MethodHandle rewind$handle() { - return rewind.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void rewind(FILE *) - * } - */ - public static MemorySegment rewind$address() { - return rewind.ADDR; - } - - /** - * {@snippet lang=c : - * void rewind(FILE *) - * } - */ - public static void rewind(MemorySegment x0) { - var mh$ = rewind.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("rewind", x0); - } - mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int scanf(const char *restrict, ...) - * } - */ - public static class scanf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("scanf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private scanf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int scanf(const char *restrict, ...) - * } - */ - public static scanf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new scanf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, Object... x1) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("scanf", x0, x1); - } - return (int)spreader.invokeExact(x0, x1); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class setbuf { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("setbuf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void setbuf(FILE *restrict, char *restrict) - * } - */ - public static FunctionDescriptor setbuf$descriptor() { - return setbuf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void setbuf(FILE *restrict, char *restrict) - * } - */ - public static MethodHandle setbuf$handle() { - return setbuf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void setbuf(FILE *restrict, char *restrict) - * } - */ - public static MemorySegment setbuf$address() { - return setbuf.ADDR; - } - - /** - * {@snippet lang=c : - * void setbuf(FILE *restrict, char *restrict) - * } - */ - public static void setbuf(MemorySegment x0, MemorySegment x1) { - var mh$ = setbuf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("setbuf", x0, x1); - } - mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class setvbuf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("setvbuf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int setvbuf(FILE *restrict, char *restrict, int, size_t) - * } - */ - public static FunctionDescriptor setvbuf$descriptor() { - return setvbuf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int setvbuf(FILE *restrict, char *restrict, int, size_t) - * } - */ - public static MethodHandle setvbuf$handle() { - return setvbuf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int setvbuf(FILE *restrict, char *restrict, int, size_t) - * } - */ - public static MemorySegment setvbuf$address() { - return setvbuf.ADDR; - } - - /** - * {@snippet lang=c : - * int setvbuf(FILE *restrict, char *restrict, int, size_t) - * } - */ - public static int setvbuf(MemorySegment x0, MemorySegment x1, int x2, long x3) { - var mh$ = setvbuf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("setvbuf", x0, x1, x2, x3); - } - return (int)mh$.invokeExact(x0, x1, x2, x3); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int sprintf(char *restrict, const char *restrict, ...) - * } - */ - public static class sprintf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("sprintf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private sprintf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int sprintf(char *restrict, const char *restrict, ...) - * } - */ - public static sprintf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new sprintf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, MemorySegment x1, Object... x2) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sprintf", x0, x1, x2); - } - return (int)spreader.invokeExact(x0, x1, x2); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int sscanf(const char *restrict, const char *restrict, ...) - * } - */ - public static class sscanf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("sscanf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private sscanf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int sscanf(const char *restrict, const char *restrict, ...) - * } - */ - public static sscanf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new sscanf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, MemorySegment x1, Object... x2) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sscanf", x0, x1, x2); - } - return (int)spreader.invokeExact(x0, x1, x2); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class tmpfile { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("tmpfile"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *tmpfile() - * } - */ - public static FunctionDescriptor tmpfile$descriptor() { - return tmpfile.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *tmpfile() - * } - */ - public static MethodHandle tmpfile$handle() { - return tmpfile.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *tmpfile() - * } - */ - public static MemorySegment tmpfile$address() { - return tmpfile.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *tmpfile() - * } - */ - public static MemorySegment tmpfile() { - var mh$ = tmpfile.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("tmpfile"); - } - return (MemorySegment)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class tmpnam { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("tmpnam"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *tmpnam(char *) - * } - */ - public static FunctionDescriptor tmpnam$descriptor() { - return tmpnam.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *tmpnam(char *) - * } - */ - public static MethodHandle tmpnam$handle() { - return tmpnam.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *tmpnam(char *) - * } - */ - public static MemorySegment tmpnam$address() { - return tmpnam.ADDR; - } - - /** - * {@snippet lang=c : - * char *tmpnam(char *) - * } - */ - public static MemorySegment tmpnam(MemorySegment x0) { - var mh$ = tmpnam.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("tmpnam", x0); - } - return (MemorySegment)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class ungetc { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ungetc"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int ungetc(int, FILE *) - * } - */ - public static FunctionDescriptor ungetc$descriptor() { - return ungetc.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int ungetc(int, FILE *) - * } - */ - public static MethodHandle ungetc$handle() { - return ungetc.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int ungetc(int, FILE *) - * } - */ - public static MemorySegment ungetc$address() { - return ungetc.ADDR; - } - - /** - * {@snippet lang=c : - * int ungetc(int, FILE *) - * } - */ - public static int ungetc(int x0, MemorySegment x1) { - var mh$ = ungetc.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ungetc", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vfprintf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vfprintf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vfprintf(FILE *restrict, const char *restrict, va_list) - * } - */ - public static FunctionDescriptor vfprintf$descriptor() { - return vfprintf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vfprintf(FILE *restrict, const char *restrict, va_list) - * } - */ - public static MethodHandle vfprintf$handle() { - return vfprintf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vfprintf(FILE *restrict, const char *restrict, va_list) - * } - */ - public static MemorySegment vfprintf$address() { - return vfprintf.ADDR; - } - - /** - * {@snippet lang=c : - * int vfprintf(FILE *restrict, const char *restrict, va_list) - * } - */ - public static int vfprintf(MemorySegment x0, MemorySegment x1, MemorySegment x2) { - var mh$ = vfprintf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vfprintf", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vprintf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vprintf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vprintf(const char *restrict, va_list) - * } - */ - public static FunctionDescriptor vprintf$descriptor() { - return vprintf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vprintf(const char *restrict, va_list) - * } - */ - public static MethodHandle vprintf$handle() { - return vprintf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vprintf(const char *restrict, va_list) - * } - */ - public static MemorySegment vprintf$address() { - return vprintf.ADDR; - } - - /** - * {@snippet lang=c : - * int vprintf(const char *restrict, va_list) - * } - */ - public static int vprintf(MemorySegment x0, MemorySegment x1) { - var mh$ = vprintf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vprintf", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vsprintf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vsprintf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vsprintf(char *restrict, const char *restrict, va_list) - * } - */ - public static FunctionDescriptor vsprintf$descriptor() { - return vsprintf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vsprintf(char *restrict, const char *restrict, va_list) - * } - */ - public static MethodHandle vsprintf$handle() { - return vsprintf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vsprintf(char *restrict, const char *restrict, va_list) - * } - */ - public static MemorySegment vsprintf$address() { - return vsprintf.ADDR; - } - - /** - * {@snippet lang=c : - * int vsprintf(char *restrict, const char *restrict, va_list) - * } - */ - public static int vsprintf(MemorySegment x0, MemorySegment x1, MemorySegment x2) { - var mh$ = vsprintf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vsprintf", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class ctermid { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ctermid"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *ctermid(char *) - * } - */ - public static FunctionDescriptor ctermid$descriptor() { - return ctermid.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *ctermid(char *) - * } - */ - public static MethodHandle ctermid$handle() { - return ctermid.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *ctermid(char *) - * } - */ - public static MemorySegment ctermid$address() { - return ctermid.ADDR; - } - - /** - * {@snippet lang=c : - * char *ctermid(char *) - * } - */ - public static MemorySegment ctermid(MemorySegment x0) { - var mh$ = ctermid.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ctermid", x0); - } - return (MemorySegment)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fdopen { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fdopen"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *fdopen(int, const char *) - * } - */ - public static FunctionDescriptor fdopen$descriptor() { - return fdopen.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *fdopen(int, const char *) - * } - */ - public static MethodHandle fdopen$handle() { - return fdopen.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *fdopen(int, const char *) - * } - */ - public static MemorySegment fdopen$address() { - return fdopen.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *fdopen(int, const char *) - * } - */ - public static MemorySegment fdopen(int x0, MemorySegment x1) { - var mh$ = fdopen.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fdopen", x0, x1); - } - return (MemorySegment)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fileno { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fileno"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fileno(FILE *) - * } - */ - public static FunctionDescriptor fileno$descriptor() { - return fileno.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fileno(FILE *) - * } - */ - public static MethodHandle fileno$handle() { - return fileno.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fileno(FILE *) - * } - */ - public static MemorySegment fileno$address() { - return fileno.ADDR; - } - - /** - * {@snippet lang=c : - * int fileno(FILE *) - * } - */ - public static int fileno(MemorySegment x0) { - var mh$ = fileno.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fileno", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class pclose { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("pclose"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int pclose(FILE *) - * } - */ - public static FunctionDescriptor pclose$descriptor() { - return pclose.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int pclose(FILE *) - * } - */ - public static MethodHandle pclose$handle() { - return pclose.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int pclose(FILE *) - * } - */ - public static MemorySegment pclose$address() { - return pclose.ADDR; - } - - /** - * {@snippet lang=c : - * int pclose(FILE *) - * } - */ - public static int pclose(MemorySegment x0) { - var mh$ = pclose.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("pclose", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class popen { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("popen"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *popen(const char *, const char *) - * } - */ - public static FunctionDescriptor popen$descriptor() { - return popen.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *popen(const char *, const char *) - * } - */ - public static MethodHandle popen$handle() { - return popen.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *popen(const char *, const char *) - * } - */ - public static MemorySegment popen$address() { - return popen.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *popen(const char *, const char *) - * } - */ - public static MemorySegment popen(MemorySegment x0, MemorySegment x1) { - var mh$ = popen.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("popen", x0, x1); - } - return (MemorySegment)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __srget { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("__srget"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int __srget(FILE *) - * } - */ - public static FunctionDescriptor __srget$descriptor() { - return __srget.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int __srget(FILE *) - * } - */ - public static MethodHandle __srget$handle() { - return __srget.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int __srget(FILE *) - * } - */ - public static MemorySegment __srget$address() { - return __srget.ADDR; - } - - /** - * {@snippet lang=c : - * int __srget(FILE *) - * } - */ - public static int __srget(MemorySegment x0) { - var mh$ = __srget.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__srget", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __svfscanf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("__svfscanf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int __svfscanf(FILE *, const char *, va_list) - * } - */ - public static FunctionDescriptor __svfscanf$descriptor() { - return __svfscanf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int __svfscanf(FILE *, const char *, va_list) - * } - */ - public static MethodHandle __svfscanf$handle() { - return __svfscanf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int __svfscanf(FILE *, const char *, va_list) - * } - */ - public static MemorySegment __svfscanf$address() { - return __svfscanf.ADDR; - } - - /** - * {@snippet lang=c : - * int __svfscanf(FILE *, const char *, va_list) - * } - */ - public static int __svfscanf(MemorySegment x0, MemorySegment x1, MemorySegment x2) { - var mh$ = __svfscanf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__svfscanf", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __swbuf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("__swbuf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int __swbuf(int, FILE *) - * } - */ - public static FunctionDescriptor __swbuf$descriptor() { - return __swbuf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int __swbuf(int, FILE *) - * } - */ - public static MethodHandle __swbuf$handle() { - return __swbuf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int __swbuf(int, FILE *) - * } - */ - public static MemorySegment __swbuf$address() { - return __swbuf.ADDR; - } - - /** - * {@snippet lang=c : - * int __swbuf(int, FILE *) - * } - */ - public static int __swbuf(int x0, MemorySegment x1) { - var mh$ = __swbuf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__swbuf", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class flockfile { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("flockfile"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void flockfile(FILE *) - * } - */ - public static FunctionDescriptor flockfile$descriptor() { - return flockfile.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void flockfile(FILE *) - * } - */ - public static MethodHandle flockfile$handle() { - return flockfile.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void flockfile(FILE *) - * } - */ - public static MemorySegment flockfile$address() { - return flockfile.ADDR; - } - - /** - * {@snippet lang=c : - * void flockfile(FILE *) - * } - */ - public static void flockfile(MemorySegment x0) { - var mh$ = flockfile.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("flockfile", x0); - } - mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class ftrylockfile { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ftrylockfile"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int ftrylockfile(FILE *) - * } - */ - public static FunctionDescriptor ftrylockfile$descriptor() { - return ftrylockfile.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int ftrylockfile(FILE *) - * } - */ - public static MethodHandle ftrylockfile$handle() { - return ftrylockfile.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int ftrylockfile(FILE *) - * } - */ - public static MemorySegment ftrylockfile$address() { - return ftrylockfile.ADDR; - } - - /** - * {@snippet lang=c : - * int ftrylockfile(FILE *) - * } - */ - public static int ftrylockfile(MemorySegment x0) { - var mh$ = ftrylockfile.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ftrylockfile", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class funlockfile { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("funlockfile"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void funlockfile(FILE *) - * } - */ - public static FunctionDescriptor funlockfile$descriptor() { - return funlockfile.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void funlockfile(FILE *) - * } - */ - public static MethodHandle funlockfile$handle() { - return funlockfile.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void funlockfile(FILE *) - * } - */ - public static MemorySegment funlockfile$address() { - return funlockfile.ADDR; - } - - /** - * {@snippet lang=c : - * void funlockfile(FILE *) - * } - */ - public static void funlockfile(MemorySegment x0) { - var mh$ = funlockfile.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("funlockfile", x0); - } - mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getc_unlocked { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getc_unlocked"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int getc_unlocked(FILE *) - * } - */ - public static FunctionDescriptor getc_unlocked$descriptor() { - return getc_unlocked.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int getc_unlocked(FILE *) - * } - */ - public static MethodHandle getc_unlocked$handle() { - return getc_unlocked.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int getc_unlocked(FILE *) - * } - */ - public static MemorySegment getc_unlocked$address() { - return getc_unlocked.ADDR; - } - - /** - * {@snippet lang=c : - * int getc_unlocked(FILE *) - * } - */ - public static int getc_unlocked(MemorySegment x0) { - var mh$ = getc_unlocked.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getc_unlocked", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getchar_unlocked { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getchar_unlocked"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int getchar_unlocked() - * } - */ - public static FunctionDescriptor getchar_unlocked$descriptor() { - return getchar_unlocked.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int getchar_unlocked() - * } - */ - public static MethodHandle getchar_unlocked$handle() { - return getchar_unlocked.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int getchar_unlocked() - * } - */ - public static MemorySegment getchar_unlocked$address() { - return getchar_unlocked.ADDR; - } - - /** - * {@snippet lang=c : - * int getchar_unlocked() - * } - */ - public static int getchar_unlocked() { - var mh$ = getchar_unlocked.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getchar_unlocked"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class putc_unlocked { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("putc_unlocked"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int putc_unlocked(int, FILE *) - * } - */ - public static FunctionDescriptor putc_unlocked$descriptor() { - return putc_unlocked.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int putc_unlocked(int, FILE *) - * } - */ - public static MethodHandle putc_unlocked$handle() { - return putc_unlocked.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int putc_unlocked(int, FILE *) - * } - */ - public static MemorySegment putc_unlocked$address() { - return putc_unlocked.ADDR; - } - - /** - * {@snippet lang=c : - * int putc_unlocked(int, FILE *) - * } - */ - public static int putc_unlocked(int x0, MemorySegment x1) { - var mh$ = putc_unlocked.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("putc_unlocked", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class putchar_unlocked { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("putchar_unlocked"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int putchar_unlocked(int) - * } - */ - public static FunctionDescriptor putchar_unlocked$descriptor() { - return putchar_unlocked.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int putchar_unlocked(int) - * } - */ - public static MethodHandle putchar_unlocked$handle() { - return putchar_unlocked.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int putchar_unlocked(int) - * } - */ - public static MemorySegment putchar_unlocked$address() { - return putchar_unlocked.ADDR; - } - - /** - * {@snippet lang=c : - * int putchar_unlocked(int) - * } - */ - public static int putchar_unlocked(int x0) { - var mh$ = putchar_unlocked.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("putchar_unlocked", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getw { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getw"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int getw(FILE *) - * } - */ - public static FunctionDescriptor getw$descriptor() { - return getw.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int getw(FILE *) - * } - */ - public static MethodHandle getw$handle() { - return getw.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int getw(FILE *) - * } - */ - public static MemorySegment getw$address() { - return getw.ADDR; - } - - /** - * {@snippet lang=c : - * int getw(FILE *) - * } - */ - public static int getw(MemorySegment x0) { - var mh$ = getw.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getw", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class putw { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("putw"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int putw(int, FILE *) - * } - */ - public static FunctionDescriptor putw$descriptor() { - return putw.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int putw(int, FILE *) - * } - */ - public static MethodHandle putw$handle() { - return putw.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int putw(int, FILE *) - * } - */ - public static MemorySegment putw$address() { - return putw.ADDR; - } - - /** - * {@snippet lang=c : - * int putw(int, FILE *) - * } - */ - public static int putw(int x0, MemorySegment x1) { - var mh$ = putw.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("putw", x0, x1); - } - return (int)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class tempnam { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("tempnam"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *tempnam(const char *__dir, const char *__prefix) - * } - */ - public static FunctionDescriptor tempnam$descriptor() { - return tempnam.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *tempnam(const char *__dir, const char *__prefix) - * } - */ - public static MethodHandle tempnam$handle() { - return tempnam.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *tempnam(const char *__dir, const char *__prefix) - * } - */ - public static MemorySegment tempnam$address() { - return tempnam.ADDR; - } - - /** - * {@snippet lang=c : - * char *tempnam(const char *__dir, const char *__prefix) - * } - */ - public static MemorySegment tempnam(MemorySegment __dir, MemorySegment __prefix) { - var mh$ = tempnam.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("tempnam", __dir, __prefix); - } - return (MemorySegment)mh$.invokeExact(__dir, __prefix); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet lang=c : - * typedef __darwin_off_t off_t - * } - */ - public static final OfLong off_t = somelib_h.C_LONG_LONG; - - private static class fseeko { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_LONG_LONG, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fseeko"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fseeko(FILE *__stream, off_t __offset, int __whence) - * } - */ - public static FunctionDescriptor fseeko$descriptor() { - return fseeko.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fseeko(FILE *__stream, off_t __offset, int __whence) - * } - */ - public static MethodHandle fseeko$handle() { - return fseeko.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fseeko(FILE *__stream, off_t __offset, int __whence) - * } - */ - public static MemorySegment fseeko$address() { - return fseeko.ADDR; - } - - /** - * {@snippet lang=c : - * int fseeko(FILE *__stream, off_t __offset, int __whence) - * } - */ - public static int fseeko(MemorySegment __stream, long __offset, int __whence) { - var mh$ = fseeko.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fseeko", __stream, __offset, __whence); - } - return (int)mh$.invokeExact(__stream, __offset, __whence); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class ftello { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ftello"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * off_t ftello(FILE *__stream) - * } - */ - public static FunctionDescriptor ftello$descriptor() { - return ftello.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * off_t ftello(FILE *__stream) - * } - */ - public static MethodHandle ftello$handle() { - return ftello.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * off_t ftello(FILE *__stream) - * } - */ - public static MemorySegment ftello$address() { - return ftello.ADDR; - } - - /** - * {@snippet lang=c : - * off_t ftello(FILE *__stream) - * } - */ - public static long ftello(MemorySegment __stream) { - var mh$ = ftello.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ftello", __stream); - } - return (long)mh$.invokeExact(__stream); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int snprintf(char *restrict __str, size_t __size, const char *restrict __format, ...) - * } - */ - public static class snprintf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("snprintf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private snprintf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int snprintf(char *restrict __str, size_t __size, const char *restrict __format, ...) - * } - */ - public static snprintf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new snprintf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment __str, long __size, MemorySegment __format, Object... x3) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("snprintf", __str, __size, __format, x3); - } - return (int)spreader.invokeExact(__str, __size, __format, x3); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class vfscanf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vfscanf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vfscanf(FILE *restrict __stream, const char *restrict __format, va_list) - * } - */ - public static FunctionDescriptor vfscanf$descriptor() { - return vfscanf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vfscanf(FILE *restrict __stream, const char *restrict __format, va_list) - * } - */ - public static MethodHandle vfscanf$handle() { - return vfscanf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vfscanf(FILE *restrict __stream, const char *restrict __format, va_list) - * } - */ - public static MemorySegment vfscanf$address() { - return vfscanf.ADDR; - } - - /** - * {@snippet lang=c : - * int vfscanf(FILE *restrict __stream, const char *restrict __format, va_list) - * } - */ - public static int vfscanf(MemorySegment __stream, MemorySegment __format, MemorySegment x2) { - var mh$ = vfscanf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vfscanf", __stream, __format, x2); - } - return (int)mh$.invokeExact(__stream, __format, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vscanf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vscanf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vscanf(const char *restrict __format, va_list) - * } - */ - public static FunctionDescriptor vscanf$descriptor() { - return vscanf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vscanf(const char *restrict __format, va_list) - * } - */ - public static MethodHandle vscanf$handle() { - return vscanf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vscanf(const char *restrict __format, va_list) - * } - */ - public static MemorySegment vscanf$address() { - return vscanf.ADDR; - } - - /** - * {@snippet lang=c : - * int vscanf(const char *restrict __format, va_list) - * } - */ - public static int vscanf(MemorySegment __format, MemorySegment x1) { - var mh$ = vscanf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vscanf", __format, x1); - } - return (int)mh$.invokeExact(__format, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vsnprintf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vsnprintf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vsnprintf(char *restrict __str, size_t __size, const char *restrict __format, va_list) - * } - */ - public static FunctionDescriptor vsnprintf$descriptor() { - return vsnprintf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vsnprintf(char *restrict __str, size_t __size, const char *restrict __format, va_list) - * } - */ - public static MethodHandle vsnprintf$handle() { - return vsnprintf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vsnprintf(char *restrict __str, size_t __size, const char *restrict __format, va_list) - * } - */ - public static MemorySegment vsnprintf$address() { - return vsnprintf.ADDR; - } - - /** - * {@snippet lang=c : - * int vsnprintf(char *restrict __str, size_t __size, const char *restrict __format, va_list) - * } - */ - public static int vsnprintf(MemorySegment __str, long __size, MemorySegment __format, MemorySegment x3) { - var mh$ = vsnprintf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vsnprintf", __str, __size, __format, x3); - } - return (int)mh$.invokeExact(__str, __size, __format, x3); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vsscanf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vsscanf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vsscanf(const char *restrict __str, const char *restrict __format, va_list) - * } - */ - public static FunctionDescriptor vsscanf$descriptor() { - return vsscanf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vsscanf(const char *restrict __str, const char *restrict __format, va_list) - * } - */ - public static MethodHandle vsscanf$handle() { - return vsscanf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vsscanf(const char *restrict __str, const char *restrict __format, va_list) - * } - */ - public static MemorySegment vsscanf$address() { - return vsscanf.ADDR; - } - - /** - * {@snippet lang=c : - * int vsscanf(const char *restrict __str, const char *restrict __format, va_list) - * } - */ - public static int vsscanf(MemorySegment __str, MemorySegment __format, MemorySegment x2) { - var mh$ = vsscanf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vsscanf", __str, __format, x2); - } - return (int)mh$.invokeExact(__str, __format, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet lang=c : - * typedef __darwin_ssize_t ssize_t - * } - */ - public static final OfLong ssize_t = somelib_h.C_LONG; - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int dprintf(int, const char *restrict, ...) - * } - */ - public static class dprintf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("dprintf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private dprintf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int dprintf(int, const char *restrict, ...) - * } - */ - public static dprintf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new dprintf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(int x0, MemorySegment x1, Object... x2) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("dprintf", x0, x1, x2); - } - return (int)spreader.invokeExact(x0, x1, x2); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class vdprintf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vdprintf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vdprintf(int, const char *restrict, va_list) - * } - */ - public static FunctionDescriptor vdprintf$descriptor() { - return vdprintf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vdprintf(int, const char *restrict, va_list) - * } - */ - public static MethodHandle vdprintf$handle() { - return vdprintf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vdprintf(int, const char *restrict, va_list) - * } - */ - public static MemorySegment vdprintf$address() { - return vdprintf.ADDR; - } - - /** - * {@snippet lang=c : - * int vdprintf(int, const char *restrict, va_list) - * } - */ - public static int vdprintf(int x0, MemorySegment x1, MemorySegment x2) { - var mh$ = vdprintf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vdprintf", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getdelim { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getdelim"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * ssize_t getdelim(char **restrict __linep, size_t *restrict __linecapp, int __delimiter, FILE *restrict __stream) - * } - */ - public static FunctionDescriptor getdelim$descriptor() { - return getdelim.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * ssize_t getdelim(char **restrict __linep, size_t *restrict __linecapp, int __delimiter, FILE *restrict __stream) - * } - */ - public static MethodHandle getdelim$handle() { - return getdelim.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * ssize_t getdelim(char **restrict __linep, size_t *restrict __linecapp, int __delimiter, FILE *restrict __stream) - * } - */ - public static MemorySegment getdelim$address() { - return getdelim.ADDR; - } - - /** - * {@snippet lang=c : - * ssize_t getdelim(char **restrict __linep, size_t *restrict __linecapp, int __delimiter, FILE *restrict __stream) - * } - */ - public static long getdelim(MemorySegment __linep, MemorySegment __linecapp, int __delimiter, MemorySegment __stream) { - var mh$ = getdelim.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getdelim", __linep, __linecapp, __delimiter, __stream); - } - return (long)mh$.invokeExact(__linep, __linecapp, __delimiter, __stream); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class getline { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("getline"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * ssize_t getline(char **restrict __linep, size_t *restrict __linecapp, FILE *restrict __stream) - * } - */ - public static FunctionDescriptor getline$descriptor() { - return getline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * ssize_t getline(char **restrict __linep, size_t *restrict __linecapp, FILE *restrict __stream) - * } - */ - public static MethodHandle getline$handle() { - return getline.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * ssize_t getline(char **restrict __linep, size_t *restrict __linecapp, FILE *restrict __stream) - * } - */ - public static MemorySegment getline$address() { - return getline.ADDR; - } - - /** - * {@snippet lang=c : - * ssize_t getline(char **restrict __linep, size_t *restrict __linecapp, FILE *restrict __stream) - * } - */ - public static long getline(MemorySegment __linep, MemorySegment __linecapp, MemorySegment __stream) { - var mh$ = getline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("getline", __linep, __linecapp, __stream); - } - return (long)mh$.invokeExact(__linep, __linecapp, __stream); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fmemopen { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fmemopen"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *fmemopen(void *restrict __buf, size_t __size, const char *restrict __mode) - * } - */ - public static FunctionDescriptor fmemopen$descriptor() { - return fmemopen.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *fmemopen(void *restrict __buf, size_t __size, const char *restrict __mode) - * } - */ - public static MethodHandle fmemopen$handle() { - return fmemopen.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *fmemopen(void *restrict __buf, size_t __size, const char *restrict __mode) - * } - */ - public static MemorySegment fmemopen$address() { - return fmemopen.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *fmemopen(void *restrict __buf, size_t __size, const char *restrict __mode) - * } - */ - public static MemorySegment fmemopen(MemorySegment __buf, long __size, MemorySegment __mode) { - var mh$ = fmemopen.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fmemopen", __buf, __size, __mode); - } - return (MemorySegment)mh$.invokeExact(__buf, __size, __mode); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class open_memstream { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("open_memstream"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *open_memstream(char **__bufp, size_t *__sizep) - * } - */ - public static FunctionDescriptor open_memstream$descriptor() { - return open_memstream.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *open_memstream(char **__bufp, size_t *__sizep) - * } - */ - public static MethodHandle open_memstream$handle() { - return open_memstream.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *open_memstream(char **__bufp, size_t *__sizep) - * } - */ - public static MemorySegment open_memstream$address() { - return open_memstream.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *open_memstream(char **__bufp, size_t *__sizep) - * } - */ - public static MemorySegment open_memstream(MemorySegment __bufp, MemorySegment __sizep) { - var mh$ = open_memstream.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("open_memstream", __bufp, __sizep); - } - return (MemorySegment)mh$.invokeExact(__bufp, __sizep); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sys_nerr$constants { - public static final OfInt LAYOUT = somelib_h.C_INT; - public static final MemorySegment SEGMENT = somelib_h.findOrThrow("sys_nerr").reinterpret(LAYOUT.byteSize()); - } - - /** - * Layout for variable: - * {@snippet lang=c : - * extern const int sys_nerr - * } - */ - public static OfInt sys_nerr$layout() { - return sys_nerr$constants.LAYOUT; - } - - /** - * Segment for variable: - * {@snippet lang=c : - * extern const int sys_nerr - * } - */ - public static MemorySegment sys_nerr$segment() { - return sys_nerr$constants.SEGMENT; - } - - /** - * Getter for variable: - * {@snippet lang=c : - * extern const int sys_nerr - * } - */ - public static int sys_nerr() { - return sys_nerr$constants.SEGMENT.get(sys_nerr$constants.LAYOUT, 0L); - } - - /** - * Setter for variable: - * {@snippet lang=c : - * extern const int sys_nerr - * } - */ - public static void sys_nerr(int varValue) { - sys_nerr$constants.SEGMENT.set(sys_nerr$constants.LAYOUT, 0L, varValue); - } - - private static class sys_errlist$constants { - public static final SequenceLayout LAYOUT = MemoryLayout.sequenceLayout(0, somelib_h.C_POINTER); - public static final MemorySegment SEGMENT = somelib_h.findOrThrow("sys_errlist").reinterpret(LAYOUT.byteSize()); - public static final VarHandle HANDLE = LAYOUT.varHandle(); - - public static final long[] DIMS = { }; - } - - /** - * Layout for variable: - * {@snippet lang=c : - * extern const char *const sys_errlist[] - * } - */ - public static SequenceLayout sys_errlist$layout() { - return sys_errlist$constants.LAYOUT; - } - - /** - * Dimensions for array variable: - * {@snippet lang=c : - * extern const char *const sys_errlist[] - * } - */ - public static long[] sys_errlist$dimensions() { - return sys_errlist$constants.DIMS; - } - - /** - * Getter for variable: - * {@snippet lang=c : - * extern const char *const sys_errlist[] - * } - */ - public static MemorySegment sys_errlist() { - return sys_errlist$constants.SEGMENT; - } - - /** - * Setter for variable: - * {@snippet lang=c : - * extern const char *const sys_errlist[] - * } - */ - public static void sys_errlist(MemorySegment varValue) { - MemorySegment.copy(varValue, 0L, sys_errlist$constants.SEGMENT, 0L, sys_errlist$constants.LAYOUT.byteSize()); - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * int asprintf(char **restrict, const char *restrict, ...) - * } - */ - public static class asprintf { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("asprintf"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private asprintf(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * int asprintf(char **restrict, const char *restrict, ...) - * } - */ - public static asprintf makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new asprintf(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, MemorySegment x1, Object... x2) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("asprintf", x0, x1, x2); - } - return (int)spreader.invokeExact(x0, x1, x2); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class ctermid_r { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("ctermid_r"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *ctermid_r(char *) - * } - */ - public static FunctionDescriptor ctermid_r$descriptor() { - return ctermid_r.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *ctermid_r(char *) - * } - */ - public static MethodHandle ctermid_r$handle() { - return ctermid_r.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *ctermid_r(char *) - * } - */ - public static MemorySegment ctermid_r$address() { - return ctermid_r.ADDR; - } - - /** - * {@snippet lang=c : - * char *ctermid_r(char *) - * } - */ - public static MemorySegment ctermid_r(MemorySegment x0) { - var mh$ = ctermid_r.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("ctermid_r", x0); - } - return (MemorySegment)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fgetln { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fgetln"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * char *fgetln(FILE *, size_t *) - * } - */ - public static FunctionDescriptor fgetln$descriptor() { - return fgetln.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * char *fgetln(FILE *, size_t *) - * } - */ - public static MethodHandle fgetln$handle() { - return fgetln.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * char *fgetln(FILE *, size_t *) - * } - */ - public static MemorySegment fgetln$address() { - return fgetln.ADDR; - } - - /** - * {@snippet lang=c : - * char *fgetln(FILE *, size_t *) - * } - */ - public static MemorySegment fgetln(MemorySegment x0, MemorySegment x1) { - var mh$ = fgetln.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fgetln", x0, x1); - } - return (MemorySegment)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fmtcheck { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fmtcheck"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const char *fmtcheck(const char *, const char *) - * } - */ - public static FunctionDescriptor fmtcheck$descriptor() { - return fmtcheck.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const char *fmtcheck(const char *, const char *) - * } - */ - public static MethodHandle fmtcheck$handle() { - return fmtcheck.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const char *fmtcheck(const char *, const char *) - * } - */ - public static MemorySegment fmtcheck$address() { - return fmtcheck.ADDR; - } - - /** - * {@snippet lang=c : - * const char *fmtcheck(const char *, const char *) - * } - */ - public static MemorySegment fmtcheck(MemorySegment x0, MemorySegment x1) { - var mh$ = fmtcheck.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fmtcheck", x0, x1); - } - return (MemorySegment)mh$.invokeExact(x0, x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fpurge { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("fpurge"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fpurge(FILE *) - * } - */ - public static FunctionDescriptor fpurge$descriptor() { - return fpurge.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fpurge(FILE *) - * } - */ - public static MethodHandle fpurge$handle() { - return fpurge.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int fpurge(FILE *) - * } - */ - public static MemorySegment fpurge$address() { - return fpurge.ADDR; - } - - /** - * {@snippet lang=c : - * int fpurge(FILE *) - * } - */ - public static int fpurge(MemorySegment x0) { - var mh$ = fpurge.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fpurge", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class setbuffer { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("setbuffer"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void setbuffer(FILE *, char *, int) - * } - */ - public static FunctionDescriptor setbuffer$descriptor() { - return setbuffer.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void setbuffer(FILE *, char *, int) - * } - */ - public static MethodHandle setbuffer$handle() { - return setbuffer.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void setbuffer(FILE *, char *, int) - * } - */ - public static MemorySegment setbuffer$address() { - return setbuffer.ADDR; - } - - /** - * {@snippet lang=c : - * void setbuffer(FILE *, char *, int) - * } - */ - public static void setbuffer(MemorySegment x0, MemorySegment x1, int x2) { - var mh$ = setbuffer.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("setbuffer", x0, x1, x2); - } - mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class setlinebuf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("setlinebuf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int setlinebuf(FILE *) - * } - */ - public static FunctionDescriptor setlinebuf$descriptor() { - return setlinebuf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int setlinebuf(FILE *) - * } - */ - public static MethodHandle setlinebuf$handle() { - return setlinebuf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int setlinebuf(FILE *) - * } - */ - public static MemorySegment setlinebuf$address() { - return setlinebuf.ADDR; - } - - /** - * {@snippet lang=c : - * int setlinebuf(FILE *) - * } - */ - public static int setlinebuf(MemorySegment x0) { - var mh$ = setlinebuf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("setlinebuf", x0); - } - return (int)mh$.invokeExact(x0); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class vasprintf { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("vasprintf"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int vasprintf(char **restrict, const char *restrict, va_list) - * } - */ - public static FunctionDescriptor vasprintf$descriptor() { - return vasprintf.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int vasprintf(char **restrict, const char *restrict, va_list) - * } - */ - public static MethodHandle vasprintf$handle() { - return vasprintf.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int vasprintf(char **restrict, const char *restrict, va_list) - * } - */ - public static MemorySegment vasprintf$address() { - return vasprintf.ADDR; - } - - /** - * {@snippet lang=c : - * int vasprintf(char **restrict, const char *restrict, va_list) - * } - */ - public static int vasprintf(MemorySegment x0, MemorySegment x1, MemorySegment x2) { - var mh$ = vasprintf.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("vasprintf", x0, x1, x2); - } - return (int)mh$.invokeExact(x0, x1, x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class funopen { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("funopen"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * FILE *funopen(const void *, int (* _Nullable)(void *, char *, int), int (* _Nullable)(void *, const char *, int), fpos_t (* _Nullable)(void *, fpos_t, int), int (* _Nullable)(void *)) - * } - */ - public static FunctionDescriptor funopen$descriptor() { - return funopen.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * FILE *funopen(const void *, int (* _Nullable)(void *, char *, int), int (* _Nullable)(void *, const char *, int), fpos_t (* _Nullable)(void *, fpos_t, int), int (* _Nullable)(void *)) - * } - */ - public static MethodHandle funopen$handle() { - return funopen.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * FILE *funopen(const void *, int (* _Nullable)(void *, char *, int), int (* _Nullable)(void *, const char *, int), fpos_t (* _Nullable)(void *, fpos_t, int), int (* _Nullable)(void *)) - * } - */ - public static MemorySegment funopen$address() { - return funopen.ADDR; - } - - /** - * {@snippet lang=c : - * FILE *funopen(const void *, int (* _Nullable)(void *, char *, int), int (* _Nullable)(void *, const char *, int), fpos_t (* _Nullable)(void *, fpos_t, int), int (* _Nullable)(void *)) - * } - */ - public static MemorySegment funopen(MemorySegment x0, MemorySegment x1, MemorySegment x2, MemorySegment x3, MemorySegment x4) { - var mh$ = funopen.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("funopen", x0, x1, x2, x3, x4); - } - return (MemorySegment)mh$.invokeExact(x0, x1, x2, x3, x4); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * extern int __sprintf_chk(char *restrict, int, size_t, const char *restrict, ...) - * } - */ - public static class __sprintf_chk { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("__sprintf_chk"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private __sprintf_chk(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * extern int __sprintf_chk(char *restrict, int, size_t, const char *restrict, ...) - * } - */ - public static __sprintf_chk makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new __sprintf_chk(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, int x1, long x2, MemorySegment x3, Object... x4) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__sprintf_chk", x0, x1, x2, x3, x4); - } - return (int)spreader.invokeExact(x0, x1, x2, x3, x4); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - /** - * Variadic invoker class for: - * {@snippet lang=c : - * extern int __snprintf_chk(char *restrict, size_t, int, size_t, const char *restrict, ...) - * } - */ - public static class __snprintf_chk { - private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_INT, - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - private static final MemorySegment ADDR = somelib_h.findOrThrow("__snprintf_chk"); - - private final MethodHandle handle; - private final FunctionDescriptor descriptor; - private final MethodHandle spreader; - - private __snprintf_chk(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { - this.handle = handle; - this.descriptor = descriptor; - this.spreader = spreader; - } - - /** - * Variadic invoker factory for: - * {@snippet lang=c : - * extern int __snprintf_chk(char *restrict, size_t, int, size_t, const char *restrict, ...) - * } - */ - public static __snprintf_chk makeInvoker(MemoryLayout... layouts) { - FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); - Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); - var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); - var spreader$ = mh$.asSpreader(Object[].class, layouts.length); - return new __snprintf_chk(mh$, desc$, spreader$); - } - - /** - * {@return the address} - */ - public static MemorySegment address() { - return ADDR; - } - - /** - * {@return the specialized method handle} - */ - public MethodHandle handle() { - return handle; - } - - /** - * {@return the specialized descriptor} - */ - public FunctionDescriptor descriptor() { - return descriptor; - } - - public int apply(MemorySegment x0, long x1, int x2, long x3, MemorySegment x4, Object... x5) { - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__snprintf_chk", x0, x1, x2, x3, x4, x5); - } - return (int)spreader.invokeExact(x0, x1, x2, x3, x4, x5); - } catch(IllegalArgumentException | ClassCastException ex$) { - throw ex$; // rethrow IAE from passing wrong number/type of args - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static class __vsprintf_chk { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_INT, - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("__vsprintf_chk"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * extern int __vsprintf_chk(char *restrict, int, size_t, const char *restrict, va_list) - * } - */ - public static FunctionDescriptor __vsprintf_chk$descriptor() { - return __vsprintf_chk.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * extern int __vsprintf_chk(char *restrict, int, size_t, const char *restrict, va_list) - * } - */ - public static MethodHandle __vsprintf_chk$handle() { - return __vsprintf_chk.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * extern int __vsprintf_chk(char *restrict, int, size_t, const char *restrict, va_list) - * } - */ - public static MemorySegment __vsprintf_chk$address() { - return __vsprintf_chk.ADDR; - } - - /** - * {@snippet lang=c : - * extern int __vsprintf_chk(char *restrict, int, size_t, const char *restrict, va_list) - * } - */ - public static int __vsprintf_chk(MemorySegment x0, int x1, long x2, MemorySegment x3, MemorySegment x4) { - var mh$ = __vsprintf_chk.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__vsprintf_chk", x0, x1, x2, x3, x4); - } - return (int)mh$.invokeExact(x0, x1, x2, x3, x4); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class __vsnprintf_chk { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT, - somelib_h.C_POINTER, - somelib_h.C_LONG, - somelib_h.C_INT, - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("__vsnprintf_chk"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * extern int __vsnprintf_chk(char *restrict, size_t, int, size_t, const char *restrict, va_list) - * } - */ - public static FunctionDescriptor __vsnprintf_chk$descriptor() { - return __vsnprintf_chk.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * extern int __vsnprintf_chk(char *restrict, size_t, int, size_t, const char *restrict, va_list) - * } - */ - public static MethodHandle __vsnprintf_chk$handle() { - return __vsnprintf_chk.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * extern int __vsnprintf_chk(char *restrict, size_t, int, size_t, const char *restrict, va_list) - * } - */ - public static MemorySegment __vsnprintf_chk$address() { - return __vsnprintf_chk.ADDR; - } - - /** - * {@snippet lang=c : - * extern int __vsnprintf_chk(char *restrict, size_t, int, size_t, const char *restrict, va_list) - * } - */ - public static int __vsnprintf_chk(MemorySegment x0, long x1, int x2, long x3, MemorySegment x4, MemorySegment x5) { - var mh$ = __vsnprintf_chk.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("__vsnprintf_chk", x0, x1, x2, x3, x4, x5); - } - return (int)mh$.invokeExact(x0, x1, x2, x3, x4, x5); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int UnimportedEnum_A = (int)0L; - /** - * {@snippet lang=c : - * enum UnimportedEnum.UnimportedEnum_A = 0 - * } - */ - public static int UnimportedEnum_A() { - return UnimportedEnum_A; - } - private static final int UnimportedEnum_B = (int)1L; - /** - * {@snippet lang=c : - * enum UnimportedEnum.UnimportedEnum_B = 1 - * } - */ - public static int UnimportedEnum_B() { - return UnimportedEnum_B; - } - private static final int UnimportedEnum_C = (int)2L; - /** - * {@snippet lang=c : - * enum UnimportedEnum.UnimportedEnum_C = 2 - * } - */ - public static int UnimportedEnum_C() { - return UnimportedEnum_C; - } - - private static class BorrowedFields_from_bar_and_strings { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - BorrowedFields.layout(), - somelib_h.C_POINTER, - DiplomatString16View.layout(), - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("BorrowedFields_from_bar_and_strings"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * BorrowedFields BorrowedFields_from_bar_and_strings(const Bar *bar, DiplomatString16View dstr16, DiplomatStringView utf8_str) - * } - */ - public static FunctionDescriptor BorrowedFields_from_bar_and_strings$descriptor() { - return BorrowedFields_from_bar_and_strings.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * BorrowedFields BorrowedFields_from_bar_and_strings(const Bar *bar, DiplomatString16View dstr16, DiplomatStringView utf8_str) - * } - */ - public static MethodHandle BorrowedFields_from_bar_and_strings$handle() { - return BorrowedFields_from_bar_and_strings.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * BorrowedFields BorrowedFields_from_bar_and_strings(const Bar *bar, DiplomatString16View dstr16, DiplomatStringView utf8_str) - * } - */ - public static MemorySegment BorrowedFields_from_bar_and_strings$address() { - return BorrowedFields_from_bar_and_strings.ADDR; - } - - /** - * {@snippet lang=c : - * BorrowedFields BorrowedFields_from_bar_and_strings(const Bar *bar, DiplomatString16View dstr16, DiplomatStringView utf8_str) - * } - */ - public static MemorySegment BorrowedFields_from_bar_and_strings(SegmentAllocator allocator, MemorySegment bar, MemorySegment dstr16, MemorySegment utf8_str) { - var mh$ = BorrowedFields_from_bar_and_strings.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("BorrowedFields_from_bar_and_strings", allocator, bar, dstr16, utf8_str); - } - return (MemorySegment)mh$.invokeExact(allocator, bar, dstr16, utf8_str); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class BorrowedFieldsWithBounds_from_foo_and_strings { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - BorrowedFieldsWithBounds.layout(), - somelib_h.C_POINTER, - DiplomatString16View.layout(), - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("BorrowedFieldsWithBounds_from_foo_and_strings"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * BorrowedFieldsWithBounds BorrowedFieldsWithBounds_from_foo_and_strings(const Foo *foo, DiplomatString16View dstr16_x, DiplomatStringView utf8_str_z) - * } - */ - public static FunctionDescriptor BorrowedFieldsWithBounds_from_foo_and_strings$descriptor() { - return BorrowedFieldsWithBounds_from_foo_and_strings.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * BorrowedFieldsWithBounds BorrowedFieldsWithBounds_from_foo_and_strings(const Foo *foo, DiplomatString16View dstr16_x, DiplomatStringView utf8_str_z) - * } - */ - public static MethodHandle BorrowedFieldsWithBounds_from_foo_and_strings$handle() { - return BorrowedFieldsWithBounds_from_foo_and_strings.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * BorrowedFieldsWithBounds BorrowedFieldsWithBounds_from_foo_and_strings(const Foo *foo, DiplomatString16View dstr16_x, DiplomatStringView utf8_str_z) - * } - */ - public static MemorySegment BorrowedFieldsWithBounds_from_foo_and_strings$address() { - return BorrowedFieldsWithBounds_from_foo_and_strings.ADDR; - } - - /** - * {@snippet lang=c : - * BorrowedFieldsWithBounds BorrowedFieldsWithBounds_from_foo_and_strings(const Foo *foo, DiplomatString16View dstr16_x, DiplomatStringView utf8_str_z) - * } - */ - public static MemorySegment BorrowedFieldsWithBounds_from_foo_and_strings(SegmentAllocator allocator, MemorySegment foo, MemorySegment dstr16_x, MemorySegment utf8_str_z) { - var mh$ = BorrowedFieldsWithBounds_from_foo_and_strings.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("BorrowedFieldsWithBounds_from_foo_and_strings", allocator, foo, dstr16_x, utf8_str_z); - } - return (MemorySegment)mh$.invokeExact(allocator, foo, dstr16_x, utf8_str_z); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class NestedBorrowedFields_from_bar_and_foo_and_strings { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - NestedBorrowedFields.layout(), - somelib_h.C_POINTER, - somelib_h.C_POINTER, - DiplomatString16View.layout(), - DiplomatString16View.layout(), - DiplomatStringView.layout(), - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("NestedBorrowedFields_from_bar_and_foo_and_strings"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * NestedBorrowedFields NestedBorrowedFields_from_bar_and_foo_and_strings(const Bar *bar, const Foo *foo, DiplomatString16View dstr16_x, DiplomatString16View dstr16_z, DiplomatStringView utf8_str_y, DiplomatStringView utf8_str_z) - * } - */ - public static FunctionDescriptor NestedBorrowedFields_from_bar_and_foo_and_strings$descriptor() { - return NestedBorrowedFields_from_bar_and_foo_and_strings.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * NestedBorrowedFields NestedBorrowedFields_from_bar_and_foo_and_strings(const Bar *bar, const Foo *foo, DiplomatString16View dstr16_x, DiplomatString16View dstr16_z, DiplomatStringView utf8_str_y, DiplomatStringView utf8_str_z) - * } - */ - public static MethodHandle NestedBorrowedFields_from_bar_and_foo_and_strings$handle() { - return NestedBorrowedFields_from_bar_and_foo_and_strings.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * NestedBorrowedFields NestedBorrowedFields_from_bar_and_foo_and_strings(const Bar *bar, const Foo *foo, DiplomatString16View dstr16_x, DiplomatString16View dstr16_z, DiplomatStringView utf8_str_y, DiplomatStringView utf8_str_z) - * } - */ - public static MemorySegment NestedBorrowedFields_from_bar_and_foo_and_strings$address() { - return NestedBorrowedFields_from_bar_and_foo_and_strings.ADDR; - } - - /** - * {@snippet lang=c : - * NestedBorrowedFields NestedBorrowedFields_from_bar_and_foo_and_strings(const Bar *bar, const Foo *foo, DiplomatString16View dstr16_x, DiplomatString16View dstr16_z, DiplomatStringView utf8_str_y, DiplomatStringView utf8_str_z) - * } - */ - public static MemorySegment NestedBorrowedFields_from_bar_and_foo_and_strings(SegmentAllocator allocator, MemorySegment bar, MemorySegment foo, MemorySegment dstr16_x, MemorySegment dstr16_z, MemorySegment utf8_str_y, MemorySegment utf8_str_z) { - var mh$ = NestedBorrowedFields_from_bar_and_foo_and_strings.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("NestedBorrowedFields_from_bar_and_foo_and_strings", allocator, bar, foo, dstr16_x, dstr16_z, utf8_str_y, utf8_str_z); - } - return (MemorySegment)mh$.invokeExact(allocator, bar, foo, dstr16_x, dstr16_z, utf8_str_y, utf8_str_z); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class CyclicStructA_get_b { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - CyclicStructB.layout() ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("CyclicStructA_get_b"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * CyclicStructB CyclicStructA_get_b() - * } - */ - public static FunctionDescriptor CyclicStructA_get_b$descriptor() { - return CyclicStructA_get_b.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * CyclicStructB CyclicStructA_get_b() - * } - */ - public static MethodHandle CyclicStructA_get_b$handle() { - return CyclicStructA_get_b.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * CyclicStructB CyclicStructA_get_b() - * } - */ - public static MemorySegment CyclicStructA_get_b$address() { - return CyclicStructA_get_b.ADDR; - } - - /** - * {@snippet lang=c : - * CyclicStructB CyclicStructA_get_b() - * } - */ - public static MemorySegment CyclicStructA_get_b(SegmentAllocator allocator) { - var mh$ = CyclicStructA_get_b.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("CyclicStructA_get_b", allocator); - } - return (MemorySegment)mh$.invokeExact(allocator); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class CyclicStructB_get_a { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - CyclicStructA.layout() ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("CyclicStructB_get_a"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * CyclicStructA CyclicStructB_get_a() - * } - */ - public static FunctionDescriptor CyclicStructB_get_a$descriptor() { - return CyclicStructB_get_a.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * CyclicStructA CyclicStructB_get_a() - * } - */ - public static MethodHandle CyclicStructB_get_a$handle() { - return CyclicStructB_get_a.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * CyclicStructA CyclicStructB_get_a() - * } - */ - public static MemorySegment CyclicStructB_get_a$address() { - return CyclicStructB_get_a.ADDR; - } - - /** - * {@snippet lang=c : - * CyclicStructA CyclicStructB_get_a() - * } - */ - public static MemorySegment CyclicStructB_get_a(SegmentAllocator allocator) { - var mh$ = CyclicStructB_get_a.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("CyclicStructB_get_a", allocator); - } - return (MemorySegment)mh$.invokeExact(allocator); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int MyEnum_A = (int)-2L; - /** - * {@snippet lang=c : - * enum MyEnum.MyEnum_A = -2 - * } - */ - public static int MyEnum_A() { - return MyEnum_A; - } - private static final int MyEnum_B = (int)-1L; - /** - * {@snippet lang=c : - * enum MyEnum.MyEnum_B = -1 - * } - */ - public static int MyEnum_B() { - return MyEnum_B; - } - private static final int MyEnum_C = (int)0L; - /** - * {@snippet lang=c : - * enum MyEnum.MyEnum_C = 0 - * } - */ - public static int MyEnum_C() { - return MyEnum_C; - } - private static final int MyEnum_D = (int)1L; - /** - * {@snippet lang=c : - * enum MyEnum.MyEnum_D = 1 - * } - */ - public static int MyEnum_D() { - return MyEnum_D; - } - private static final int MyEnum_E = (int)2L; - /** - * {@snippet lang=c : - * enum MyEnum.MyEnum_E = 2 - * } - */ - public static int MyEnum_E() { - return MyEnum_E; - } - private static final int MyEnum_F = (int)3L; - /** - * {@snippet lang=c : - * enum MyEnum.MyEnum_F = 3 - * } - */ - public static int MyEnum_F() { - return MyEnum_F; - } - - private static class MyStruct_new { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - MyStruct.layout() ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyStruct_new"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * MyStruct MyStruct_new() - * } - */ - public static FunctionDescriptor MyStruct_new$descriptor() { - return MyStruct_new.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * MyStruct MyStruct_new() - * } - */ - public static MethodHandle MyStruct_new$handle() { - return MyStruct_new.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * MyStruct MyStruct_new() - * } - */ - public static MemorySegment MyStruct_new$address() { - return MyStruct_new.ADDR; - } - - /** - * {@snippet lang=c : - * MyStruct MyStruct_new() - * } - */ - public static MemorySegment MyStruct_new(SegmentAllocator allocator) { - var mh$ = MyStruct_new.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyStruct_new", allocator); - } - return (MemorySegment)mh$.invokeExact(allocator); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyStruct_into_a { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_CHAR, - MyStruct.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyStruct_into_a"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * uint8_t MyStruct_into_a(MyStruct self) - * } - */ - public static FunctionDescriptor MyStruct_into_a$descriptor() { - return MyStruct_into_a.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * uint8_t MyStruct_into_a(MyStruct self) - * } - */ - public static MethodHandle MyStruct_into_a$handle() { - return MyStruct_into_a.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * uint8_t MyStruct_into_a(MyStruct self) - * } - */ - public static MemorySegment MyStruct_into_a$address() { - return MyStruct_into_a.ADDR; - } - - /** - * {@snippet lang=c : - * uint8_t MyStruct_into_a(MyStruct self) - * } - */ - public static byte MyStruct_into_a(MemorySegment self) { - var mh$ = MyStruct_into_a.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyStruct_into_a", self); - } - return (byte)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Bar_foo { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Bar_foo"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const Foo *Bar_foo(const Bar *self) - * } - */ - public static FunctionDescriptor Bar_foo$descriptor() { - return Bar_foo.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const Foo *Bar_foo(const Bar *self) - * } - */ - public static MethodHandle Bar_foo$handle() { - return Bar_foo.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const Foo *Bar_foo(const Bar *self) - * } - */ - public static MemorySegment Bar_foo$address() { - return Bar_foo.ADDR; - } - - /** - * {@snippet lang=c : - * const Foo *Bar_foo(const Bar *self) - * } - */ - public static MemorySegment Bar_foo(MemorySegment self) { - var mh$ = Bar_foo.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Bar_foo", self); - } - return (MemorySegment)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Bar_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Bar_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Bar_destroy(Bar *self) - * } - */ - public static FunctionDescriptor Bar_destroy$descriptor() { - return Bar_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Bar_destroy(Bar *self) - * } - */ - public static MethodHandle Bar_destroy$handle() { - return Bar_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Bar_destroy(Bar *self) - * } - */ - public static MemorySegment Bar_destroy$address() { - return Bar_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void Bar_destroy(Bar *self) - * } - */ - public static void Bar_destroy(MemorySegment self) { - var mh$ = Bar_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Bar_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Foo_new { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Foo_new"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Foo *Foo_new(DiplomatStringView x) - * } - */ - public static FunctionDescriptor Foo_new$descriptor() { - return Foo_new.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Foo *Foo_new(DiplomatStringView x) - * } - */ - public static MethodHandle Foo_new$handle() { - return Foo_new.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Foo *Foo_new(DiplomatStringView x) - * } - */ - public static MemorySegment Foo_new$address() { - return Foo_new.ADDR; - } - - /** - * {@snippet lang=c : - * Foo *Foo_new(DiplomatStringView x) - * } - */ - public static MemorySegment Foo_new(MemorySegment x) { - var mh$ = Foo_new.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Foo_new", x); - } - return (MemorySegment)mh$.invokeExact(x); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Foo_get_bar { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Foo_get_bar"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Bar *Foo_get_bar(const Foo *self) - * } - */ - public static FunctionDescriptor Foo_get_bar$descriptor() { - return Foo_get_bar.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Bar *Foo_get_bar(const Foo *self) - * } - */ - public static MethodHandle Foo_get_bar$handle() { - return Foo_get_bar.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Bar *Foo_get_bar(const Foo *self) - * } - */ - public static MemorySegment Foo_get_bar$address() { - return Foo_get_bar.ADDR; - } - - /** - * {@snippet lang=c : - * Bar *Foo_get_bar(const Foo *self) - * } - */ - public static MemorySegment Foo_get_bar(MemorySegment self) { - var mh$ = Foo_get_bar.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Foo_get_bar", self); - } - return (MemorySegment)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Foo_as_returning { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - BorrowedFieldsReturning.layout(), - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Foo_as_returning"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * BorrowedFieldsReturning Foo_as_returning(const Foo *self) - * } - */ - public static FunctionDescriptor Foo_as_returning$descriptor() { - return Foo_as_returning.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * BorrowedFieldsReturning Foo_as_returning(const Foo *self) - * } - */ - public static MethodHandle Foo_as_returning$handle() { - return Foo_as_returning.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * BorrowedFieldsReturning Foo_as_returning(const Foo *self) - * } - */ - public static MemorySegment Foo_as_returning$address() { - return Foo_as_returning.ADDR; - } - - /** - * {@snippet lang=c : - * BorrowedFieldsReturning Foo_as_returning(const Foo *self) - * } - */ - public static MemorySegment Foo_as_returning(SegmentAllocator allocator, MemorySegment self) { - var mh$ = Foo_as_returning.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Foo_as_returning", allocator, self); - } - return (MemorySegment)mh$.invokeExact(allocator, self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Foo_extract_from_fields { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - BorrowedFields.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Foo_extract_from_fields"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Foo *Foo_extract_from_fields(BorrowedFields fields) - * } - */ - public static FunctionDescriptor Foo_extract_from_fields$descriptor() { - return Foo_extract_from_fields.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Foo *Foo_extract_from_fields(BorrowedFields fields) - * } - */ - public static MethodHandle Foo_extract_from_fields$handle() { - return Foo_extract_from_fields.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Foo *Foo_extract_from_fields(BorrowedFields fields) - * } - */ - public static MemorySegment Foo_extract_from_fields$address() { - return Foo_extract_from_fields.ADDR; - } - - /** - * {@snippet lang=c : - * Foo *Foo_extract_from_fields(BorrowedFields fields) - * } - */ - public static MemorySegment Foo_extract_from_fields(MemorySegment fields) { - var mh$ = Foo_extract_from_fields.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Foo_extract_from_fields", fields); - } - return (MemorySegment)mh$.invokeExact(fields); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Foo_extract_from_bounds { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - BorrowedFieldsWithBounds.layout(), - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Foo_extract_from_bounds"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Foo *Foo_extract_from_bounds(BorrowedFieldsWithBounds bounds, DiplomatStringView another_string) - * } - */ - public static FunctionDescriptor Foo_extract_from_bounds$descriptor() { - return Foo_extract_from_bounds.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Foo *Foo_extract_from_bounds(BorrowedFieldsWithBounds bounds, DiplomatStringView another_string) - * } - */ - public static MethodHandle Foo_extract_from_bounds$handle() { - return Foo_extract_from_bounds.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Foo *Foo_extract_from_bounds(BorrowedFieldsWithBounds bounds, DiplomatStringView another_string) - * } - */ - public static MemorySegment Foo_extract_from_bounds$address() { - return Foo_extract_from_bounds.ADDR; - } - - /** - * {@snippet lang=c : - * Foo *Foo_extract_from_bounds(BorrowedFieldsWithBounds bounds, DiplomatStringView another_string) - * } - */ - public static MemorySegment Foo_extract_from_bounds(MemorySegment bounds, MemorySegment another_string) { - var mh$ = Foo_extract_from_bounds.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Foo_extract_from_bounds", bounds, another_string); - } - return (MemorySegment)mh$.invokeExact(bounds, another_string); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Foo_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Foo_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Foo_destroy(Foo *self) - * } - */ - public static FunctionDescriptor Foo_destroy$descriptor() { - return Foo_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Foo_destroy(Foo *self) - * } - */ - public static MethodHandle Foo_destroy$handle() { - return Foo_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Foo_destroy(Foo *self) - * } - */ - public static MemorySegment Foo_destroy$address() { - return Foo_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void Foo_destroy(Foo *self) - * } - */ - public static void Foo_destroy(MemorySegment self) { - var mh$ = Foo_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Foo_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_transitivity { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_transitivity"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_transitivity(const One *hold, const One *nohold) - * } - */ - public static FunctionDescriptor One_transitivity$descriptor() { - return One_transitivity.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_transitivity(const One *hold, const One *nohold) - * } - */ - public static MethodHandle One_transitivity$handle() { - return One_transitivity.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_transitivity(const One *hold, const One *nohold) - * } - */ - public static MemorySegment One_transitivity$address() { - return One_transitivity.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_transitivity(const One *hold, const One *nohold) - * } - */ - public static MemorySegment One_transitivity(MemorySegment hold, MemorySegment nohold) { - var mh$ = One_transitivity.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_transitivity", hold, nohold); - } - return (MemorySegment)mh$.invokeExact(hold, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_cycle { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_cycle"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_cycle(const Two *hold, const One *nohold) - * } - */ - public static FunctionDescriptor One_cycle$descriptor() { - return One_cycle.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_cycle(const Two *hold, const One *nohold) - * } - */ - public static MethodHandle One_cycle$handle() { - return One_cycle.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_cycle(const Two *hold, const One *nohold) - * } - */ - public static MemorySegment One_cycle$address() { - return One_cycle.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_cycle(const Two *hold, const One *nohold) - * } - */ - public static MemorySegment One_cycle(MemorySegment hold, MemorySegment nohold) { - var mh$ = One_cycle.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_cycle", hold, nohold); - } - return (MemorySegment)mh$.invokeExact(hold, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_many_dependents { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_many_dependents"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_many_dependents(const One *a, const One *b, const Two *c, const Two *d, const Two *nohold) - * } - */ - public static FunctionDescriptor One_many_dependents$descriptor() { - return One_many_dependents.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_many_dependents(const One *a, const One *b, const Two *c, const Two *d, const Two *nohold) - * } - */ - public static MethodHandle One_many_dependents$handle() { - return One_many_dependents.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_many_dependents(const One *a, const One *b, const Two *c, const Two *d, const Two *nohold) - * } - */ - public static MemorySegment One_many_dependents$address() { - return One_many_dependents.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_many_dependents(const One *a, const One *b, const Two *c, const Two *d, const Two *nohold) - * } - */ - public static MemorySegment One_many_dependents(MemorySegment a, MemorySegment b, MemorySegment c, MemorySegment d, MemorySegment nohold) { - var mh$ = One_many_dependents.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_many_dependents", a, b, c, d, nohold); - } - return (MemorySegment)mh$.invokeExact(a, b, c, d, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_return_outlives_param { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_return_outlives_param"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_return_outlives_param(const Two *hold, const One *nohold) - * } - */ - public static FunctionDescriptor One_return_outlives_param$descriptor() { - return One_return_outlives_param.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_return_outlives_param(const Two *hold, const One *nohold) - * } - */ - public static MethodHandle One_return_outlives_param$handle() { - return One_return_outlives_param.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_return_outlives_param(const Two *hold, const One *nohold) - * } - */ - public static MemorySegment One_return_outlives_param$address() { - return One_return_outlives_param.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_return_outlives_param(const Two *hold, const One *nohold) - * } - */ - public static MemorySegment One_return_outlives_param(MemorySegment hold, MemorySegment nohold) { - var mh$ = One_return_outlives_param.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_return_outlives_param", hold, nohold); - } - return (MemorySegment)mh$.invokeExact(hold, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_diamond_top { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_diamond_top"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_diamond_top(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static FunctionDescriptor One_diamond_top$descriptor() { - return One_diamond_top.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_diamond_top(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MethodHandle One_diamond_top$handle() { - return One_diamond_top.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_diamond_top(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_top$address() { - return One_diamond_top.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_diamond_top(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_top(MemorySegment top, MemorySegment left, MemorySegment right, MemorySegment bottom) { - var mh$ = One_diamond_top.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_diamond_top", top, left, right, bottom); - } - return (MemorySegment)mh$.invokeExact(top, left, right, bottom); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_diamond_left { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_diamond_left"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_diamond_left(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static FunctionDescriptor One_diamond_left$descriptor() { - return One_diamond_left.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_diamond_left(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MethodHandle One_diamond_left$handle() { - return One_diamond_left.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_diamond_left(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_left$address() { - return One_diamond_left.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_diamond_left(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_left(MemorySegment top, MemorySegment left, MemorySegment right, MemorySegment bottom) { - var mh$ = One_diamond_left.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_diamond_left", top, left, right, bottom); - } - return (MemorySegment)mh$.invokeExact(top, left, right, bottom); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_diamond_right { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_diamond_right"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_diamond_right(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static FunctionDescriptor One_diamond_right$descriptor() { - return One_diamond_right.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_diamond_right(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MethodHandle One_diamond_right$handle() { - return One_diamond_right.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_diamond_right(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_right$address() { - return One_diamond_right.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_diamond_right(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_right(MemorySegment top, MemorySegment left, MemorySegment right, MemorySegment bottom) { - var mh$ = One_diamond_right.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_diamond_right", top, left, right, bottom); - } - return (MemorySegment)mh$.invokeExact(top, left, right, bottom); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_diamond_bottom { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_diamond_bottom"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_diamond_bottom(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static FunctionDescriptor One_diamond_bottom$descriptor() { - return One_diamond_bottom.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_diamond_bottom(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MethodHandle One_diamond_bottom$handle() { - return One_diamond_bottom.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_diamond_bottom(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_bottom$address() { - return One_diamond_bottom.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_diamond_bottom(const One *top, const One *left, const One *right, const One *bottom) - * } - */ - public static MemorySegment One_diamond_bottom(MemorySegment top, MemorySegment left, MemorySegment right, MemorySegment bottom) { - var mh$ = One_diamond_bottom.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_diamond_bottom", top, left, right, bottom); - } - return (MemorySegment)mh$.invokeExact(top, left, right, bottom); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_diamond_and_nested_types { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_diamond_and_nested_types"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_diamond_and_nested_types(const One *a, const One *b, const One *c, const One *d, const One *nohold) - * } - */ - public static FunctionDescriptor One_diamond_and_nested_types$descriptor() { - return One_diamond_and_nested_types.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_diamond_and_nested_types(const One *a, const One *b, const One *c, const One *d, const One *nohold) - * } - */ - public static MethodHandle One_diamond_and_nested_types$handle() { - return One_diamond_and_nested_types.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_diamond_and_nested_types(const One *a, const One *b, const One *c, const One *d, const One *nohold) - * } - */ - public static MemorySegment One_diamond_and_nested_types$address() { - return One_diamond_and_nested_types.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_diamond_and_nested_types(const One *a, const One *b, const One *c, const One *d, const One *nohold) - * } - */ - public static MemorySegment One_diamond_and_nested_types(MemorySegment a, MemorySegment b, MemorySegment c, MemorySegment d, MemorySegment nohold) { - var mh$ = One_diamond_and_nested_types.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_diamond_and_nested_types", a, b, c, d, nohold); - } - return (MemorySegment)mh$.invokeExact(a, b, c, d, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_implicit_bounds { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_implicit_bounds"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_implicit_bounds(const One *explicit_hold, const One *implicit_hold, const One *nohold) - * } - */ - public static FunctionDescriptor One_implicit_bounds$descriptor() { - return One_implicit_bounds.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_implicit_bounds(const One *explicit_hold, const One *implicit_hold, const One *nohold) - * } - */ - public static MethodHandle One_implicit_bounds$handle() { - return One_implicit_bounds.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_implicit_bounds(const One *explicit_hold, const One *implicit_hold, const One *nohold) - * } - */ - public static MemorySegment One_implicit_bounds$address() { - return One_implicit_bounds.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_implicit_bounds(const One *explicit_hold, const One *implicit_hold, const One *nohold) - * } - */ - public static MemorySegment One_implicit_bounds(MemorySegment explicit_hold, MemorySegment implicit_hold, MemorySegment nohold) { - var mh$ = One_implicit_bounds.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_implicit_bounds", explicit_hold, implicit_hold, nohold); - } - return (MemorySegment)mh$.invokeExact(explicit_hold, implicit_hold, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_implicit_bounds_deep { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_implicit_bounds_deep"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * One *One_implicit_bounds_deep(const One *explicit_, const One *implicit_1, const One *implicit_2, const One *nohold) - * } - */ - public static FunctionDescriptor One_implicit_bounds_deep$descriptor() { - return One_implicit_bounds_deep.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * One *One_implicit_bounds_deep(const One *explicit_, const One *implicit_1, const One *implicit_2, const One *nohold) - * } - */ - public static MethodHandle One_implicit_bounds_deep$handle() { - return One_implicit_bounds_deep.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * One *One_implicit_bounds_deep(const One *explicit_, const One *implicit_1, const One *implicit_2, const One *nohold) - * } - */ - public static MemorySegment One_implicit_bounds_deep$address() { - return One_implicit_bounds_deep.ADDR; - } - - /** - * {@snippet lang=c : - * One *One_implicit_bounds_deep(const One *explicit_, const One *implicit_1, const One *implicit_2, const One *nohold) - * } - */ - public static MemorySegment One_implicit_bounds_deep(MemorySegment explicit_, MemorySegment implicit_1, MemorySegment implicit_2, MemorySegment nohold) { - var mh$ = One_implicit_bounds_deep.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_implicit_bounds_deep", explicit_, implicit_1, implicit_2, nohold); - } - return (MemorySegment)mh$.invokeExact(explicit_, implicit_1, implicit_2, nohold); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class One_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("One_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void One_destroy(One *self) - * } - */ - public static FunctionDescriptor One_destroy$descriptor() { - return One_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void One_destroy(One *self) - * } - */ - public static MethodHandle One_destroy$handle() { - return One_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void One_destroy(One *self) - * } - */ - public static MemorySegment One_destroy$address() { - return One_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void One_destroy(One *self) - * } - */ - public static void One_destroy(MemorySegment self) { - var mh$ = One_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("One_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Two_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Two_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Two_destroy(Two *self) - * } - */ - public static FunctionDescriptor Two_destroy$descriptor() { - return Two_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Two_destroy(Two *self) - * } - */ - public static MethodHandle Two_destroy$handle() { - return Two_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Two_destroy(Two *self) - * } - */ - public static MemorySegment Two_destroy$address() { - return Two_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void Two_destroy(Two *self) - * } - */ - public static void Two_destroy(MemorySegment self) { - var mh$ = Two_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Two_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class RefList_node { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("RefList_node"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * RefList *RefList_node(const RefListParameter *data) - * } - */ - public static FunctionDescriptor RefList_node$descriptor() { - return RefList_node.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * RefList *RefList_node(const RefListParameter *data) - * } - */ - public static MethodHandle RefList_node$handle() { - return RefList_node.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * RefList *RefList_node(const RefListParameter *data) - * } - */ - public static MemorySegment RefList_node$address() { - return RefList_node.ADDR; - } - - /** - * {@snippet lang=c : - * RefList *RefList_node(const RefListParameter *data) - * } - */ - public static MemorySegment RefList_node(MemorySegment data) { - var mh$ = RefList_node.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("RefList_node", data); - } - return (MemorySegment)mh$.invokeExact(data); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class RefList_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("RefList_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void RefList_destroy(RefList *self) - * } - */ - public static FunctionDescriptor RefList_destroy$descriptor() { - return RefList_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void RefList_destroy(RefList *self) - * } - */ - public static MethodHandle RefList_destroy$handle() { - return RefList_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void RefList_destroy(RefList *self) - * } - */ - public static MemorySegment RefList_destroy$address() { - return RefList_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void RefList_destroy(RefList *self) - * } - */ - public static void RefList_destroy(MemorySegment self) { - var mh$ = RefList_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("RefList_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class RefListParameter_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("RefListParameter_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void RefListParameter_destroy(RefListParameter *self) - * } - */ - public static FunctionDescriptor RefListParameter_destroy$descriptor() { - return RefListParameter_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void RefListParameter_destroy(RefListParameter *self) - * } - */ - public static MethodHandle RefListParameter_destroy$handle() { - return RefListParameter_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void RefListParameter_destroy(RefListParameter *self) - * } - */ - public static MemorySegment RefListParameter_destroy$address() { - return RefListParameter_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void RefListParameter_destroy(RefListParameter *self) - * } - */ - public static void RefListParameter_destroy(MemorySegment self) { - var mh$ = RefListParameter_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("RefListParameter_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatF64View.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new(DiplomatF64View v) - * } - */ - public static FunctionDescriptor Float64Vec_new$descriptor() { - return Float64Vec_new.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new(DiplomatF64View v) - * } - */ - public static MethodHandle Float64Vec_new$handle() { - return Float64Vec_new.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new(DiplomatF64View v) - * } - */ - public static MemorySegment Float64Vec_new$address() { - return Float64Vec_new.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new(DiplomatF64View v) - * } - */ - public static MemorySegment Float64Vec_new(MemorySegment v) { - var mh$ = Float64Vec_new.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new_bool { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatBoolView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new_bool"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_bool(DiplomatBoolView v) - * } - */ - public static FunctionDescriptor Float64Vec_new_bool$descriptor() { - return Float64Vec_new_bool.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_bool(DiplomatBoolView v) - * } - */ - public static MethodHandle Float64Vec_new_bool$handle() { - return Float64Vec_new_bool.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_bool(DiplomatBoolView v) - * } - */ - public static MemorySegment Float64Vec_new_bool$address() { - return Float64Vec_new_bool.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_bool(DiplomatBoolView v) - * } - */ - public static MemorySegment Float64Vec_new_bool(MemorySegment v) { - var mh$ = Float64Vec_new_bool.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new_bool", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new_i16 { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatI16View.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new_i16"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_i16(DiplomatI16View v) - * } - */ - public static FunctionDescriptor Float64Vec_new_i16$descriptor() { - return Float64Vec_new_i16.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_i16(DiplomatI16View v) - * } - */ - public static MethodHandle Float64Vec_new_i16$handle() { - return Float64Vec_new_i16.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_i16(DiplomatI16View v) - * } - */ - public static MemorySegment Float64Vec_new_i16$address() { - return Float64Vec_new_i16.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_i16(DiplomatI16View v) - * } - */ - public static MemorySegment Float64Vec_new_i16(MemorySegment v) { - var mh$ = Float64Vec_new_i16.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new_i16", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new_u16 { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatU16View.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new_u16"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_u16(DiplomatU16View v) - * } - */ - public static FunctionDescriptor Float64Vec_new_u16$descriptor() { - return Float64Vec_new_u16.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_u16(DiplomatU16View v) - * } - */ - public static MethodHandle Float64Vec_new_u16$handle() { - return Float64Vec_new_u16.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_u16(DiplomatU16View v) - * } - */ - public static MemorySegment Float64Vec_new_u16$address() { - return Float64Vec_new_u16.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_u16(DiplomatU16View v) - * } - */ - public static MemorySegment Float64Vec_new_u16(MemorySegment v) { - var mh$ = Float64Vec_new_u16.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new_u16", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new_isize { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatIsizeView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new_isize"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_isize(DiplomatIsizeView v) - * } - */ - public static FunctionDescriptor Float64Vec_new_isize$descriptor() { - return Float64Vec_new_isize.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_isize(DiplomatIsizeView v) - * } - */ - public static MethodHandle Float64Vec_new_isize$handle() { - return Float64Vec_new_isize.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_isize(DiplomatIsizeView v) - * } - */ - public static MemorySegment Float64Vec_new_isize$address() { - return Float64Vec_new_isize.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_isize(DiplomatIsizeView v) - * } - */ - public static MemorySegment Float64Vec_new_isize(MemorySegment v) { - var mh$ = Float64Vec_new_isize.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new_isize", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new_usize { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatUsizeView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new_usize"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_usize(DiplomatUsizeView v) - * } - */ - public static FunctionDescriptor Float64Vec_new_usize$descriptor() { - return Float64Vec_new_usize.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_usize(DiplomatUsizeView v) - * } - */ - public static MethodHandle Float64Vec_new_usize$handle() { - return Float64Vec_new_usize.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_usize(DiplomatUsizeView v) - * } - */ - public static MemorySegment Float64Vec_new_usize$address() { - return Float64Vec_new_usize.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_usize(DiplomatUsizeView v) - * } - */ - public static MemorySegment Float64Vec_new_usize(MemorySegment v) { - var mh$ = Float64Vec_new_usize.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new_usize", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_new_f64_be_bytes { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatU8View.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_new_f64_be_bytes"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_f64_be_bytes(DiplomatU8View v) - * } - */ - public static FunctionDescriptor Float64Vec_new_f64_be_bytes$descriptor() { - return Float64Vec_new_f64_be_bytes.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_f64_be_bytes(DiplomatU8View v) - * } - */ - public static MethodHandle Float64Vec_new_f64_be_bytes$handle() { - return Float64Vec_new_f64_be_bytes.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_f64_be_bytes(DiplomatU8View v) - * } - */ - public static MemorySegment Float64Vec_new_f64_be_bytes$address() { - return Float64Vec_new_f64_be_bytes.ADDR; - } - - /** - * {@snippet lang=c : - * Float64Vec *Float64Vec_new_f64_be_bytes(DiplomatU8View v) - * } - */ - public static MemorySegment Float64Vec_new_f64_be_bytes(MemorySegment v) { - var mh$ = Float64Vec_new_f64_be_bytes.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_new_f64_be_bytes", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_as_slice { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - DiplomatF64View.layout(), - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_as_slice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * DiplomatF64View Float64Vec_as_slice(const Float64Vec *self) - * } - */ - public static FunctionDescriptor Float64Vec_as_slice$descriptor() { - return Float64Vec_as_slice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * DiplomatF64View Float64Vec_as_slice(const Float64Vec *self) - * } - */ - public static MethodHandle Float64Vec_as_slice$handle() { - return Float64Vec_as_slice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * DiplomatF64View Float64Vec_as_slice(const Float64Vec *self) - * } - */ - public static MemorySegment Float64Vec_as_slice$address() { - return Float64Vec_as_slice.ADDR; - } - - /** - * {@snippet lang=c : - * DiplomatF64View Float64Vec_as_slice(const Float64Vec *self) - * } - */ - public static MemorySegment Float64Vec_as_slice(SegmentAllocator allocator, MemorySegment self) { - var mh$ = Float64Vec_as_slice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_as_slice", allocator, self); - } - return (MemorySegment)mh$.invokeExact(allocator, self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_fill_slice { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - DiplomatF64ViewMut.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_fill_slice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Float64Vec_fill_slice(const Float64Vec *self, DiplomatF64ViewMut v) - * } - */ - public static FunctionDescriptor Float64Vec_fill_slice$descriptor() { - return Float64Vec_fill_slice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Float64Vec_fill_slice(const Float64Vec *self, DiplomatF64ViewMut v) - * } - */ - public static MethodHandle Float64Vec_fill_slice$handle() { - return Float64Vec_fill_slice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Float64Vec_fill_slice(const Float64Vec *self, DiplomatF64ViewMut v) - * } - */ - public static MemorySegment Float64Vec_fill_slice$address() { - return Float64Vec_fill_slice.ADDR; - } - - /** - * {@snippet lang=c : - * void Float64Vec_fill_slice(const Float64Vec *self, DiplomatF64ViewMut v) - * } - */ - public static void Float64Vec_fill_slice(MemorySegment self, MemorySegment v) { - var mh$ = Float64Vec_fill_slice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_fill_slice", self, v); - } - mh$.invokeExact(self, v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_set_value { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - DiplomatF64View.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_set_value"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Float64Vec_set_value(Float64Vec *self, DiplomatF64View new_slice) - * } - */ - public static FunctionDescriptor Float64Vec_set_value$descriptor() { - return Float64Vec_set_value.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Float64Vec_set_value(Float64Vec *self, DiplomatF64View new_slice) - * } - */ - public static MethodHandle Float64Vec_set_value$handle() { - return Float64Vec_set_value.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Float64Vec_set_value(Float64Vec *self, DiplomatF64View new_slice) - * } - */ - public static MemorySegment Float64Vec_set_value$address() { - return Float64Vec_set_value.ADDR; - } - - /** - * {@snippet lang=c : - * void Float64Vec_set_value(Float64Vec *self, DiplomatF64View new_slice) - * } - */ - public static void Float64Vec_set_value(MemorySegment self, MemorySegment new_slice) { - var mh$ = Float64Vec_set_value.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_set_value", self, new_slice); - } - mh$.invokeExact(self, new_slice); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_to_string { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_to_string"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Float64Vec_to_string(const Float64Vec *self, DiplomatWrite *write) - * } - */ - public static FunctionDescriptor Float64Vec_to_string$descriptor() { - return Float64Vec_to_string.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Float64Vec_to_string(const Float64Vec *self, DiplomatWrite *write) - * } - */ - public static MethodHandle Float64Vec_to_string$handle() { - return Float64Vec_to_string.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Float64Vec_to_string(const Float64Vec *self, DiplomatWrite *write) - * } - */ - public static MemorySegment Float64Vec_to_string$address() { - return Float64Vec_to_string.ADDR; - } - - /** - * {@snippet lang=c : - * void Float64Vec_to_string(const Float64Vec *self, DiplomatWrite *write) - * } - */ - public static void Float64Vec_to_string(MemorySegment self, MemorySegment write) { - var mh$ = Float64Vec_to_string.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_to_string", self, write); - } - mh$.invokeExact(self, write); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_borrow { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - DiplomatF64View.layout(), - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_borrow"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * DiplomatF64View Float64Vec_borrow(const Float64Vec *self) - * } - */ - public static FunctionDescriptor Float64Vec_borrow$descriptor() { - return Float64Vec_borrow.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * DiplomatF64View Float64Vec_borrow(const Float64Vec *self) - * } - */ - public static MethodHandle Float64Vec_borrow$handle() { - return Float64Vec_borrow.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * DiplomatF64View Float64Vec_borrow(const Float64Vec *self) - * } - */ - public static MemorySegment Float64Vec_borrow$address() { - return Float64Vec_borrow.ADDR; - } - - /** - * {@snippet lang=c : - * DiplomatF64View Float64Vec_borrow(const Float64Vec *self) - * } - */ - public static MemorySegment Float64Vec_borrow(SegmentAllocator allocator, MemorySegment self) { - var mh$ = Float64Vec_borrow.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_borrow", allocator, self); - } - return (MemorySegment)mh$.invokeExact(allocator, self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Float64Vec_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Float64Vec_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Float64Vec_destroy(Float64Vec *self) - * } - */ - public static FunctionDescriptor Float64Vec_destroy$descriptor() { - return Float64Vec_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Float64Vec_destroy(Float64Vec *self) - * } - */ - public static MethodHandle Float64Vec_destroy$handle() { - return Float64Vec_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Float64Vec_destroy(Float64Vec *self) - * } - */ - public static MemorySegment Float64Vec_destroy$address() { - return Float64Vec_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void Float64Vec_destroy(Float64Vec *self) - * } - */ - public static void Float64Vec_destroy(MemorySegment self) { - var mh$ = Float64Vec_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Float64Vec_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_new { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_new"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * MyString *MyString_new(DiplomatStringView v) - * } - */ - public static FunctionDescriptor MyString_new$descriptor() { - return MyString_new.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * MyString *MyString_new(DiplomatStringView v) - * } - */ - public static MethodHandle MyString_new$handle() { - return MyString_new.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * MyString *MyString_new(DiplomatStringView v) - * } - */ - public static MemorySegment MyString_new$address() { - return MyString_new.ADDR; - } - - /** - * {@snippet lang=c : - * MyString *MyString_new(DiplomatStringView v) - * } - */ - public static MemorySegment MyString_new(MemorySegment v) { - var mh$ = MyString_new.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_new", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_new_unsafe { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_new_unsafe"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * MyString *MyString_new_unsafe(DiplomatStringView v) - * } - */ - public static FunctionDescriptor MyString_new_unsafe$descriptor() { - return MyString_new_unsafe.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * MyString *MyString_new_unsafe(DiplomatStringView v) - * } - */ - public static MethodHandle MyString_new_unsafe$handle() { - return MyString_new_unsafe.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * MyString *MyString_new_unsafe(DiplomatStringView v) - * } - */ - public static MemorySegment MyString_new_unsafe$address() { - return MyString_new_unsafe.ADDR; - } - - /** - * {@snippet lang=c : - * MyString *MyString_new_unsafe(DiplomatStringView v) - * } - */ - public static MemorySegment MyString_new_unsafe(MemorySegment v) { - var mh$ = MyString_new_unsafe.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_new_unsafe", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_new_from_first { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatStringsView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_new_from_first"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * MyString *MyString_new_from_first(DiplomatStringsView v) - * } - */ - public static FunctionDescriptor MyString_new_from_first$descriptor() { - return MyString_new_from_first.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * MyString *MyString_new_from_first(DiplomatStringsView v) - * } - */ - public static MethodHandle MyString_new_from_first$handle() { - return MyString_new_from_first.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * MyString *MyString_new_from_first(DiplomatStringsView v) - * } - */ - public static MemorySegment MyString_new_from_first$address() { - return MyString_new_from_first.ADDR; - } - - /** - * {@snippet lang=c : - * MyString *MyString_new_from_first(DiplomatStringsView v) - * } - */ - public static MemorySegment MyString_new_from_first(MemorySegment v) { - var mh$ = MyString_new_from_first.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_new_from_first", v); - } - return (MemorySegment)mh$.invokeExact(v); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_set_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_set_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void MyString_set_str(MyString *self, DiplomatStringView new_str) - * } - */ - public static FunctionDescriptor MyString_set_str$descriptor() { - return MyString_set_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void MyString_set_str(MyString *self, DiplomatStringView new_str) - * } - */ - public static MethodHandle MyString_set_str$handle() { - return MyString_set_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void MyString_set_str(MyString *self, DiplomatStringView new_str) - * } - */ - public static MemorySegment MyString_set_str$address() { - return MyString_set_str.ADDR; - } - - /** - * {@snippet lang=c : - * void MyString_set_str(MyString *self, DiplomatStringView new_str) - * } - */ - public static void MyString_set_str(MemorySegment self, MemorySegment new_str) { - var mh$ = MyString_set_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_set_str", self, new_str); - } - mh$.invokeExact(self, new_str); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_get_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_get_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void MyString_get_str(const MyString *self, DiplomatWrite *write) - * } - */ - public static FunctionDescriptor MyString_get_str$descriptor() { - return MyString_get_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void MyString_get_str(const MyString *self, DiplomatWrite *write) - * } - */ - public static MethodHandle MyString_get_str$handle() { - return MyString_get_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void MyString_get_str(const MyString *self, DiplomatWrite *write) - * } - */ - public static MemorySegment MyString_get_str$address() { - return MyString_get_str.ADDR; - } - - /** - * {@snippet lang=c : - * void MyString_get_str(const MyString *self, DiplomatWrite *write) - * } - */ - public static void MyString_get_str(MemorySegment self, MemorySegment write) { - var mh$ = MyString_get_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_get_str", self, write); - } - mh$.invokeExact(self, write); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_string_transform { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - DiplomatStringView.layout(), - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_string_transform"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void MyString_string_transform(DiplomatStringView foo, DiplomatWrite *write) - * } - */ - public static FunctionDescriptor MyString_string_transform$descriptor() { - return MyString_string_transform.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void MyString_string_transform(DiplomatStringView foo, DiplomatWrite *write) - * } - */ - public static MethodHandle MyString_string_transform$handle() { - return MyString_string_transform.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void MyString_string_transform(DiplomatStringView foo, DiplomatWrite *write) - * } - */ - public static MemorySegment MyString_string_transform$address() { - return MyString_string_transform.ADDR; - } - - /** - * {@snippet lang=c : - * void MyString_string_transform(DiplomatStringView foo, DiplomatWrite *write) - * } - */ - public static void MyString_string_transform(MemorySegment foo, MemorySegment write) { - var mh$ = MyString_string_transform.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_string_transform", foo, write); - } - mh$.invokeExact(foo, write); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyString_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyString_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void MyString_destroy(MyString *self) - * } - */ - public static FunctionDescriptor MyString_destroy$descriptor() { - return MyString_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void MyString_destroy(MyString *self) - * } - */ - public static MethodHandle MyString_destroy$handle() { - return MyString_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void MyString_destroy(MyString *self) - * } - */ - public static MemorySegment MyString_destroy$address() { - return MyString_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void MyString_destroy(MyString *self) - * } - */ - public static void MyString_destroy(MemorySegment self) { - var mh$ = MyString_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyString_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_new { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_new"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Opaque *Opaque_new() - * } - */ - public static FunctionDescriptor Opaque_new$descriptor() { - return Opaque_new.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Opaque *Opaque_new() - * } - */ - public static MethodHandle Opaque_new$handle() { - return Opaque_new.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Opaque *Opaque_new() - * } - */ - public static MemorySegment Opaque_new$address() { - return Opaque_new.ADDR; - } - - /** - * {@snippet lang=c : - * Opaque *Opaque_new() - * } - */ - public static MemorySegment Opaque_new() { - var mh$ = Opaque_new.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_new"); - } - return (MemorySegment)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_from_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatStringView.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_from_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Opaque *Opaque_from_str(DiplomatStringView input) - * } - */ - public static FunctionDescriptor Opaque_from_str$descriptor() { - return Opaque_from_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Opaque *Opaque_from_str(DiplomatStringView input) - * } - */ - public static MethodHandle Opaque_from_str$handle() { - return Opaque_from_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Opaque *Opaque_from_str(DiplomatStringView input) - * } - */ - public static MemorySegment Opaque_from_str$address() { - return Opaque_from_str.ADDR; - } - - /** - * {@snippet lang=c : - * Opaque *Opaque_from_str(DiplomatStringView input) - * } - */ - public static MemorySegment Opaque_from_str(MemorySegment input) { - var mh$ = Opaque_from_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_from_str", input); - } - return (MemorySegment)mh$.invokeExact(input); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_get_debug_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_get_debug_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Opaque_get_debug_str(const Opaque *self, DiplomatWrite *write) - * } - */ - public static FunctionDescriptor Opaque_get_debug_str$descriptor() { - return Opaque_get_debug_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Opaque_get_debug_str(const Opaque *self, DiplomatWrite *write) - * } - */ - public static MethodHandle Opaque_get_debug_str$handle() { - return Opaque_get_debug_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Opaque_get_debug_str(const Opaque *self, DiplomatWrite *write) - * } - */ - public static MemorySegment Opaque_get_debug_str$address() { - return Opaque_get_debug_str.ADDR; - } - - /** - * {@snippet lang=c : - * void Opaque_get_debug_str(const Opaque *self, DiplomatWrite *write) - * } - */ - public static void Opaque_get_debug_str(MemorySegment self, MemorySegment write) { - var mh$ = Opaque_get_debug_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_get_debug_str", self, write); - } - mh$.invokeExact(self, write); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_assert_struct { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - MyStruct.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_assert_struct"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Opaque_assert_struct(const Opaque *self, MyStruct s) - * } - */ - public static FunctionDescriptor Opaque_assert_struct$descriptor() { - return Opaque_assert_struct.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Opaque_assert_struct(const Opaque *self, MyStruct s) - * } - */ - public static MethodHandle Opaque_assert_struct$handle() { - return Opaque_assert_struct.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Opaque_assert_struct(const Opaque *self, MyStruct s) - * } - */ - public static MemorySegment Opaque_assert_struct$address() { - return Opaque_assert_struct.ADDR; - } - - /** - * {@snippet lang=c : - * void Opaque_assert_struct(const Opaque *self, MyStruct s) - * } - */ - public static void Opaque_assert_struct(MemorySegment self, MemorySegment s) { - var mh$ = Opaque_assert_struct.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_assert_struct", self, s); - } - mh$.invokeExact(self, s); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_returns_usize { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_returns_usize"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t Opaque_returns_usize() - * } - */ - public static FunctionDescriptor Opaque_returns_usize$descriptor() { - return Opaque_returns_usize.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t Opaque_returns_usize() - * } - */ - public static MethodHandle Opaque_returns_usize$handle() { - return Opaque_returns_usize.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t Opaque_returns_usize() - * } - */ - public static MemorySegment Opaque_returns_usize$address() { - return Opaque_returns_usize.ADDR; - } - - /** - * {@snippet lang=c : - * size_t Opaque_returns_usize() - * } - */ - public static long Opaque_returns_usize() { - var mh$ = Opaque_returns_usize.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_returns_usize"); - } - return (long)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_internal_len { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_internal_len"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t Opaque_internal_len(const Opaque *self) - * } - */ - public static FunctionDescriptor Opaque_internal_len$descriptor() { - return Opaque_internal_len.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t Opaque_internal_len(const Opaque *self) - * } - */ - public static MethodHandle Opaque_internal_len$handle() { - return Opaque_internal_len.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t Opaque_internal_len(const Opaque *self) - * } - */ - public static MemorySegment Opaque_internal_len$address() { - return Opaque_internal_len.ADDR; - } - - /** - * {@snippet lang=c : - * size_t Opaque_internal_len(const Opaque *self) - * } - */ - public static long Opaque_internal_len(MemorySegment self) { - var mh$ = Opaque_internal_len.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_internal_len", self); - } - return (long)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_returns_imported { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - ImportedStruct.layout() ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_returns_imported"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * ImportedStruct Opaque_returns_imported() - * } - */ - public static FunctionDescriptor Opaque_returns_imported$descriptor() { - return Opaque_returns_imported.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * ImportedStruct Opaque_returns_imported() - * } - */ - public static MethodHandle Opaque_returns_imported$handle() { - return Opaque_returns_imported.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * ImportedStruct Opaque_returns_imported() - * } - */ - public static MemorySegment Opaque_returns_imported$address() { - return Opaque_returns_imported.ADDR; - } - - /** - * {@snippet lang=c : - * ImportedStruct Opaque_returns_imported() - * } - */ - public static MemorySegment Opaque_returns_imported(SegmentAllocator allocator) { - var mh$ = Opaque_returns_imported.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_returns_imported", allocator); - } - return (MemorySegment)mh$.invokeExact(allocator); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_cmp { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_CHAR ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_cmp"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int8_t Opaque_cmp() - * } - */ - public static FunctionDescriptor Opaque_cmp$descriptor() { - return Opaque_cmp.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int8_t Opaque_cmp() - * } - */ - public static MethodHandle Opaque_cmp$handle() { - return Opaque_cmp.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int8_t Opaque_cmp() - * } - */ - public static MemorySegment Opaque_cmp$address() { - return Opaque_cmp.ADDR; - } - - /** - * {@snippet lang=c : - * int8_t Opaque_cmp() - * } - */ - public static byte Opaque_cmp() { - var mh$ = Opaque_cmp.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_cmp"); - } - return (byte)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Opaque_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Opaque_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Opaque_destroy(Opaque *self) - * } - */ - public static FunctionDescriptor Opaque_destroy$descriptor() { - return Opaque_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Opaque_destroy(Opaque *self) - * } - */ - public static MethodHandle Opaque_destroy$handle() { - return Opaque_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Opaque_destroy(Opaque *self) - * } - */ - public static MemorySegment Opaque_destroy$address() { - return Opaque_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void Opaque_destroy(Opaque *self) - * } - */ - public static void Opaque_destroy(MemorySegment self) { - var mh$ = Opaque_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Opaque_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_from_usize { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_from_usize"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * OpaqueMutexedString *OpaqueMutexedString_from_usize(size_t number) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_from_usize$descriptor() { - return OpaqueMutexedString_from_usize.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * OpaqueMutexedString *OpaqueMutexedString_from_usize(size_t number) - * } - */ - public static MethodHandle OpaqueMutexedString_from_usize$handle() { - return OpaqueMutexedString_from_usize.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * OpaqueMutexedString *OpaqueMutexedString_from_usize(size_t number) - * } - */ - public static MemorySegment OpaqueMutexedString_from_usize$address() { - return OpaqueMutexedString_from_usize.ADDR; - } - - /** - * {@snippet lang=c : - * OpaqueMutexedString *OpaqueMutexedString_from_usize(size_t number) - * } - */ - public static MemorySegment OpaqueMutexedString_from_usize(long number) { - var mh$ = OpaqueMutexedString_from_usize.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_from_usize", number); - } - return (MemorySegment)mh$.invokeExact(number); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_change { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_change"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void OpaqueMutexedString_change(const OpaqueMutexedString *self, size_t number) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_change$descriptor() { - return OpaqueMutexedString_change.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void OpaqueMutexedString_change(const OpaqueMutexedString *self, size_t number) - * } - */ - public static MethodHandle OpaqueMutexedString_change$handle() { - return OpaqueMutexedString_change.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void OpaqueMutexedString_change(const OpaqueMutexedString *self, size_t number) - * } - */ - public static MemorySegment OpaqueMutexedString_change$address() { - return OpaqueMutexedString_change.ADDR; - } - - /** - * {@snippet lang=c : - * void OpaqueMutexedString_change(const OpaqueMutexedString *self, size_t number) - * } - */ - public static void OpaqueMutexedString_change(MemorySegment self, long number) { - var mh$ = OpaqueMutexedString_change.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_change", self, number); - } - mh$.invokeExact(self, number); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_borrow { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_borrow"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow(const OpaqueMutexedString *self) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_borrow$descriptor() { - return OpaqueMutexedString_borrow.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow(const OpaqueMutexedString *self) - * } - */ - public static MethodHandle OpaqueMutexedString_borrow$handle() { - return OpaqueMutexedString_borrow.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow(const OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_borrow$address() { - return OpaqueMutexedString_borrow.ADDR; - } - - /** - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow(const OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_borrow(MemorySegment self) { - var mh$ = OpaqueMutexedString_borrow.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_borrow", self); - } - return (MemorySegment)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_borrow_other { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_borrow_other"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_other(const OpaqueMutexedString *other) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_borrow_other$descriptor() { - return OpaqueMutexedString_borrow_other.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_other(const OpaqueMutexedString *other) - * } - */ - public static MethodHandle OpaqueMutexedString_borrow_other$handle() { - return OpaqueMutexedString_borrow_other.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_other(const OpaqueMutexedString *other) - * } - */ - public static MemorySegment OpaqueMutexedString_borrow_other$address() { - return OpaqueMutexedString_borrow_other.ADDR; - } - - /** - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_other(const OpaqueMutexedString *other) - * } - */ - public static MemorySegment OpaqueMutexedString_borrow_other(MemorySegment other) { - var mh$ = OpaqueMutexedString_borrow_other.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_borrow_other", other); - } - return (MemorySegment)mh$.invokeExact(other); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_borrow_self_or_other { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_borrow_self_or_other"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_self_or_other(const OpaqueMutexedString *self, const OpaqueMutexedString *other) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_borrow_self_or_other$descriptor() { - return OpaqueMutexedString_borrow_self_or_other.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_self_or_other(const OpaqueMutexedString *self, const OpaqueMutexedString *other) - * } - */ - public static MethodHandle OpaqueMutexedString_borrow_self_or_other$handle() { - return OpaqueMutexedString_borrow_self_or_other.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_self_or_other(const OpaqueMutexedString *self, const OpaqueMutexedString *other) - * } - */ - public static MemorySegment OpaqueMutexedString_borrow_self_or_other$address() { - return OpaqueMutexedString_borrow_self_or_other.ADDR; - } - - /** - * {@snippet lang=c : - * const OpaqueMutexedString *OpaqueMutexedString_borrow_self_or_other(const OpaqueMutexedString *self, const OpaqueMutexedString *other) - * } - */ - public static MemorySegment OpaqueMutexedString_borrow_self_or_other(MemorySegment self, MemorySegment other) { - var mh$ = OpaqueMutexedString_borrow_self_or_other.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_borrow_self_or_other", self, other); - } - return (MemorySegment)mh$.invokeExact(self, other); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_get_len_and_add { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_LONG, - somelib_h.C_POINTER, - somelib_h.C_LONG - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_get_len_and_add"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * size_t OpaqueMutexedString_get_len_and_add(const OpaqueMutexedString *self, size_t other) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_get_len_and_add$descriptor() { - return OpaqueMutexedString_get_len_and_add.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * size_t OpaqueMutexedString_get_len_and_add(const OpaqueMutexedString *self, size_t other) - * } - */ - public static MethodHandle OpaqueMutexedString_get_len_and_add$handle() { - return OpaqueMutexedString_get_len_and_add.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * size_t OpaqueMutexedString_get_len_and_add(const OpaqueMutexedString *self, size_t other) - * } - */ - public static MemorySegment OpaqueMutexedString_get_len_and_add$address() { - return OpaqueMutexedString_get_len_and_add.ADDR; - } - - /** - * {@snippet lang=c : - * size_t OpaqueMutexedString_get_len_and_add(const OpaqueMutexedString *self, size_t other) - * } - */ - public static long OpaqueMutexedString_get_len_and_add(MemorySegment self, long other) { - var mh$ = OpaqueMutexedString_get_len_and_add.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_get_len_and_add", self, other); - } - return (long)mh$.invokeExact(self, other); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_dummy_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - DiplomatStringView.layout(), - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_dummy_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * DiplomatStringView OpaqueMutexedString_dummy_str(const OpaqueMutexedString *self) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_dummy_str$descriptor() { - return OpaqueMutexedString_dummy_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * DiplomatStringView OpaqueMutexedString_dummy_str(const OpaqueMutexedString *self) - * } - */ - public static MethodHandle OpaqueMutexedString_dummy_str$handle() { - return OpaqueMutexedString_dummy_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * DiplomatStringView OpaqueMutexedString_dummy_str(const OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_dummy_str$address() { - return OpaqueMutexedString_dummy_str.ADDR; - } - - /** - * {@snippet lang=c : - * DiplomatStringView OpaqueMutexedString_dummy_str(const OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_dummy_str(SegmentAllocator allocator, MemorySegment self) { - var mh$ = OpaqueMutexedString_dummy_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_dummy_str", allocator, self); - } - return (MemorySegment)mh$.invokeExact(allocator, self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_wrapper { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_wrapper"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Utf16Wrap *OpaqueMutexedString_wrapper(const OpaqueMutexedString *self) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_wrapper$descriptor() { - return OpaqueMutexedString_wrapper.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Utf16Wrap *OpaqueMutexedString_wrapper(const OpaqueMutexedString *self) - * } - */ - public static MethodHandle OpaqueMutexedString_wrapper$handle() { - return OpaqueMutexedString_wrapper.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Utf16Wrap *OpaqueMutexedString_wrapper(const OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_wrapper$address() { - return OpaqueMutexedString_wrapper.ADDR; - } - - /** - * {@snippet lang=c : - * Utf16Wrap *OpaqueMutexedString_wrapper(const OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_wrapper(MemorySegment self) { - var mh$ = OpaqueMutexedString_wrapper.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_wrapper", self); - } - return (MemorySegment)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class OpaqueMutexedString_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("OpaqueMutexedString_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void OpaqueMutexedString_destroy(OpaqueMutexedString *self) - * } - */ - public static FunctionDescriptor OpaqueMutexedString_destroy$descriptor() { - return OpaqueMutexedString_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void OpaqueMutexedString_destroy(OpaqueMutexedString *self) - * } - */ - public static MethodHandle OpaqueMutexedString_destroy$handle() { - return OpaqueMutexedString_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void OpaqueMutexedString_destroy(OpaqueMutexedString *self) - * } - */ - public static MemorySegment OpaqueMutexedString_destroy$address() { - return OpaqueMutexedString_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void OpaqueMutexedString_destroy(OpaqueMutexedString *self) - * } - */ - public static void OpaqueMutexedString_destroy(MemorySegment self) { - var mh$ = OpaqueMutexedString_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("OpaqueMutexedString_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Utf16Wrap_from_utf16 { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_POINTER, - DiplomatString16View.layout() - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Utf16Wrap_from_utf16"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * Utf16Wrap *Utf16Wrap_from_utf16(DiplomatString16View input) - * } - */ - public static FunctionDescriptor Utf16Wrap_from_utf16$descriptor() { - return Utf16Wrap_from_utf16.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * Utf16Wrap *Utf16Wrap_from_utf16(DiplomatString16View input) - * } - */ - public static MethodHandle Utf16Wrap_from_utf16$handle() { - return Utf16Wrap_from_utf16.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * Utf16Wrap *Utf16Wrap_from_utf16(DiplomatString16View input) - * } - */ - public static MemorySegment Utf16Wrap_from_utf16$address() { - return Utf16Wrap_from_utf16.ADDR; - } - - /** - * {@snippet lang=c : - * Utf16Wrap *Utf16Wrap_from_utf16(DiplomatString16View input) - * } - */ - public static MemorySegment Utf16Wrap_from_utf16(MemorySegment input) { - var mh$ = Utf16Wrap_from_utf16.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Utf16Wrap_from_utf16", input); - } - return (MemorySegment)mh$.invokeExact(input); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Utf16Wrap_get_debug_str { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER, - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Utf16Wrap_get_debug_str"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Utf16Wrap_get_debug_str(const Utf16Wrap *self, DiplomatWrite *write) - * } - */ - public static FunctionDescriptor Utf16Wrap_get_debug_str$descriptor() { - return Utf16Wrap_get_debug_str.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Utf16Wrap_get_debug_str(const Utf16Wrap *self, DiplomatWrite *write) - * } - */ - public static MethodHandle Utf16Wrap_get_debug_str$handle() { - return Utf16Wrap_get_debug_str.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Utf16Wrap_get_debug_str(const Utf16Wrap *self, DiplomatWrite *write) - * } - */ - public static MemorySegment Utf16Wrap_get_debug_str$address() { - return Utf16Wrap_get_debug_str.ADDR; - } - - /** - * {@snippet lang=c : - * void Utf16Wrap_get_debug_str(const Utf16Wrap *self, DiplomatWrite *write) - * } - */ - public static void Utf16Wrap_get_debug_str(MemorySegment self, MemorySegment write) { - var mh$ = Utf16Wrap_get_debug_str.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Utf16Wrap_get_debug_str", self, write); - } - mh$.invokeExact(self, write); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Utf16Wrap_borrow_cont { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - DiplomatString16View.layout(), - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Utf16Wrap_borrow_cont"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * DiplomatString16View Utf16Wrap_borrow_cont(const Utf16Wrap *self) - * } - */ - public static FunctionDescriptor Utf16Wrap_borrow_cont$descriptor() { - return Utf16Wrap_borrow_cont.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * DiplomatString16View Utf16Wrap_borrow_cont(const Utf16Wrap *self) - * } - */ - public static MethodHandle Utf16Wrap_borrow_cont$handle() { - return Utf16Wrap_borrow_cont.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * DiplomatString16View Utf16Wrap_borrow_cont(const Utf16Wrap *self) - * } - */ - public static MemorySegment Utf16Wrap_borrow_cont$address() { - return Utf16Wrap_borrow_cont.ADDR; - } - - /** - * {@snippet lang=c : - * DiplomatString16View Utf16Wrap_borrow_cont(const Utf16Wrap *self) - * } - */ - public static MemorySegment Utf16Wrap_borrow_cont(SegmentAllocator allocator, MemorySegment self) { - var mh$ = Utf16Wrap_borrow_cont.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Utf16Wrap_borrow_cont", allocator, self); - } - return (MemorySegment)mh$.invokeExact(allocator, self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class Utf16Wrap_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - somelib_h.C_POINTER - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("Utf16Wrap_destroy"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void Utf16Wrap_destroy(Utf16Wrap *self) - * } - */ - public static FunctionDescriptor Utf16Wrap_destroy$descriptor() { - return Utf16Wrap_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void Utf16Wrap_destroy(Utf16Wrap *self) - * } - */ - public static MethodHandle Utf16Wrap_destroy$handle() { - return Utf16Wrap_destroy.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * void Utf16Wrap_destroy(Utf16Wrap *self) - * } - */ - public static MemorySegment Utf16Wrap_destroy$address() { - return Utf16Wrap_destroy.ADDR; - } - - /** - * {@snippet lang=c : - * void Utf16Wrap_destroy(Utf16Wrap *self) - * } - */ - public static void Utf16Wrap_destroy(MemorySegment self) { - var mh$ = Utf16Wrap_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("Utf16Wrap_destroy", self); - } - mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int ContiguousEnum_C = (int)0L; - /** - * {@snippet lang=c : - * enum ContiguousEnum.ContiguousEnum_C = 0 - * } - */ - public static int ContiguousEnum_C() { - return ContiguousEnum_C; - } - private static final int ContiguousEnum_D = (int)1L; - /** - * {@snippet lang=c : - * enum ContiguousEnum.ContiguousEnum_D = 1 - * } - */ - public static int ContiguousEnum_D() { - return ContiguousEnum_D; - } - private static final int ContiguousEnum_E = (int)2L; - /** - * {@snippet lang=c : - * enum ContiguousEnum.ContiguousEnum_E = 2 - * } - */ - public static int ContiguousEnum_E() { - return ContiguousEnum_E; - } - private static final int ContiguousEnum_F = (int)3L; - /** - * {@snippet lang=c : - * enum ContiguousEnum.ContiguousEnum_F = 3 - * } - */ - public static int ContiguousEnum_F() { - return ContiguousEnum_F; - } - - private static class MyEnum_into_value { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_CHAR, - somelib_h.C_INT - ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyEnum_into_value"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int8_t MyEnum_into_value(MyEnum self) - * } - */ - public static FunctionDescriptor MyEnum_into_value$descriptor() { - return MyEnum_into_value.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int8_t MyEnum_into_value(MyEnum self) - * } - */ - public static MethodHandle MyEnum_into_value$handle() { - return MyEnum_into_value.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * int8_t MyEnum_into_value(MyEnum self) - * } - */ - public static MemorySegment MyEnum_into_value$address() { - return MyEnum_into_value.ADDR; - } - - /** - * {@snippet lang=c : - * int8_t MyEnum_into_value(MyEnum self) - * } - */ - public static byte MyEnum_into_value(int self) { - var mh$ = MyEnum_into_value.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyEnum_into_value", self); - } - return (byte)mh$.invokeExact(self); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class MyEnum_get_a { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - somelib_h.C_INT ); - - public static final MemorySegment ADDR = somelib_h.findOrThrow("MyEnum_get_a"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * MyEnum MyEnum_get_a() - * } - */ - public static FunctionDescriptor MyEnum_get_a$descriptor() { - return MyEnum_get_a.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * MyEnum MyEnum_get_a() - * } - */ - public static MethodHandle MyEnum_get_a$handle() { - return MyEnum_get_a.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * MyEnum MyEnum_get_a() - * } - */ - public static MemorySegment MyEnum_get_a$address() { - return MyEnum_get_a.ADDR; - } - - /** - * {@snippet lang=c : - * MyEnum MyEnum_get_a() - * } - */ - public static int MyEnum_get_a() { - var mh$ = MyEnum_get_a.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("MyEnum_get_a"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet lang=c : - * #define __DARWIN_SUF_EXTSN "$DARWIN_EXTSN" - * } - */ - public static MemorySegment __DARWIN_SUF_EXTSN() { - class Holder { - static final MemorySegment __DARWIN_SUF_EXTSN - = somelib_h.LIBRARY_ARENA.allocateFrom("$DARWIN_EXTSN"); - } - return Holder.__DARWIN_SUF_EXTSN; - } - private static final long __DARWIN_C_ANSI = 4096L; - /** - * {@snippet lang=c : - * #define __DARWIN_C_ANSI 4096 - * } - */ - public static long __DARWIN_C_ANSI() { - return __DARWIN_C_ANSI; - } - private static final long __DARWIN_C_FULL = 900000L; - /** - * {@snippet lang=c : - * #define __DARWIN_C_FULL 900000 - * } - */ - public static long __DARWIN_C_FULL() { - return __DARWIN_C_FULL; - } - private static final long __DARWIN_C_LEVEL = 900000L; - /** - * {@snippet lang=c : - * #define __DARWIN_C_LEVEL 900000 - * } - */ - public static long __DARWIN_C_LEVEL() { - return __DARWIN_C_LEVEL; - } - /** - * {@snippet lang=c : - * #define __ASSERT_FILE_NAME "jextract$17679777676981496432.h" - * } - */ - public static MemorySegment __ASSERT_FILE_NAME() { - class Holder { - static final MemorySegment __ASSERT_FILE_NAME - = somelib_h.LIBRARY_ARENA.allocateFrom("jextract$17679777676981496432.h"); - } - return Holder.__ASSERT_FILE_NAME; - } - private static final MemorySegment NULL = MemorySegment.ofAddress(0L); - /** - * {@snippet lang=c : - * #define NULL (void*) 0 - * } - */ - public static MemorySegment NULL() { - return NULL; - } - private static final MemorySegment __DARWIN_NULL = MemorySegment.ofAddress(0L); - /** - * {@snippet lang=c : - * #define __DARWIN_NULL (void*) 0 - * } - */ - public static MemorySegment __DARWIN_NULL() { - return __DARWIN_NULL; - } - private static final long USER_ADDR_NULL = 0L; - /** - * {@snippet lang=c : - * #define USER_ADDR_NULL 0 - * } - */ - public static long USER_ADDR_NULL() { - return USER_ADDR_NULL; - } - private static final long INT64_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INT64_MAX 9223372036854775807 - * } - */ - public static long INT64_MAX() { - return INT64_MAX; - } - private static final int INT8_MIN = (int)-128L; - /** - * {@snippet lang=c : - * #define INT8_MIN -128 - * } - */ - public static int INT8_MIN() { - return INT8_MIN; - } - private static final int INT16_MIN = (int)-32768L; - /** - * {@snippet lang=c : - * #define INT16_MIN -32768 - * } - */ - public static int INT16_MIN() { - return INT16_MIN; - } - private static final int INT32_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT32_MIN -2147483648 - * } - */ - public static int INT32_MIN() { - return INT32_MIN; - } - private static final long INT64_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INT64_MIN -9223372036854775808 - * } - */ - public static long INT64_MIN() { - return INT64_MIN; - } - private static final int UINT32_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT32_MAX 4294967295 - * } - */ - public static int UINT32_MAX() { - return UINT32_MAX; - } - private static final long UINT64_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINT64_MAX -1 - * } - */ - public static long UINT64_MAX() { - return UINT64_MAX; - } - private static final int INT_LEAST8_MIN = (int)-128L; - /** - * {@snippet lang=c : - * #define INT_LEAST8_MIN -128 - * } - */ - public static int INT_LEAST8_MIN() { - return INT_LEAST8_MIN; - } - private static final int INT_LEAST16_MIN = (int)-32768L; - /** - * {@snippet lang=c : - * #define INT_LEAST16_MIN -32768 - * } - */ - public static int INT_LEAST16_MIN() { - return INT_LEAST16_MIN; - } - private static final int INT_LEAST32_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT_LEAST32_MIN -2147483648 - * } - */ - public static int INT_LEAST32_MIN() { - return INT_LEAST32_MIN; - } - private static final long INT_LEAST64_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INT_LEAST64_MIN -9223372036854775808 - * } - */ - public static long INT_LEAST64_MIN() { - return INT_LEAST64_MIN; - } - private static final int INT_LEAST8_MAX = (int)127L; - /** - * {@snippet lang=c : - * #define INT_LEAST8_MAX 127 - * } - */ - public static int INT_LEAST8_MAX() { - return INT_LEAST8_MAX; - } - private static final int INT_LEAST16_MAX = (int)32767L; - /** - * {@snippet lang=c : - * #define INT_LEAST16_MAX 32767 - * } - */ - public static int INT_LEAST16_MAX() { - return INT_LEAST16_MAX; - } - private static final int INT_LEAST32_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT_LEAST32_MAX 2147483647 - * } - */ - public static int INT_LEAST32_MAX() { - return INT_LEAST32_MAX; - } - private static final long INT_LEAST64_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INT_LEAST64_MAX 9223372036854775807 - * } - */ - public static long INT_LEAST64_MAX() { - return INT_LEAST64_MAX; - } - private static final int UINT_LEAST8_MAX = (int)255L; - /** - * {@snippet lang=c : - * #define UINT_LEAST8_MAX 255 - * } - */ - public static int UINT_LEAST8_MAX() { - return UINT_LEAST8_MAX; - } - private static final int UINT_LEAST16_MAX = (int)65535L; - /** - * {@snippet lang=c : - * #define UINT_LEAST16_MAX 65535 - * } - */ - public static int UINT_LEAST16_MAX() { - return UINT_LEAST16_MAX; - } - private static final int UINT_LEAST32_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT_LEAST32_MAX 4294967295 - * } - */ - public static int UINT_LEAST32_MAX() { - return UINT_LEAST32_MAX; - } - private static final long UINT_LEAST64_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINT_LEAST64_MAX -1 - * } - */ - public static long UINT_LEAST64_MAX() { - return UINT_LEAST64_MAX; - } - private static final int INT_FAST8_MIN = (int)-128L; - /** - * {@snippet lang=c : - * #define INT_FAST8_MIN -128 - * } - */ - public static int INT_FAST8_MIN() { - return INT_FAST8_MIN; - } - private static final int INT_FAST16_MIN = (int)-32768L; - /** - * {@snippet lang=c : - * #define INT_FAST16_MIN -32768 - * } - */ - public static int INT_FAST16_MIN() { - return INT_FAST16_MIN; - } - private static final int INT_FAST32_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define INT_FAST32_MIN -2147483648 - * } - */ - public static int INT_FAST32_MIN() { - return INT_FAST32_MIN; - } - private static final long INT_FAST64_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INT_FAST64_MIN -9223372036854775808 - * } - */ - public static long INT_FAST64_MIN() { - return INT_FAST64_MIN; - } - private static final int INT_FAST8_MAX = (int)127L; - /** - * {@snippet lang=c : - * #define INT_FAST8_MAX 127 - * } - */ - public static int INT_FAST8_MAX() { - return INT_FAST8_MAX; - } - private static final int INT_FAST16_MAX = (int)32767L; - /** - * {@snippet lang=c : - * #define INT_FAST16_MAX 32767 - * } - */ - public static int INT_FAST16_MAX() { - return INT_FAST16_MAX; - } - private static final int INT_FAST32_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define INT_FAST32_MAX 2147483647 - * } - */ - public static int INT_FAST32_MAX() { - return INT_FAST32_MAX; - } - private static final long INT_FAST64_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INT_FAST64_MAX 9223372036854775807 - * } - */ - public static long INT_FAST64_MAX() { - return INT_FAST64_MAX; - } - private static final int UINT_FAST8_MAX = (int)255L; - /** - * {@snippet lang=c : - * #define UINT_FAST8_MAX 255 - * } - */ - public static int UINT_FAST8_MAX() { - return UINT_FAST8_MAX; - } - private static final int UINT_FAST16_MAX = (int)65535L; - /** - * {@snippet lang=c : - * #define UINT_FAST16_MAX 65535 - * } - */ - public static int UINT_FAST16_MAX() { - return UINT_FAST16_MAX; - } - private static final int UINT_FAST32_MAX = (int)4294967295L; - /** - * {@snippet lang=c : - * #define UINT_FAST32_MAX 4294967295 - * } - */ - public static int UINT_FAST32_MAX() { - return UINT_FAST32_MAX; - } - private static final long UINT_FAST64_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINT_FAST64_MAX -1 - * } - */ - public static long UINT_FAST64_MAX() { - return UINT_FAST64_MAX; - } - private static final long INTPTR_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INTPTR_MAX 9223372036854775807 - * } - */ - public static long INTPTR_MAX() { - return INTPTR_MAX; - } - private static final long INTPTR_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INTPTR_MIN -9223372036854775808 - * } - */ - public static long INTPTR_MIN() { - return INTPTR_MIN; - } - private static final long UINTPTR_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINTPTR_MAX -1 - * } - */ - public static long UINTPTR_MAX() { - return UINTPTR_MAX; - } - private static final long INTMAX_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define INTMAX_MAX 9223372036854775807 - * } - */ - public static long INTMAX_MAX() { - return INTMAX_MAX; - } - private static final long UINTMAX_MAX = -1L; - /** - * {@snippet lang=c : - * #define UINTMAX_MAX -1 - * } - */ - public static long UINTMAX_MAX() { - return UINTMAX_MAX; - } - private static final long INTMAX_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define INTMAX_MIN -9223372036854775808 - * } - */ - public static long INTMAX_MIN() { - return INTMAX_MIN; - } - private static final long PTRDIFF_MIN = -9223372036854775808L; - /** - * {@snippet lang=c : - * #define PTRDIFF_MIN -9223372036854775808 - * } - */ - public static long PTRDIFF_MIN() { - return PTRDIFF_MIN; - } - private static final long PTRDIFF_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define PTRDIFF_MAX 9223372036854775807 - * } - */ - public static long PTRDIFF_MAX() { - return PTRDIFF_MAX; - } - private static final long SIZE_MAX = -1L; - /** - * {@snippet lang=c : - * #define SIZE_MAX -1 - * } - */ - public static long SIZE_MAX() { - return SIZE_MAX; - } - private static final long RSIZE_MAX = 9223372036854775807L; - /** - * {@snippet lang=c : - * #define RSIZE_MAX 9223372036854775807 - * } - */ - public static long RSIZE_MAX() { - return RSIZE_MAX; - } - private static final int WCHAR_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define WCHAR_MAX 2147483647 - * } - */ - public static int WCHAR_MAX() { - return WCHAR_MAX; - } - private static final int WCHAR_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define WCHAR_MIN -2147483648 - * } - */ - public static int WCHAR_MIN() { - return WCHAR_MIN; - } - private static final int WINT_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define WINT_MIN -2147483648 - * } - */ - public static int WINT_MIN() { - return WINT_MIN; - } - private static final int WINT_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define WINT_MAX 2147483647 - * } - */ - public static int WINT_MAX() { - return WINT_MAX; - } - private static final int SIG_ATOMIC_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define SIG_ATOMIC_MIN -2147483648 - * } - */ - public static int SIG_ATOMIC_MIN() { - return SIG_ATOMIC_MIN; - } - private static final int SIG_ATOMIC_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define SIG_ATOMIC_MAX 2147483647 - * } - */ - public static int SIG_ATOMIC_MAX() { - return SIG_ATOMIC_MAX; - } - private static final int MAC_OS_X_VERSION_10_0 = (int)1000L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_0 1000 - * } - */ - public static int MAC_OS_X_VERSION_10_0() { - return MAC_OS_X_VERSION_10_0; - } - private static final int MAC_OS_X_VERSION_10_1 = (int)1010L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_1 1010 - * } - */ - public static int MAC_OS_X_VERSION_10_1() { - return MAC_OS_X_VERSION_10_1; - } - private static final int MAC_OS_X_VERSION_10_2 = (int)1020L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_2 1020 - * } - */ - public static int MAC_OS_X_VERSION_10_2() { - return MAC_OS_X_VERSION_10_2; - } - private static final int MAC_OS_X_VERSION_10_3 = (int)1030L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_3 1030 - * } - */ - public static int MAC_OS_X_VERSION_10_3() { - return MAC_OS_X_VERSION_10_3; - } - private static final int MAC_OS_X_VERSION_10_4 = (int)1040L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_4 1040 - * } - */ - public static int MAC_OS_X_VERSION_10_4() { - return MAC_OS_X_VERSION_10_4; - } - private static final int MAC_OS_X_VERSION_10_5 = (int)1050L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_5 1050 - * } - */ - public static int MAC_OS_X_VERSION_10_5() { - return MAC_OS_X_VERSION_10_5; - } - private static final int MAC_OS_X_VERSION_10_6 = (int)1060L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_6 1060 - * } - */ - public static int MAC_OS_X_VERSION_10_6() { - return MAC_OS_X_VERSION_10_6; - } - private static final int MAC_OS_X_VERSION_10_7 = (int)1070L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_7 1070 - * } - */ - public static int MAC_OS_X_VERSION_10_7() { - return MAC_OS_X_VERSION_10_7; - } - private static final int MAC_OS_X_VERSION_10_8 = (int)1080L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_8 1080 - * } - */ - public static int MAC_OS_X_VERSION_10_8() { - return MAC_OS_X_VERSION_10_8; - } - private static final int MAC_OS_X_VERSION_10_9 = (int)1090L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_9 1090 - * } - */ - public static int MAC_OS_X_VERSION_10_9() { - return MAC_OS_X_VERSION_10_9; - } - private static final int MAC_OS_X_VERSION_10_10 = (int)101000L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_10 101000 - * } - */ - public static int MAC_OS_X_VERSION_10_10() { - return MAC_OS_X_VERSION_10_10; - } - private static final int MAC_OS_X_VERSION_10_10_2 = (int)101002L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_10_2 101002 - * } - */ - public static int MAC_OS_X_VERSION_10_10_2() { - return MAC_OS_X_VERSION_10_10_2; - } - private static final int MAC_OS_X_VERSION_10_10_3 = (int)101003L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_10_3 101003 - * } - */ - public static int MAC_OS_X_VERSION_10_10_3() { - return MAC_OS_X_VERSION_10_10_3; - } - private static final int MAC_OS_X_VERSION_10_11 = (int)101100L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_11 101100 - * } - */ - public static int MAC_OS_X_VERSION_10_11() { - return MAC_OS_X_VERSION_10_11; - } - private static final int MAC_OS_X_VERSION_10_11_2 = (int)101102L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_11_2 101102 - * } - */ - public static int MAC_OS_X_VERSION_10_11_2() { - return MAC_OS_X_VERSION_10_11_2; - } - private static final int MAC_OS_X_VERSION_10_11_3 = (int)101103L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_11_3 101103 - * } - */ - public static int MAC_OS_X_VERSION_10_11_3() { - return MAC_OS_X_VERSION_10_11_3; - } - private static final int MAC_OS_X_VERSION_10_11_4 = (int)101104L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_11_4 101104 - * } - */ - public static int MAC_OS_X_VERSION_10_11_4() { - return MAC_OS_X_VERSION_10_11_4; - } - private static final int MAC_OS_X_VERSION_10_12 = (int)101200L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_12 101200 - * } - */ - public static int MAC_OS_X_VERSION_10_12() { - return MAC_OS_X_VERSION_10_12; - } - private static final int MAC_OS_X_VERSION_10_12_1 = (int)101201L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_12_1 101201 - * } - */ - public static int MAC_OS_X_VERSION_10_12_1() { - return MAC_OS_X_VERSION_10_12_1; - } - private static final int MAC_OS_X_VERSION_10_12_2 = (int)101202L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_12_2 101202 - * } - */ - public static int MAC_OS_X_VERSION_10_12_2() { - return MAC_OS_X_VERSION_10_12_2; - } - private static final int MAC_OS_X_VERSION_10_12_4 = (int)101204L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_12_4 101204 - * } - */ - public static int MAC_OS_X_VERSION_10_12_4() { - return MAC_OS_X_VERSION_10_12_4; - } - private static final int MAC_OS_X_VERSION_10_13 = (int)101300L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_13 101300 - * } - */ - public static int MAC_OS_X_VERSION_10_13() { - return MAC_OS_X_VERSION_10_13; - } - private static final int MAC_OS_X_VERSION_10_13_1 = (int)101301L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_13_1 101301 - * } - */ - public static int MAC_OS_X_VERSION_10_13_1() { - return MAC_OS_X_VERSION_10_13_1; - } - private static final int MAC_OS_X_VERSION_10_13_2 = (int)101302L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_13_2 101302 - * } - */ - public static int MAC_OS_X_VERSION_10_13_2() { - return MAC_OS_X_VERSION_10_13_2; - } - private static final int MAC_OS_X_VERSION_10_13_4 = (int)101304L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_13_4 101304 - * } - */ - public static int MAC_OS_X_VERSION_10_13_4() { - return MAC_OS_X_VERSION_10_13_4; - } - private static final int MAC_OS_X_VERSION_10_14 = (int)101400L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_14 101400 - * } - */ - public static int MAC_OS_X_VERSION_10_14() { - return MAC_OS_X_VERSION_10_14; - } - private static final int MAC_OS_X_VERSION_10_14_1 = (int)101401L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_14_1 101401 - * } - */ - public static int MAC_OS_X_VERSION_10_14_1() { - return MAC_OS_X_VERSION_10_14_1; - } - private static final int MAC_OS_X_VERSION_10_14_4 = (int)101404L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_14_4 101404 - * } - */ - public static int MAC_OS_X_VERSION_10_14_4() { - return MAC_OS_X_VERSION_10_14_4; - } - private static final int MAC_OS_X_VERSION_10_14_5 = (int)101405L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_14_5 101405 - * } - */ - public static int MAC_OS_X_VERSION_10_14_5() { - return MAC_OS_X_VERSION_10_14_5; - } - private static final int MAC_OS_X_VERSION_10_14_6 = (int)101406L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_14_6 101406 - * } - */ - public static int MAC_OS_X_VERSION_10_14_6() { - return MAC_OS_X_VERSION_10_14_6; - } - private static final int MAC_OS_X_VERSION_10_15 = (int)101500L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_15 101500 - * } - */ - public static int MAC_OS_X_VERSION_10_15() { - return MAC_OS_X_VERSION_10_15; - } - private static final int MAC_OS_X_VERSION_10_15_1 = (int)101501L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_15_1 101501 - * } - */ - public static int MAC_OS_X_VERSION_10_15_1() { - return MAC_OS_X_VERSION_10_15_1; - } - private static final int MAC_OS_X_VERSION_10_15_4 = (int)101504L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_15_4 101504 - * } - */ - public static int MAC_OS_X_VERSION_10_15_4() { - return MAC_OS_X_VERSION_10_15_4; - } - private static final int MAC_OS_X_VERSION_10_16 = (int)101600L; - /** - * {@snippet lang=c : - * #define MAC_OS_X_VERSION_10_16 101600 - * } - */ - public static int MAC_OS_X_VERSION_10_16() { - return MAC_OS_X_VERSION_10_16; - } - private static final int MAC_OS_VERSION_11_0 = (int)110000L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_11_0 110000 - * } - */ - public static int MAC_OS_VERSION_11_0() { - return MAC_OS_VERSION_11_0; - } - private static final int MAC_OS_VERSION_11_1 = (int)110100L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_11_1 110100 - * } - */ - public static int MAC_OS_VERSION_11_1() { - return MAC_OS_VERSION_11_1; - } - private static final int MAC_OS_VERSION_11_3 = (int)110300L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_11_3 110300 - * } - */ - public static int MAC_OS_VERSION_11_3() { - return MAC_OS_VERSION_11_3; - } - private static final int MAC_OS_VERSION_11_4 = (int)110400L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_11_4 110400 - * } - */ - public static int MAC_OS_VERSION_11_4() { - return MAC_OS_VERSION_11_4; - } - private static final int MAC_OS_VERSION_11_5 = (int)110500L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_11_5 110500 - * } - */ - public static int MAC_OS_VERSION_11_5() { - return MAC_OS_VERSION_11_5; - } - private static final int MAC_OS_VERSION_11_6 = (int)110600L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_11_6 110600 - * } - */ - public static int MAC_OS_VERSION_11_6() { - return MAC_OS_VERSION_11_6; - } - private static final int MAC_OS_VERSION_12_0 = (int)120000L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_0 120000 - * } - */ - public static int MAC_OS_VERSION_12_0() { - return MAC_OS_VERSION_12_0; - } - private static final int MAC_OS_VERSION_12_1 = (int)120100L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_1 120100 - * } - */ - public static int MAC_OS_VERSION_12_1() { - return MAC_OS_VERSION_12_1; - } - private static final int MAC_OS_VERSION_12_2 = (int)120200L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_2 120200 - * } - */ - public static int MAC_OS_VERSION_12_2() { - return MAC_OS_VERSION_12_2; - } - private static final int MAC_OS_VERSION_12_3 = (int)120300L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_3 120300 - * } - */ - public static int MAC_OS_VERSION_12_3() { - return MAC_OS_VERSION_12_3; - } - private static final int MAC_OS_VERSION_12_4 = (int)120400L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_4 120400 - * } - */ - public static int MAC_OS_VERSION_12_4() { - return MAC_OS_VERSION_12_4; - } - private static final int MAC_OS_VERSION_12_5 = (int)120500L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_5 120500 - * } - */ - public static int MAC_OS_VERSION_12_5() { - return MAC_OS_VERSION_12_5; - } - private static final int MAC_OS_VERSION_12_6 = (int)120600L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_6 120600 - * } - */ - public static int MAC_OS_VERSION_12_6() { - return MAC_OS_VERSION_12_6; - } - private static final int MAC_OS_VERSION_12_7 = (int)120700L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_12_7 120700 - * } - */ - public static int MAC_OS_VERSION_12_7() { - return MAC_OS_VERSION_12_7; - } - private static final int MAC_OS_VERSION_13_0 = (int)130000L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_0 130000 - * } - */ - public static int MAC_OS_VERSION_13_0() { - return MAC_OS_VERSION_13_0; - } - private static final int MAC_OS_VERSION_13_1 = (int)130100L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_1 130100 - * } - */ - public static int MAC_OS_VERSION_13_1() { - return MAC_OS_VERSION_13_1; - } - private static final int MAC_OS_VERSION_13_2 = (int)130200L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_2 130200 - * } - */ - public static int MAC_OS_VERSION_13_2() { - return MAC_OS_VERSION_13_2; - } - private static final int MAC_OS_VERSION_13_3 = (int)130300L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_3 130300 - * } - */ - public static int MAC_OS_VERSION_13_3() { - return MAC_OS_VERSION_13_3; - } - private static final int MAC_OS_VERSION_13_4 = (int)130400L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_4 130400 - * } - */ - public static int MAC_OS_VERSION_13_4() { - return MAC_OS_VERSION_13_4; - } - private static final int MAC_OS_VERSION_13_5 = (int)130500L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_5 130500 - * } - */ - public static int MAC_OS_VERSION_13_5() { - return MAC_OS_VERSION_13_5; - } - private static final int MAC_OS_VERSION_13_6 = (int)130600L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_13_6 130600 - * } - */ - public static int MAC_OS_VERSION_13_6() { - return MAC_OS_VERSION_13_6; - } - private static final int MAC_OS_VERSION_14_0 = (int)140000L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_14_0 140000 - * } - */ - public static int MAC_OS_VERSION_14_0() { - return MAC_OS_VERSION_14_0; - } - private static final int MAC_OS_VERSION_14_1 = (int)140100L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_14_1 140100 - * } - */ - public static int MAC_OS_VERSION_14_1() { - return MAC_OS_VERSION_14_1; - } - private static final int MAC_OS_VERSION_14_2 = (int)140200L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_14_2 140200 - * } - */ - public static int MAC_OS_VERSION_14_2() { - return MAC_OS_VERSION_14_2; - } - private static final int MAC_OS_VERSION_14_3 = (int)140300L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_14_3 140300 - * } - */ - public static int MAC_OS_VERSION_14_3() { - return MAC_OS_VERSION_14_3; - } - private static final int MAC_OS_VERSION_14_4 = (int)140400L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_14_4 140400 - * } - */ - public static int MAC_OS_VERSION_14_4() { - return MAC_OS_VERSION_14_4; - } - private static final int MAC_OS_VERSION_14_5 = (int)140500L; - /** - * {@snippet lang=c : - * #define MAC_OS_VERSION_14_5 140500 - * } - */ - public static int MAC_OS_VERSION_14_5() { - return MAC_OS_VERSION_14_5; - } - private static final int __MAC_OS_X_VERSION_MAX_ALLOWED = (int)140500L; - /** - * {@snippet lang=c : - * #define __MAC_OS_X_VERSION_MAX_ALLOWED 140500 - * } - */ - public static int __MAC_OS_X_VERSION_MAX_ALLOWED() { - return __MAC_OS_X_VERSION_MAX_ALLOWED; - } - private static final int __DARWIN_WCHAR_MAX = (int)2147483647L; - /** - * {@snippet lang=c : - * #define __DARWIN_WCHAR_MAX 2147483647 - * } - */ - public static int __DARWIN_WCHAR_MAX() { - return __DARWIN_WCHAR_MAX; - } - private static final int __DARWIN_WCHAR_MIN = (int)-2147483648L; - /** - * {@snippet lang=c : - * #define __DARWIN_WCHAR_MIN -2147483648 - * } - */ - public static int __DARWIN_WCHAR_MIN() { - return __DARWIN_WCHAR_MIN; - } - private static final int __DARWIN_WEOF = (int)-1L; - /** - * {@snippet lang=c : - * #define __DARWIN_WEOF -1 - * } - */ - public static int __DARWIN_WEOF() { - return __DARWIN_WEOF; - } - private static final int EOF = (int)-1L; - /** - * {@snippet lang=c : - * #define EOF -1 - * } - */ - public static int EOF() { - return EOF; - } - /** - * {@snippet lang=c : - * #define P_tmpdir "/var/tmp/" - * } - */ - public static MemorySegment P_tmpdir() { - class Holder { - static final MemorySegment P_tmpdir - = somelib_h.LIBRARY_ARENA.allocateFrom("/var/tmp/"); - } - return Holder.P_tmpdir; - } -} - diff --git a/feature/tmp/src/main/java/dev/diplomattest/somelib/Lib.java b/feature/tmp/src/main/java/dev/diplomattest/somelib/Lib.java deleted file mode 100644 index 77d56cc..0000000 --- a/feature/tmp/src/main/java/dev/diplomattest/somelib/Lib.java +++ /dev/null @@ -1,205 +0,0 @@ -package dev.diplomattest.somelib; - -import dev.diplomattest.somelib.ntv.*; - -import java.lang.foreign.*; -import java.lang.ref.Cleaner; -import java.nio.charset.StandardCharsets; -import java.util.function.Consumer; -import java.util.Arrays; - -import static java.lang.foreign.ValueLayout.*; - -public class Lib { - static final Cleaner cleaner = Cleaner.create(); -} - -class SliceUtils { - - - static boolean[] booleanSliceToArray(MemorySegment segment) { - var data = DiplomatU8View.data(segment); - var len = DiplomatU8View.len(segment); - var slice = data.asSlice(0, len * JAVA_BYTE.byteSize()); - var byteArray = slice.toArray(JAVA_BYTE); - var returnArray = new boolean[(int) len]; - for (var i=0; i < len; i++ ) { - returnArray[i] = (byteArray[i] == 1); - } - return returnArray; - } - - static byte[] byteSliceToArray(MemorySegment segment) { - var data = DiplomatU8View.data(segment); - var len = DiplomatU8View.len(segment); - var slice = data.asSlice(0, len * JAVA_BYTE.byteSize()); - return slice.toArray(JAVA_BYTE); - } - - static short[] shortSliceToArray(MemorySegment segment) { - var data = DiplomatU16View.data(segment); - var len = DiplomatU16View.len(segment); - var slice = data.asSlice(0, len * JAVA_SHORT.byteSize()); - return slice.toArray(JAVA_SHORT); - } - static int[] intSliceToArray(MemorySegment segment) { - var data = DiplomatU32View.data(segment); - var len = DiplomatU32View.len(segment); - var slice = data.asSlice(0, len * JAVA_INT.byteSize()); - return slice.toArray(JAVA_INT); - } - static long[] longSliceToArray(MemorySegment segment) { - var data = DiplomatU64View.data(segment); - var len = DiplomatU64View.len(segment); - var slice = data.asSlice(0, len * JAVA_LONG.byteSize()); - return slice.toArray(JAVA_LONG); - } - static float[] floatSliceToArray(MemorySegment segment) { - var data = DiplomatF32View.data(segment); - var len = DiplomatF32View.len(segment); - var slice = data.asSlice(0, len * JAVA_FLOAT.byteSize()); - return slice.toArray(JAVA_FLOAT); - } - - static double[] doubleSliceToArray(MemorySegment segment) { - var data = DiplomatF64View.data(segment); - var len = DiplomatF64View.len(segment); - var slice = data.asSlice(0, len * JAVA_DOUBLE.byteSize()); - return slice.toArray(JAVA_DOUBLE); - } - - static MemorySegment byteArrayToSlice(SegmentAllocator arena, byte[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_BYTE, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_BYTE, i, array[i]); - } - return memSeg; - } - - static MemorySegment shortArrayToSlice(SegmentAllocator arena, short[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_SHORT, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_SHORT, i, array[i]); - } - return memSeg; - } - - static MemorySegment intArrayToSlice(SegmentAllocator arena, int[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_INT, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_INT, i, array[i]); - } - return memSeg; - } - static MemorySegment longArrayToSlice(SegmentAllocator arena, long[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_LONG, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_LONG, i, array[i]); - } - return memSeg; - } - static MemorySegment floatArrayToSlice(SegmentAllocator arena, float[] array) { - var len = array.length; - var memSeg = arena.allocate(JAVA_FLOAT, len); - for (var i = 0; i < len; i++) { - memSeg.setAtIndex(JAVA_FLOAT, i, array[i]); - } - return memSeg; - } - - static MemorySegment doubleArrayToSlice(SegmentAllocator arena, double[] array) { - return arena.allocateFrom(JAVA_DOUBLE, array); - } - - static String readUtf8(MemorySegment segment) { - var data = DiplomatStringView.data(segment); - var len = DiplomatStringView.len(segment); - var strData = data.asSlice(0, len); - var bytes = strData.toArray(JAVA_BYTE); - var string = new String(bytes, StandardCharsets.UTF_8); - return string; - } - - static String readUtf16(MemorySegment segment) { - var data = DiplomatStringView.data(segment); - var len = DiplomatStringView.len(segment); - var strData = data.asSlice(0, len); - var bytes = strData.toArray(JAVA_BYTE); - var string = new String(bytes, StandardCharsets.UTF_16); - return string; - } - // for parameter conversion - static MemorySegment strToUtf8Slice(SegmentAllocator arena, String str) { - var vData = arena.allocateFrom(str, StandardCharsets.UTF_8); - var vLen = vData.byteSize() - 1; - var vView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(vView, vLen); - DiplomatStringView.data(vView, vData); - return vData; - } - - static MemorySegment strToUtf16Slice(SegmentAllocator arena, String str) { - var vData = arena.allocateFrom(str, StandardCharsets.UTF_16); - var vLen = vData.byteSize() - 1; - var vView = DiplomatStringView.allocate(arena); - DiplomatStringView.len(vView, vLen); - DiplomatStringView.data(vView, vData); - return vData; - } - static MemorySegment strs16(SegmentAllocator arena, String [] strings) { - var diplomatStrsData = DiplomatStringView.allocateArray(strings.length, arena); - var layout = DiplomatStringView.layout(); - diplomatStrsData.elements(layout).forEach(new Consumer() { - int i = 0; - @Override - public void accept(MemorySegment memorySegment) { - var str = strings[i]; - var bytes = str.getBytes(StandardCharsets.UTF_16); - var data = arena.allocateFrom(JAVA_BYTE, bytes); - DiplomatStringView.data(memorySegment, data); - DiplomatStringView.len(memorySegment, bytes.length); - i++; - } - }); - var diplomatStrsView = DiplomatStrings16View.allocate(arena); - DiplomatStrings16View.len(diplomatStrsView, strings.length); - DiplomatStrings16View.data(diplomatStrsView, diplomatStrsData); - return diplomatStrsView; - } - - static MemorySegment strs8(SegmentAllocator arena, String [] strings) { - var diplomatStrsData = DiplomatStringView.allocateArray(strings.length, arena); - var layout = DiplomatStringView.layout(); - diplomatStrsData.elements(layout).forEach(new Consumer() { - int i = 0; - @Override - public void accept(MemorySegment memorySegment) { - var str = strings[i]; - var bytes = str.getBytes(StandardCharsets.UTF_8); - var data = arena.allocateFrom(JAVA_BYTE, bytes); - DiplomatStringView.data(memorySegment, data); - DiplomatStringView.len(memorySegment, bytes.length); - i++; - } - }); - - var diplomatStrsView = DiplomatStringsView.allocate(arena); - DiplomatStringsView.len(diplomatStrsView, strings.length); - DiplomatStringsView.data(diplomatStrsView, diplomatStrsData); - return diplomatStrsView; - } - - static String readUtf8FromWriteable(MemorySegment writeable) { - var buffer = DiplomatWrite.buf(writeable); - var len = DiplomatWrite.len(writeable); - var bytes = new byte[(int) len]; - for (var i = 0; i < len; i++) { - bytes[i] = buffer.get(JAVA_BYTE, i); - } - return new String(bytes, StandardCharsets.UTF_8); - } -} \ No newline at end of file