Skip to content

Commit

Permalink
fix(templates): C long types
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Aug 31, 2019
1 parent d836bdf commit 216d8f8
Show file tree
Hide file tree
Showing 57 changed files with 566 additions and 487 deletions.
108 changes: 90 additions & 18 deletions modules/lwjgl/core/src/generated/c/org_lwjgl_system_JNI.c

Large diffs are not rendered by default.

31 changes: 24 additions & 7 deletions modules/lwjgl/core/src/generated/java/org/lwjgl/system/JNI.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public class Visual extends Struct implements NativeResource {
static {
Layout layout = __struct(
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(CLONG_SIZE),
__member(4),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(CLONG_SIZE),
__member(CLONG_SIZE),
__member(CLONG_SIZE),
__member(4),
__member(4)
);
Expand Down Expand Up @@ -309,15 +309,15 @@ public static Visual.Buffer callocStack(int capacity, MemoryStack stack) {
/** Unsafe version of {@link #ext_data}. */
public static long next_data(long struct) { return memGetAddress(struct + Visual.EXT_DATA); }
/** Unsafe version of {@link #visualid}. */
public static long nvisualid(long struct) { return memGetAddress(struct + Visual.VISUALID); }
public static long nvisualid(long struct) { return memGetCLong(struct + Visual.VISUALID); }
/** Unsafe version of {@link #class$}. */
public static int nclass$(long struct) { return UNSAFE.getInt(null, struct + Visual.CLASS); }
/** Unsafe version of {@link #red_mask}. */
public static long nred_mask(long struct) { return memGetAddress(struct + Visual.RED_MASK); }
public static long nred_mask(long struct) { return memGetCLong(struct + Visual.RED_MASK); }
/** Unsafe version of {@link #green_mask}. */
public static long ngreen_mask(long struct) { return memGetAddress(struct + Visual.GREEN_MASK); }
public static long ngreen_mask(long struct) { return memGetCLong(struct + Visual.GREEN_MASK); }
/** Unsafe version of {@link #blue_mask}. */
public static long nblue_mask(long struct) { return memGetAddress(struct + Visual.BLUE_MASK); }
public static long nblue_mask(long struct) { return memGetCLong(struct + Visual.BLUE_MASK); }
/** Unsafe version of {@link #bits_per_rgb}. */
public static int nbits_per_rgb(long struct) { return UNSAFE.getInt(null, struct + Visual.BITS_PER_RGB); }
/** Unsafe version of {@link #map_entries}. */
Expand All @@ -326,15 +326,15 @@ public static Visual.Buffer callocStack(int capacity, MemoryStack stack) {
/** Unsafe version of {@link #ext_data(long) ext_data}. */
public static void next_data(long struct, long value) { memPutAddress(struct + Visual.EXT_DATA, value); }
/** Unsafe version of {@link #visualid(long) visualid}. */
public static void nvisualid(long struct, long value) { memPutAddress(struct + Visual.VISUALID, value); }
public static void nvisualid(long struct, long value) { memPutCLong(struct + Visual.VISUALID, value); }
/** Unsafe version of {@link #class$(int) class$}. */
public static void nclass$(long struct, int value) { UNSAFE.putInt(null, struct + Visual.CLASS, value); }
/** Unsafe version of {@link #red_mask(long) red_mask}. */
public static void nred_mask(long struct, long value) { memPutAddress(struct + Visual.RED_MASK, value); }
public static void nred_mask(long struct, long value) { memPutCLong(struct + Visual.RED_MASK, value); }
/** Unsafe version of {@link #green_mask(long) green_mask}. */
public static void ngreen_mask(long struct, long value) { memPutAddress(struct + Visual.GREEN_MASK, value); }
public static void ngreen_mask(long struct, long value) { memPutCLong(struct + Visual.GREEN_MASK, value); }
/** Unsafe version of {@link #blue_mask(long) blue_mask}. */
public static void nblue_mask(long struct, long value) { memPutAddress(struct + Visual.BLUE_MASK, value); }
public static void nblue_mask(long struct, long value) { memPutCLong(struct + Visual.BLUE_MASK, value); }
/** Unsafe version of {@link #bits_per_rgb(int) bits_per_rgb}. */
public static void nbits_per_rgb(long struct, int value) { UNSAFE.putInt(null, struct + Visual.BITS_PER_RGB, value); }
/** Unsafe version of {@link #map_entries(int) map_entries}. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public static long XRootWindow(@NativeType("Display *") long display, int screen
if (CHECKS) {
check(display);
}
return invokePP(display, screen_number, __functionAddress);
return invokePN(display, screen_number, __functionAddress);
}

// --- [ XCreateColormap ] ---
Expand All @@ -554,7 +554,7 @@ public static long nXCreateColormap(long display, long w, long visual, int alloc
if (CHECKS) {
check(display);
}
return invokePPPP(display, w, visual, alloc, __functionAddress);
return invokePNPN(display, w, visual, alloc, __functionAddress);
}

/**
Expand Down Expand Up @@ -587,7 +587,7 @@ public static int XFreeColormap(@NativeType("Display *") long display, @NativeTy
if (CHECKS) {
check(display);
}
return invokePPI(display, colormap, __functionAddress);
return invokePNI(display, colormap, __functionAddress);
}

// --- [ XCreateWindow ] ---
Expand All @@ -598,7 +598,7 @@ public static long nXCreateWindow(long display, long parent, int x, int y, int w
if (CHECKS) {
check(display);
}
return invokePPPPPP(display, parent, x, y, width, height, border_width, depth, windowClass, visual, valuemask, attributes, __functionAddress);
return invokePNPNPN(display, parent, x, y, width, height, border_width, depth, windowClass, visual, valuemask, attributes, __functionAddress);
}

/**
Expand Down Expand Up @@ -650,7 +650,7 @@ public static int XDestroyWindow(@NativeType("Display *") long display, @NativeT
if (CHECKS) {
check(display);
}
return invokePPI(display, w, __functionAddress);
return invokePNI(display, w, __functionAddress);
}

// --- [ XFree ] ---
Expand Down Expand Up @@ -687,7 +687,7 @@ public static int nXSendEvent(long display, long w, int propagate, long event_ma
if (CHECKS) {
check(display);
}
return invokePPPPI(display, w, propagate, event_mask, event_send, __functionAddress);
return invokePNNPI(display, w, propagate, event_mask, event_send, __functionAddress);
}

/**
Expand Down Expand Up @@ -745,7 +745,7 @@ public static long XDisplayMotionBufferSize(@NativeType("Display *") long displa
if (CHECKS) {
check(display);
}
return invokePP(display, __functionAddress);
return invokePN(display, __functionAddress);
}

// --- [ XGetMotionEvents ] ---
Expand All @@ -756,7 +756,7 @@ public static long nXGetMotionEvents(long display, long w, long start, long stop
if (CHECKS) {
check(display);
}
return invokePPPPPP(display, w, start, stop, nevents_return, __functionAddress);
return invokePNNNPP(display, w, start, stop, nevents_return, __functionAddress);
}

/**
Expand Down Expand Up @@ -790,7 +790,7 @@ public static int nXTranslateCoordinates(long display, long src_w, long dest_w,
if (CHECKS) {
check(display);
}
return invokePPPPPPI(display, src_w, dest_w, src_x, src_y, dest_x_return, dest_y_return, child_return, __functionAddress);
return invokePNNPPPI(display, src_w, dest_w, src_x, src_y, dest_x_return, dest_y_return, child_return, __functionAddress);
}

/**
Expand All @@ -814,7 +814,7 @@ public static int nXTranslateCoordinates(long display, long src_w, long dest_w,
* @param child_return returns the child if the coordinates are contained in a mapped child of the destination window
*/
@NativeType("Bool")
public static boolean XTranslateCoordinates(@NativeType("Display *") long display, @NativeType("Window") long src_w, @NativeType("Window") long dest_w, int src_x, int src_y, @NativeType("int *") IntBuffer dest_x_return, @NativeType("int *") IntBuffer dest_y_return, @NativeType("Window *") PointerBuffer child_return) {
public static boolean XTranslateCoordinates(@NativeType("Display *") long display, @NativeType("Window") long src_w, @NativeType("Window") long dest_w, int src_x, int src_y, @NativeType("int *") IntBuffer dest_x_return, @NativeType("int *") IntBuffer dest_y_return, @NativeType("Window *") CLongBuffer child_return) {
if (CHECKS) {
check(dest_x_return, 1);
check(dest_y_return, 1);
Expand All @@ -825,15 +825,15 @@ public static boolean XTranslateCoordinates(@NativeType("Display *") long displa

/** Array version of: {@link #XTranslateCoordinates} */
@NativeType("Bool")
public static boolean XTranslateCoordinates(@NativeType("Display *") long display, @NativeType("Window") long src_w, @NativeType("Window") long dest_w, int src_x, int src_y, @NativeType("int *") int[] dest_x_return, @NativeType("int *") int[] dest_y_return, @NativeType("Window *") PointerBuffer child_return) {
public static boolean XTranslateCoordinates(@NativeType("Display *") long display, @NativeType("Window") long src_w, @NativeType("Window") long dest_w, int src_x, int src_y, @NativeType("int *") int[] dest_x_return, @NativeType("int *") int[] dest_y_return, @NativeType("Window *") CLongBuffer child_return) {
long __functionAddress = Functions.XTranslateCoordinates;
if (CHECKS) {
check(display);
check(dest_x_return, 1);
check(dest_y_return, 1);
check(child_return, 1);
}
return invokePPPPPPI(display, src_w, dest_w, src_x, src_y, dest_x_return, dest_y_return, memAddress(child_return), __functionAddress) != 0;
return invokePNNPPPI(display, src_w, dest_w, src_x, src_y, dest_x_return, dest_y_return, memAddress(child_return), __functionAddress) != 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class XAnyEvent extends Struct implements NativeResource {
static {
Layout layout = __struct(
__member(4),
__member(POINTER_SIZE),
__member(CLONG_SIZE),
__member(4),
__member(POINTER_SIZE),
__member(POINTER_SIZE)
__member(CLONG_SIZE)
);

SIZEOF = layout.getSize();
Expand Down Expand Up @@ -289,24 +289,24 @@ public static XAnyEvent.Buffer callocStack(int capacity, MemoryStack stack) {
/** Unsafe version of {@link #type}. */
public static int ntype(long struct) { return UNSAFE.getInt(null, struct + XAnyEvent.TYPE); }
/** Unsafe version of {@link #serial}. */
public static long nserial(long struct) { return memGetAddress(struct + XAnyEvent.SERIAL); }
public static long nserial(long struct) { return memGetCLong(struct + XAnyEvent.SERIAL); }
/** Unsafe version of {@link #send_event}. */
public static int nsend_event(long struct) { return UNSAFE.getInt(null, struct + XAnyEvent.SEND_EVENT); }
/** Unsafe version of {@link #display}. */
public static long ndisplay(long struct) { return memGetAddress(struct + XAnyEvent.DISPLAY); }
/** Unsafe version of {@link #window}. */
public static long nwindow(long struct) { return memGetAddress(struct + XAnyEvent.WINDOW); }
public static long nwindow(long struct) { return memGetCLong(struct + XAnyEvent.WINDOW); }

/** Unsafe version of {@link #type(int) type}. */
public static void ntype(long struct, int value) { UNSAFE.putInt(null, struct + XAnyEvent.TYPE, value); }
/** Unsafe version of {@link #serial(long) serial}. */
public static void nserial(long struct, long value) { memPutAddress(struct + XAnyEvent.SERIAL, value); }
public static void nserial(long struct, long value) { memPutCLong(struct + XAnyEvent.SERIAL, value); }
/** Unsafe version of {@link #send_event(boolean) send_event}. */
public static void nsend_event(long struct, int value) { UNSAFE.putInt(null, struct + XAnyEvent.SEND_EVENT, value); }
/** Unsafe version of {@link #display(long) display}. */
public static void ndisplay(long struct, long value) { memPutAddress(struct + XAnyEvent.DISPLAY, check(value)); }
/** Unsafe version of {@link #window(long) window}. */
public static void nwindow(long struct, long value) { memPutAddress(struct + XAnyEvent.WINDOW, value); }
public static void nwindow(long struct, long value) { memPutCLong(struct + XAnyEvent.WINDOW, value); }

/**
* Validates pointer members that should not be {@code NULL}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ public class XButtonEvent extends Struct implements NativeResource {
static {
Layout layout = __struct(
__member(4),
__member(POINTER_SIZE),
__member(CLONG_SIZE),
__member(4),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(CLONG_SIZE),
__member(CLONG_SIZE),
__member(CLONG_SIZE),
__member(CLONG_SIZE),
__member(4),
__member(4),
__member(4),
Expand Down Expand Up @@ -405,19 +405,19 @@ public static XButtonEvent.Buffer callocStack(int capacity, MemoryStack stack) {
/** Unsafe version of {@link #type}. */
public static int ntype(long struct) { return UNSAFE.getInt(null, struct + XButtonEvent.TYPE); }
/** Unsafe version of {@link #serial}. */
public static long nserial(long struct) { return memGetAddress(struct + XButtonEvent.SERIAL); }
public static long nserial(long struct) { return memGetCLong(struct + XButtonEvent.SERIAL); }
/** Unsafe version of {@link #send_event}. */
public static int nsend_event(long struct) { return UNSAFE.getInt(null, struct + XButtonEvent.SEND_EVENT); }
/** Unsafe version of {@link #display}. */
public static long ndisplay(long struct) { return memGetAddress(struct + XButtonEvent.DISPLAY); }
/** Unsafe version of {@link #window}. */
public static long nwindow(long struct) { return memGetAddress(struct + XButtonEvent.WINDOW); }
public static long nwindow(long struct) { return memGetCLong(struct + XButtonEvent.WINDOW); }
/** Unsafe version of {@link #root}. */
public static long nroot(long struct) { return memGetAddress(struct + XButtonEvent.ROOT); }
public static long nroot(long struct) { return memGetCLong(struct + XButtonEvent.ROOT); }
/** Unsafe version of {@link #subwindow}. */
public static long nsubwindow(long struct) { return memGetAddress(struct + XButtonEvent.SUBWINDOW); }
public static long nsubwindow(long struct) { return memGetCLong(struct + XButtonEvent.SUBWINDOW); }
/** Unsafe version of {@link #time}. */
public static long ntime(long struct) { return memGetAddress(struct + XButtonEvent.TIME); }
public static long ntime(long struct) { return memGetCLong(struct + XButtonEvent.TIME); }
/** Unsafe version of {@link #x}. */
public static int nx(long struct) { return UNSAFE.getInt(null, struct + XButtonEvent.X); }
/** Unsafe version of {@link #y}. */
Expand All @@ -436,19 +436,19 @@ public static XButtonEvent.Buffer callocStack(int capacity, MemoryStack stack) {
/** Unsafe version of {@link #type(int) type}. */
public static void ntype(long struct, int value) { UNSAFE.putInt(null, struct + XButtonEvent.TYPE, value); }
/** Unsafe version of {@link #serial(long) serial}. */
public static void nserial(long struct, long value) { memPutAddress(struct + XButtonEvent.SERIAL, value); }
public static void nserial(long struct, long value) { memPutCLong(struct + XButtonEvent.SERIAL, value); }
/** Unsafe version of {@link #send_event(boolean) send_event}. */
public static void nsend_event(long struct, int value) { UNSAFE.putInt(null, struct + XButtonEvent.SEND_EVENT, value); }
/** Unsafe version of {@link #display(long) display}. */
public static void ndisplay(long struct, long value) { memPutAddress(struct + XButtonEvent.DISPLAY, check(value)); }
/** Unsafe version of {@link #window(long) window}. */
public static void nwindow(long struct, long value) { memPutAddress(struct + XButtonEvent.WINDOW, value); }
public static void nwindow(long struct, long value) { memPutCLong(struct + XButtonEvent.WINDOW, value); }
/** Unsafe version of {@link #root(long) root}. */
public static void nroot(long struct, long value) { memPutAddress(struct + XButtonEvent.ROOT, value); }
public static void nroot(long struct, long value) { memPutCLong(struct + XButtonEvent.ROOT, value); }
/** Unsafe version of {@link #subwindow(long) subwindow}. */
public static void nsubwindow(long struct, long value) { memPutAddress(struct + XButtonEvent.SUBWINDOW, value); }
public static void nsubwindow(long struct, long value) { memPutCLong(struct + XButtonEvent.SUBWINDOW, value); }
/** Unsafe version of {@link #time(long) time}. */
public static void ntime(long struct, long value) { memPutAddress(struct + XButtonEvent.TIME, value); }
public static void ntime(long struct, long value) { memPutCLong(struct + XButtonEvent.TIME, value); }
/** Unsafe version of {@link #x(int) x}. */
public static void nx(long struct, int value) { UNSAFE.putInt(null, struct + XButtonEvent.X, value); }
/** Unsafe version of {@link #y(int) y}. */
Expand Down
Loading

0 comments on commit 216d8f8

Please sign in to comment.