org.purejava.appindicator.sigcontext 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 sigcontext {
* __u64 fault_address;
* __u64 regs[31];
* __u64 sp;
* __u64 pc;
* __u64 pstate;
* __u8 __reserved[4096];
* }
* }
*/
public class sigcontext {
sigcontext() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
app_indicator_h.C_LONG_LONG.withName("fault_address"),
MemoryLayout.sequenceLayout(31, app_indicator_h.C_LONG_LONG).withName("regs"),
app_indicator_h.C_LONG_LONG.withName("sp"),
app_indicator_h.C_LONG_LONG.withName("pc"),
app_indicator_h.C_LONG_LONG.withName("pstate"),
MemoryLayout.paddingLayout(8),
MemoryLayout.sequenceLayout(4096, app_indicator_h.C_CHAR).withName("__reserved")
).withName("sigcontext");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfLong fault_address$LAYOUT = (OfLong)$LAYOUT.select(groupElement("fault_address"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 fault_address
* }
*/
public static final OfLong fault_address$layout() {
return fault_address$LAYOUT;
}
private static final long fault_address$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 fault_address
* }
*/
public static final long fault_address$offset() {
return fault_address$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 fault_address
* }
*/
public static long fault_address(MemorySegment struct) {
return struct.get(fault_address$LAYOUT, fault_address$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 fault_address
* }
*/
public static void fault_address(MemorySegment struct, long fieldValue) {
struct.set(fault_address$LAYOUT, fault_address$OFFSET, fieldValue);
}
private static final SequenceLayout regs$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("regs"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static final SequenceLayout regs$layout() {
return regs$LAYOUT;
}
private static final long regs$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static final long regs$offset() {
return regs$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static MemorySegment regs(MemorySegment struct) {
return struct.asSlice(regs$OFFSET, regs$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static void regs(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, regs$OFFSET, regs$LAYOUT.byteSize());
}
private static long[] regs$DIMS = { 31 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static long[] regs$dimensions() {
return regs$DIMS;
}
private static final VarHandle regs$ELEM_HANDLE = regs$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static long regs(MemorySegment struct, long index0) {
return (long)regs$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* __u64 regs[31]
* }
*/
public static void regs(MemorySegment struct, long index0, long fieldValue) {
regs$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfLong sp$LAYOUT = (OfLong)$LAYOUT.select(groupElement("sp"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 sp
* }
*/
public static final OfLong sp$layout() {
return sp$LAYOUT;
}
private static final long sp$OFFSET = 256;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 sp
* }
*/
public static final long sp$offset() {
return sp$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 sp
* }
*/
public static long sp(MemorySegment struct) {
return struct.get(sp$LAYOUT, sp$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 sp
* }
*/
public static void sp(MemorySegment struct, long fieldValue) {
struct.set(sp$LAYOUT, sp$OFFSET, fieldValue);
}
private static final OfLong pc$LAYOUT = (OfLong)$LAYOUT.select(groupElement("pc"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 pc
* }
*/
public static final OfLong pc$layout() {
return pc$LAYOUT;
}
private static final long pc$OFFSET = 264;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 pc
* }
*/
public static final long pc$offset() {
return pc$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 pc
* }
*/
public static long pc(MemorySegment struct) {
return struct.get(pc$LAYOUT, pc$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 pc
* }
*/
public static void pc(MemorySegment struct, long fieldValue) {
struct.set(pc$LAYOUT, pc$OFFSET, fieldValue);
}
private static final OfLong pstate$LAYOUT = (OfLong)$LAYOUT.select(groupElement("pstate"));
/**
* Layout for field:
* {@snippet lang=c :
* __u64 pstate
* }
*/
public static final OfLong pstate$layout() {
return pstate$LAYOUT;
}
private static final long pstate$OFFSET = 272;
/**
* Offset for field:
* {@snippet lang=c :
* __u64 pstate
* }
*/
public static final long pstate$offset() {
return pstate$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u64 pstate
* }
*/
public static long pstate(MemorySegment struct) {
return struct.get(pstate$LAYOUT, pstate$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* __u64 pstate
* }
*/
public static void pstate(MemorySegment struct, long fieldValue) {
struct.set(pstate$LAYOUT, pstate$OFFSET, fieldValue);
}
private static final SequenceLayout __reserved$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__reserved"));
/**
* Layout for field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static final SequenceLayout __reserved$layout() {
return __reserved$LAYOUT;
}
private static final long __reserved$OFFSET = 288;
/**
* Offset for field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static final long __reserved$offset() {
return __reserved$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static MemorySegment __reserved(MemorySegment struct) {
return struct.asSlice(__reserved$OFFSET, __reserved$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static void __reserved(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, __reserved$OFFSET, __reserved$LAYOUT.byteSize());
}
private static long[] __reserved$DIMS = { 4096 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static long[] __reserved$dimensions() {
return __reserved$DIMS;
}
private static final VarHandle __reserved$ELEM_HANDLE = __reserved$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static byte __reserved(MemorySegment struct, long index0) {
return (byte)__reserved$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* __u8 __reserved[4096]
* }
*/
public static void __reserved(MemorySegment struct, long index0, byte fieldValue) {
__reserved$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);
}
}