Skip to content

Commit

Permalink
Generate more bindings (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
lopcode authored Aug 10, 2024
1 parent ee388c0 commit e6f6cd6
Show file tree
Hide file tree
Showing 23 changed files with 7,694 additions and 121 deletions.
5 changes: 3 additions & 2 deletions generate_ffm_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ grep -E ' [A-Za-z0-9_]*Exception[A-Za-z0-9]*' includes.txt >> includes_filtered.
grep -E ' [A-Za-z0-9_]*Filter[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]*Mogrify[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]*Montage[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]*PixelInfo[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]*RectangleInfo[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]*(Pixel|Rectangle|Point|Segment|Image)Info' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]*Wand[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]+Command[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]+Iterator[A-Za-z0-9]*' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]+Handler' includes.txt >> includes_filtered.txt
grep -E ' [A-Za-z0-9_]+Type' includes.txt >> includes_filtered.txt

echo "Running jextract..."

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// 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 void *(*AcquireAlignedMemoryHandler)(const size_t, const size_t)
* }
*/
public class AcquireAlignedMemoryHandler {

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

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

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

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// 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 void *(*AcquireMemoryHandler)(size_t)
* }
*/
public class AcquireMemoryHandler {

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

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

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

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// 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 ssize_t (*CustomStreamHandler)(unsigned char *, const size_t, void *)
* }
*/
public class CustomStreamHandler {

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

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

private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
MagickWand_h.C_LONG,
MagickWand_h.C_POINTER,
MagickWand_h.C_LONG,
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(CustomStreamHandler.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(CustomStreamHandler.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, MemorySegment _x2) {
try {
return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// 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 Image *(DecodeImageHandler)(const ImageInfo *, ExceptionInfo *)
* }
*/
public class DecodeImageHandler {

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

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

private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
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(DecodeImageHandler.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(DecodeImageHandler.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 MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) {
try {
return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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 void (*DestroyMemoryHandler)(void *)
* }
*/
public class DestroyMemoryHandler {

DestroyMemoryHandler() {
// 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(
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(DestroyMemoryHandler.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(DestroyMemoryHandler.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$);
}
}
}

Loading

0 comments on commit e6f6cd6

Please sign in to comment.