Skip to content

Commit

Permalink
Renamed arrays and add temp objects
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Nov 19, 2023
1 parent e4c757f commit f70d130
Show file tree
Hide file tree
Showing 15 changed files with 256 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.github.xpenatan.jparser.example.lib.NormalClass;
import com.github.xpenatan.jparser.example.lib.OperatorClass;
import com.github.xpenatan.jparser.example.lib.ReturnClass;
import com.github.xpenatan.jparser.example.lib.idl.helper.FloatArray;
import com.github.xpenatan.jparser.example.lib.idl.helper.IDLFloatArray;

public class AppTest extends ApplicationAdapter {
private boolean init = false;
Expand Down Expand Up @@ -51,7 +51,7 @@ private void initLib() {
ret1 = normalClass.addIntValue(a1, b1);
System.out.println("addIntValue " + a1 + " + " + b1 + " = " + ret1);

FloatArray array = new FloatArray(1);
IDLFloatArray array = new IDLFloatArray(1);
array.setValue(0, 10);
float value = array.getValue(0);
System.out.println("VALUE: " + value);
Expand All @@ -71,7 +71,7 @@ private void initLib() {
System.out.println("returnValueObject: " + returnValueObject.get_value());

normalClass.printText(10, "printText HELLO");
FloatArray floatArray = new FloatArray(1);
IDLFloatArray floatArray = IDLFloatArray.tmp1_1;
long pointer = floatArray.getPointer();
System.out.println("pointer: " + pointer);
normalClass.setArray(floatArray);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.xpenatan.jparser.example.lib;

import com.github.xpenatan.jparser.loader.JParserLibraryLoader;
import idl.helper.ByteArray;
import idl.helper.IDLByteArray;

public class ExampleLibLoader {

Expand Down Expand Up @@ -34,7 +34,7 @@ public static void init(Runnable run) {
JParserLibraryLoader libraryLoader = new JParserLibraryLoader();
libraryLoader.load("exampleLib");

ByteArray test = new ByteArray(1);
IDLByteArray test = new IDLByteArray(1);
test.setValue(0, (byte)1);
run.run();
}
Expand Down
24 changes: 0 additions & 24 deletions jParser/base/src/main/java/idl/helper/BoolArray.java

This file was deleted.

24 changes: 0 additions & 24 deletions jParser/base/src/main/java/idl/helper/DoubleArray.java

This file was deleted.

24 changes: 0 additions & 24 deletions jParser/base/src/main/java/idl/helper/FloatArray.java

This file was deleted.

47 changes: 47 additions & 0 deletions jParser/base/src/main/java/idl/helper/IDLBoolArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package idl.helper;

import idl.IDLBase;

public class IDLBoolArray extends IDLBase {

public static IDLBoolArray tmp1_1 = new IDLBoolArray(1);
public static IDLBoolArray tmp1_2 = new IDLBoolArray(1);

public static IDLBoolArray tmp2_1 = new IDLBoolArray(2);
public static IDLBoolArray tmp2_2 = new IDLBoolArray(2);

public static IDLBoolArray tmp3_1 = new IDLBoolArray(3);
public static IDLBoolArray tmp3_2 = new IDLBoolArray(3);

public static IDLBoolArray tmp4_1 = new IDLBoolArray(4);
public static IDLBoolArray tmp4_2 = new IDLBoolArray(4);

public static void disposeTEMP() {
tmp1_1.dispose();
tmp1_2.dispose();
tmp2_1.dispose();
tmp2_2.dispose();
tmp3_1.dispose();
tmp3_2.dispose();
tmp4_1.dispose();
tmp4_2.dispose();
}

public IDLBoolArray(int size) {
}

public void copy(boolean [] array) {
int length = array.length;
resize(length);
for(int i = 0; i < length; i++) {
boolean value = array[i];
setValue(i, value);
}
}

public native void setValue(int index, boolean value);
public native void resize(int size);
public native boolean getValue(int index);
public native long getPointer();
public native int getSize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@

import idl.IDLBase;

public class ByteArray extends IDLBase {
public class IDLByteArray extends IDLBase {

public ByteArray(int size) {
public static IDLByteArray tmp1_1 = new IDLByteArray(1);
public static IDLByteArray tmp1_2 = new IDLByteArray(1);

public static IDLByteArray tmp2_1 = new IDLByteArray(2);
public static IDLByteArray tmp2_2 = new IDLByteArray(2);

public static IDLByteArray tmp3_1 = new IDLByteArray(3);
public static IDLByteArray tmp3_2 = new IDLByteArray(3);

public static IDLByteArray tmp4_1 = new IDLByteArray(4);
public static IDLByteArray tmp4_2 = new IDLByteArray(4);

public static void disposeTEMP() {
tmp1_1.dispose();
tmp1_2.dispose();
tmp2_1.dispose();
tmp2_2.dispose();
tmp3_1.dispose();
tmp3_2.dispose();
tmp4_1.dispose();
tmp4_2.dispose();
}

public IDLByteArray(int size) {
}

public void copy(byte [] array) {
Expand All @@ -22,8 +45,8 @@ public void copy(byte [] array) {
public native long getPointer();
public native int getSize();

public static void arraycopy(byte[] src, int srcPos,
ByteArray dest, int destPos,
public static void arraycopy(byte[] src, int srcPos,
IDLByteArray dest, int destPos,
int length) {
int srcP = srcPos;
int destP = destPos;
Expand All @@ -37,7 +60,7 @@ public static void arraycopy(byte[] src, int srcPos,
}
}

public static void arraycopy(ByteArray src, int srcPos,
public static void arraycopy(IDLByteArray src, int srcPos,
byte[] dest, int destPos,
int length) {
int srcP = srcPos;
Expand Down
47 changes: 47 additions & 0 deletions jParser/base/src/main/java/idl/helper/IDLDoubleArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package idl.helper;

import idl.IDLBase;

public class IDLDoubleArray extends IDLBase {

public static IDLDoubleArray tmp1_1 = new IDLDoubleArray(1);
public static IDLDoubleArray tmp1_2 = new IDLDoubleArray(1);

public static IDLDoubleArray tmp2_1 = new IDLDoubleArray(2);
public static IDLDoubleArray tmp2_2 = new IDLDoubleArray(2);

public static IDLDoubleArray tmp3_1 = new IDLDoubleArray(3);
public static IDLDoubleArray tmp3_2 = new IDLDoubleArray(3);

public static IDLDoubleArray tmp4_1 = new IDLDoubleArray(4);
public static IDLDoubleArray tmp4_2 = new IDLDoubleArray(4);

public static void disposeTEMP() {
tmp1_1.dispose();
tmp1_2.dispose();
tmp2_1.dispose();
tmp2_2.dispose();
tmp3_1.dispose();
tmp3_2.dispose();
tmp4_1.dispose();
tmp4_2.dispose();
}

public IDLDoubleArray(int size) {
}

public void copy(double [] array) {
int length = array.length;
resize(length);
for(int i = 0; i < length; i++) {
double value = array[i];
setValue(i, value);
}
}

public native void setValue(int index, double value);
public native void resize(int size);
public native double getValue(int index);
public native long getPointer();
public native int getSize();
}
47 changes: 47 additions & 0 deletions jParser/base/src/main/java/idl/helper/IDLFloatArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package idl.helper;

import idl.IDLBase;

public class IDLFloatArray extends IDLBase {

public static IDLFloatArray tmp1_1 = new IDLFloatArray(1);
public static IDLFloatArray tmp1_2 = new IDLFloatArray(1);

public static IDLFloatArray tmp2_1 = new IDLFloatArray(2);
public static IDLFloatArray tmp2_2 = new IDLFloatArray(2);

public static IDLFloatArray tmp3_1 = new IDLFloatArray(3);
public static IDLFloatArray tmp3_2 = new IDLFloatArray(3);

public static IDLFloatArray tmp4_1 = new IDLFloatArray(4);
public static IDLFloatArray tmp4_2 = new IDLFloatArray(4);

public static void disposeTEMP() {
tmp1_1.dispose();
tmp1_2.dispose();
tmp2_1.dispose();
tmp2_2.dispose();
tmp3_1.dispose();
tmp3_2.dispose();
tmp4_1.dispose();
tmp4_2.dispose();
}

public IDLFloatArray(int size) {
}

public void copy(float [] array) {
int length = array.length;
resize(length);
for(int i = 0; i < length; i++) {
float value = array[i];
setValue(i, value);
}
}

public native void setValue(int index, float value);
public native void resize(int size);
public native float getValue(int index);
public native long getPointer();
public native int getSize();
}
47 changes: 47 additions & 0 deletions jParser/base/src/main/java/idl/helper/IDLIntArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package idl.helper;

import idl.IDLBase;

public class IDLIntArray extends IDLBase {

public static IDLIntArray tmp1_1 = new IDLIntArray(1);
public static IDLIntArray tmp1_2 = new IDLIntArray(1);

public static IDLIntArray tmp2_1 = new IDLIntArray(2);
public static IDLIntArray tmp2_2 = new IDLIntArray(2);

public static IDLIntArray tmp3_1 = new IDLIntArray(3);
public static IDLIntArray tmp3_2 = new IDLIntArray(3);

public static IDLIntArray tmp4_1 = new IDLIntArray(4);
public static IDLIntArray tmp4_2 = new IDLIntArray(4);

public static void disposeTEMP() {
tmp1_1.dispose();
tmp1_2.dispose();
tmp2_1.dispose();
tmp2_2.dispose();
tmp3_1.dispose();
tmp3_2.dispose();
tmp4_1.dispose();
tmp4_2.dispose();
}

public IDLIntArray(int size) {
}

public void copy(int[] array) {
int length = array.length;
resize(length);
for(int i = 0; i < length; i++) {
int value = array[i];
setValue(i, value);
}
}

public native void setValue(int index, int value);
public native void resize(int size);
public native int getValue(int index);
public native long getPointer();
public native int getSize();
}
24 changes: 0 additions & 24 deletions jParser/base/src/main/java/idl/helper/IntArray.java

This file was deleted.

Loading

0 comments on commit f70d130

Please sign in to comment.