Skip to content

Commit

Permalink
Filter jextract includes to avoid having to specify includes manually (
Browse files Browse the repository at this point in the history
  • Loading branch information
lopcode authored Aug 10, 2024
1 parent 8276059 commit ee388c0
Show file tree
Hide file tree
Showing 22 changed files with 25,246 additions and 6,767 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ build

jextract*
logo*
libs/lib*
libs/lib*
includes.txt
includes_filtered.txt
409 changes: 27 additions & 382 deletions generate_ffm_bindings.sh

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Generated by jextract

package app.photofox.imffm.generated;

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 MagickBooleanType (*DuplexTransferWandViewMethod)(const WandView *, const WandView *, WandView *, const ssize_t, const int, void *)
* }
*/
public class DuplexTransferWandViewMethod {

DuplexTransferWandViewMethod() {
// Should not be called directly
}

/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, long _x3, int _x4, MemorySegment _x5);
}

private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
MagickWand_h.C_INT,
MagickWand_h.C_POINTER,
MagickWand_h.C_POINTER,
MagickWand_h.C_POINTER,
MagickWand_h.C_LONG,
MagickWand_h.C_INT,
MagickWand_h.C_POINTER
);

/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}

private static final MethodHandle UP$MH = MagickWand_h.upcallHandle(DuplexTransferWandViewMethod.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(DuplexTransferWandViewMethod.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, MemorySegment _x2, long _x3, int _x4, MemorySegment _x5) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

26 changes: 26 additions & 0 deletions lib/src/main/java/app/photofox/imffm/generated/ExceptionInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Generated by jextract

package app.photofox.imffm.generated;

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 _ExceptionInfo ExceptionInfo
* }
*/
public class ExceptionInfo extends _ExceptionInfo {

ExceptionInfo() {
// Should not be called directly
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Generated by jextract

package app.photofox.imffm.generated;

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 MagickBooleanType (*GetWandViewMethod)(const WandView *, const ssize_t, const int, void *)
* }
*/
public class GetWandViewMethod {

GetWandViewMethod() {
// Should not be called directly
}

/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0, long _x1, int _x2, MemorySegment _x3);
}

private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
MagickWand_h.C_INT,
MagickWand_h.C_POINTER,
MagickWand_h.C_LONG,
MagickWand_h.C_INT,
MagickWand_h.C_POINTER
);

/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}

private static final MethodHandle UP$MH = MagickWand_h.upcallHandle(GetWandViewMethod.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(GetWandViewMethod.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, long _x1, int _x2, MemorySegment _x3) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Generated by jextract

package app.photofox.imffm.generated;

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 size_t (ImageFilterHandler)(Image **, const int, const char **, ExceptionInfo *)
* }
*/
public class ImageFilterHandler {

ImageFilterHandler() {
// Should not be called directly
}

/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
long apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3);
}

private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
MagickWand_h.C_LONG,
MagickWand_h.C_POINTER,
MagickWand_h.C_INT,
MagickWand_h.C_POINTER,
MagickWand_h.C_POINTER
);

/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}

private static final MethodHandle UP$MH = MagickWand_h.upcallHandle(ImageFilterHandler.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(ImageFilterHandler.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, int _x1, MemorySegment _x2, MemorySegment _x3) {
try {
return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

72 changes: 72 additions & 0 deletions lib/src/main/java/app/photofox/imffm/generated/MagickCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Generated by jextract

package app.photofox.imffm.generated;

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 MagickBooleanType (*MagickCommand)(ImageInfo *, int, char **, char **, ExceptionInfo *)
* }
*/
public class MagickCommand {

MagickCommand() {
// Should not be called directly
}

/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4);
}

private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
MagickWand_h.C_INT,
MagickWand_h.C_POINTER,
MagickWand_h.C_INT,
MagickWand_h.C_POINTER,
MagickWand_h.C_POINTER,
MagickWand_h.C_POINTER
);

/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}

private static final MethodHandle UP$MH = MagickWand_h.upcallHandle(MagickCommand.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(MagickCommand.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, int _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

42 changes: 42 additions & 0 deletions lib/src/main/java/app/photofox/imffm/generated/MagickInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Generated by jextract

package app.photofox.imffm.generated;

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 _MagickInfo {
* char *name;
* char *description;
* char *version;
* char *mime_type;
* char *note;
* char *module;
* DecodeImageHandler *decoder;
* EncodeImageHandler *encoder;
* ImageInfo *image_info;
* IsImageFormatHandler *magick;
* MagickFormatType format_type;
* MagickStatusType flags;
* SemaphoreInfo *semaphore;
* size_t signature;
* void *client_data;
* } MagickInfo
* }
*/
public class MagickInfo extends _MagickInfo {

MagickInfo() {
// Should not be called directly
}
}

Loading

0 comments on commit ee388c0

Please sign in to comment.