aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathieu Féry <[email protected]>2023-06-15 15:43:40 +0200
committerMathieu Féry <[email protected]>2023-06-16 10:52:29 +0200
commit8d3e22e8c54bca8e84ea94566f47b8f24cc24b60 (patch)
tree4c0c0fd2c3dcae2d17eea0a374447c4e3eee7e7b /src
parent88309192b450e09ba16e9d72adac178c4ce47dc3 (diff)
feat(constants): Add supports of ~ inside ConstantDefinition
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/gluegen/ConstantDefinition.java4
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java9
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.h8
3 files changed, 19 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/ConstantDefinition.java b/src/java/com/jogamp/gluegen/ConstantDefinition.java
index 675c6d7..d579da1 100644
--- a/src/java/com/jogamp/gluegen/ConstantDefinition.java
+++ b/src/java/com/jogamp/gluegen/ConstantDefinition.java
@@ -760,7 +760,7 @@ public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSema
public final static Pattern patternIntegerNumber;
/**
- * One of: {@code +} {@code -} {@code *} {@code /} {@code |} {@code &} {@code (} {@code )} {@code <<} {@code >>}
+ * One of: {@code +} {@code -} {@code *} {@code /} {@code |} {@code &} {@code (} {@code )} {@code <<} {@code >>} {@code ~}
* <p>
* Expression excludes {@link #patternDecimalOrIntNumber}.
* </p>
@@ -949,6 +949,6 @@ public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSema
")" +
WhiteSpace // Optional trailing "whitespace"
;
- patternCPPOperand = Pattern.compile("(?!"+fpOrIntRegex2+")[\\+\\-\\*\\/\\|\\&\\(\\)]|(\\<\\<)|(\\>\\>)");
+ patternCPPOperand = Pattern.compile("(?!"+fpOrIntRegex2+")[\\+\\-\\*\\/\\|\\&\\(\\)]|(\\<\\<)|(\\>\\>)|(\\~)");
}
}
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
index ed23f54..d87053f 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java
@@ -246,6 +246,15 @@ public class BaseClass extends SingletonJunitCase {
Assert.assertEquals( 9, Bindingtest1.NUMBER_NINE);
Assert.assertEquals( 10, Bindingtest1.NUMBER_TEN);
+ // Bitwise not Expression
+ Assert.assertEquals(~ Bindingtest1.NUMBER_ONE, Bindingtest1.BITWISE_NOT_OF_ONE);
+ Assert.assertEquals(~ Bindingtest1.NUMBER_TWO, Bindingtest1.BITWISE_NOT_OF_TWO);
+ Assert.assertEquals(~ Bindingtest1.NUMBER_FOUR, Bindingtest1.BITWISE_NOT_OF_FOUR);
+ Assert.assertEquals(~ Bindingtest1.NUMBER_FIVE, Bindingtest1.BITWISE_NOT_OF_FIVE);
+ Assert.assertEquals(~ Bindingtest1.NUMBER_EIGHT, Bindingtest1.BITWISE_NOT_OF_EIGHT);
+ Assert.assertEquals(~ Bindingtest1.NUMBER_NINE, Bindingtest1.BITWISE_NOT_OF_NINE);
+ Assert.assertEquals(~ Bindingtest1.NUMBER_TEN, Bindingtest1.BITWISE_NOT_OF_TEN);
+
// Enum Constant Expressions!
Assert.assertEquals( 1, Bindingtest1.ENUM_NUM_ONE);
Assert.assertEquals( 2, Bindingtest1.ENUM_NUM_TWO);
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
index 89848d7..6e1f8db 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
@@ -114,6 +114,14 @@ enum CL_INT { ENUM_I0=10, ENUM_I1, ENUM_I2=+12U, ENUM_I3=0x0d, ENUM_I4=-14, ENUM
#define NUMBER_NINE ( 2 * 2 + ( 1 << 2 ) + 1 )
#define NUMBER_TEN ( NUMBER_EIGHT | NUMBER_TWO )
+#define BITWISE_NOT_OF_ONE ~ NUMBER_ONE
+#define BITWISE_NOT_OF_TWO ~ NUMBER_TWO
+#define BITWISE_NOT_OF_FOUR ~ NUMBER_FOUR
+#define BITWISE_NOT_OF_FIVE ~ NUMBER_FIVE
+#define BITWISE_NOT_OF_EIGHT ~ NUMBER_EIGHT
+#define BITWISE_NOT_OF_NINE ~ NUMBER_NINE
+#define BITWISE_NOT_OF_TEN ~ NUMBER_TEN
+
enum NumberOps { ENUM_NUM_ONE = CONSTANT_ONE,
ENUM_NUM_TWO = 1+1,
ENUM_NUM_THREE,