org.purejava.appindicator.drand48_data Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libayatana-appindicator-java-full Show documentation
Show all versions of libayatana-appindicator-java-full Show documentation
Java bindings for libayatana-appindicator in 100% pure Java
// Generated by jextract
package org.purejava.appindicator;
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 drand48_data {
* unsigned short __x[3];
* unsigned short __old_x[3];
* unsigned short __c;
* unsigned short __init;
* unsigned long long __a;
* }
* }
*/
public class drand48_data {
drand48_data() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(3, app_indicator_h.C_SHORT).withName("__x"),
MemoryLayout.sequenceLayout(3, app_indicator_h.C_SHORT).withName("__old_x"),
app_indicator_h.C_SHORT.withName("__c"),
app_indicator_h.C_SHORT.withName("__init"),
app_indicator_h.C_LONG_LONG.withName("__a")
).withName("drand48_data");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final SequenceLayout __x$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__x"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static final SequenceLayout __x$layout() {
return __x$LAYOUT;
}
private static final long __x$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static final long __x$offset() {
return __x$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static MemorySegment __x(MemorySegment struct) {
return struct.asSlice(__x$OFFSET, __x$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static void __x(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, __x$OFFSET, __x$LAYOUT.byteSize());
}
private static long[] __x$DIMS = { 3 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static long[] __x$dimensions() {
return __x$DIMS;
}
private static final VarHandle __x$ELEM_HANDLE = __x$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static short __x(MemorySegment struct, long index0) {
return (short)__x$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* unsigned short __x[3]
* }
*/
public static void __x(MemorySegment struct, long index0, short fieldValue) {
__x$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final SequenceLayout __old_x$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__old_x"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static final SequenceLayout __old_x$layout() {
return __old_x$LAYOUT;
}
private static final long __old_x$OFFSET = 6;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static final long __old_x$offset() {
return __old_x$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static MemorySegment __old_x(MemorySegment struct) {
return struct.asSlice(__old_x$OFFSET, __old_x$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static void __old_x(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, __old_x$OFFSET, __old_x$LAYOUT.byteSize());
}
private static long[] __old_x$DIMS = { 3 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static long[] __old_x$dimensions() {
return __old_x$DIMS;
}
private static final VarHandle __old_x$ELEM_HANDLE = __old_x$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static short __old_x(MemorySegment struct, long index0) {
return (short)__old_x$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* unsigned short __old_x[3]
* }
*/
public static void __old_x(MemorySegment struct, long index0, short fieldValue) {
__old_x$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfShort __c$LAYOUT = (OfShort)$LAYOUT.select(groupElement("__c"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short __c
* }
*/
public static final OfShort __c$layout() {
return __c$LAYOUT;
}
private static final long __c$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short __c
* }
*/
public static final long __c$offset() {
return __c$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned short __c
* }
*/
public static short __c(MemorySegment struct) {
return struct.get(__c$LAYOUT, __c$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned short __c
* }
*/
public static void __c(MemorySegment struct, short fieldValue) {
struct.set(__c$LAYOUT, __c$OFFSET, fieldValue);
}
private static final OfShort __init$LAYOUT = (OfShort)$LAYOUT.select(groupElement("__init"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short __init
* }
*/
public static final OfShort __init$layout() {
return __init$LAYOUT;
}
private static final long __init$OFFSET = 14;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short __init
* }
*/
public static final long __init$offset() {
return __init$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned short __init
* }
*/
public static short __init(MemorySegment struct) {
return struct.get(__init$LAYOUT, __init$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned short __init
* }
*/
public static void __init(MemorySegment struct, short fieldValue) {
struct.set(__init$LAYOUT, __init$OFFSET, fieldValue);
}
private static final OfLong __a$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__a"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned long long __a
* }
*/
public static final OfLong __a$layout() {
return __a$LAYOUT;
}
private static final long __a$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned long long __a
* }
*/
public static final long __a$offset() {
return __a$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned long long __a
* }
*/
public static long __a(MemorySegment struct) {
return struct.get(__a$LAYOUT, __a$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned long long __a
* }
*/
public static void __a(MemorySegment struct, long fieldValue) {
struct.set(__a$LAYOUT, __a$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);
}
}