summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/cgram
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/gluegen/cgram')
-rw-r--r--src/java/com/jogamp/gluegen/cgram/GnuCParser.g4
-rw-r--r--src/java/com/jogamp/gluegen/cgram/GnuCTreeParser.g4
-rw-r--r--src/java/com/jogamp/gluegen/cgram/HeaderParser.g12
-rw-r--r--src/java/com/jogamp/gluegen/cgram/StdCParser.g4
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/Field.java2
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/MachineDescription.java82
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/MachineDescription32Bit.java46
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/MachineDescription64Bit.java46
-rwxr-xr-xsrc/java/com/jogamp/gluegen/cgram/types/SizeThunk.java20
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/Type.java2
10 files changed, 44 insertions, 178 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/GnuCParser.g b/src/java/com/jogamp/gluegen/cgram/GnuCParser.g
index 58d3171..e8ca8c5 100644
--- a/src/java/com/jogamp/gluegen/cgram/GnuCParser.g
+++ b/src/java/com/jogamp/gluegen/cgram/GnuCParser.g
@@ -313,6 +313,10 @@ typeSpecifier [int specCount] returns [int retSpecCount]
| "double"
| "signed"
| "unsigned"
+ | "int8_t"
+ | "uint8_t"
+ | "int16_t"
+ | "uint16_t"
| "__int32"
| "int32_t"
| "wchar_t"
diff --git a/src/java/com/jogamp/gluegen/cgram/GnuCTreeParser.g b/src/java/com/jogamp/gluegen/cgram/GnuCTreeParser.g
index 1beeb7d..dbe2f98 100644
--- a/src/java/com/jogamp/gluegen/cgram/GnuCTreeParser.g
+++ b/src/java/com/jogamp/gluegen/cgram/GnuCTreeParser.g
@@ -183,6 +183,10 @@ typeSpecifier
| "double"
| "signed"
| "unsigned"
+ | "int8_t"
+ | "uint8_t"
+ | "int16_t"
+ | "uint16_t"
| "__int32"
| "int32_t"
| "wchar_t"
diff --git a/src/java/com/jogamp/gluegen/cgram/HeaderParser.g b/src/java/com/jogamp/gluegen/cgram/HeaderParser.g
index a0d2a83..79f966f 100644
--- a/src/java/com/jogamp/gluegen/cgram/HeaderParser.g
+++ b/src/java/com/jogamp/gluegen/cgram/HeaderParser.g
@@ -504,11 +504,15 @@ typeSpecifier[int attributes] returns [Type t] {
| "long" { t = new IntType("long" , SizeThunk.LONG, unsigned, cvAttrs); }
| "float" { t = new FloatType("float", SizeThunk.FLOAT, cvAttrs); }
| "double" { t = new DoubleType("double", SizeThunk.DOUBLE, cvAttrs); }
- | "__int32" { t = new IntType("__int32", SizeThunk.INT, unsigned, cvAttrs); }
- | "int32_t" { t = new IntType("int32_t", SizeThunk.INT, false, cvAttrs); /* TS: always signed */ }
- | "wchar_t" { t = new IntType("wchar_t", SizeThunk.INT, false, cvAttrs); /* TS: always signed */ }
- | "uint32_t" { t = new IntType("uint32_t", SizeThunk.INT, true, cvAttrs, true); /* TS: always unsigned */ }
+ | "__int32" { t = new IntType("__int32", SizeThunk.INT32, unsigned, cvAttrs); }
| "__int64" { t = new IntType("__int64", SizeThunk.INT64, unsigned, cvAttrs); }
+ | "int8_t" { t = new IntType("int8_t", SizeThunk.INT8, false, cvAttrs); /* TS: always signed */ }
+ | "uint8_t" { t = new IntType("uint8_t", SizeThunk.INT8, true, cvAttrs); /* TS: always unsigned */ }
+ | "int16_t" { t = new IntType("int16_t", SizeThunk.INT16, false, cvAttrs); /* TS: always signed */ }
+ | "uint16_t" { t = new IntType("uint16_t", SizeThunk.INT16, true, cvAttrs); /* TS: always unsigned */ }
+ | "int32_t" { t = new IntType("int32_t", SizeThunk.INT32, false, cvAttrs); /* TS: always signed */ }
+ | "wchar_t" { t = new IntType("wchar_t", SizeThunk.INT32, false, cvAttrs); /* TS: always signed */ }
+ | "uint32_t" { t = new IntType("uint32_t", SizeThunk.INT32, true, cvAttrs, true); /* TS: always unsigned */ }
| "int64_t" { t = new IntType("int64_t", SizeThunk.INT64, false, cvAttrs); /* TS: always signed */ }
| "uint64_t" { t = new IntType("uint64_t", SizeThunk.INT64, true, cvAttrs, true); /* TS: always unsigned */ }
| "ptrdiff_t" { t = new IntType("ptrdiff_t", SizeThunk.POINTER, false, cvAttrs); /* TS: always signed */ }
diff --git a/src/java/com/jogamp/gluegen/cgram/StdCParser.g b/src/java/com/jogamp/gluegen/cgram/StdCParser.g
index 231e371..7b34656 100644
--- a/src/java/com/jogamp/gluegen/cgram/StdCParser.g
+++ b/src/java/com/jogamp/gluegen/cgram/StdCParser.g
@@ -265,6 +265,10 @@ typeSpecifier [int specCount] returns [int retSpecCount]
| "double"
| "signed"
| "unsigned"
+ | "int8_t"
+ | "uint8_t"
+ | "int16_t"
+ | "uint16_t"
| "__int32"
| "int32_t"
| "wchar_t"
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Field.java b/src/java/com/jogamp/gluegen/cgram/types/Field.java
index 07d90ea..2479e3d 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/Field.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/Field.java
@@ -39,6 +39,8 @@
package com.jogamp.gluegen.cgram.types;
+import com.jogamp.common.os.MachineDescription;
+
/** Represents a field in a struct or union. */
public class Field {
diff --git a/src/java/com/jogamp/gluegen/cgram/types/MachineDescription.java b/src/java/com/jogamp/gluegen/cgram/types/MachineDescription.java
deleted file mode 100644
index d2598e0..0000000
--- a/src/java/com/jogamp/gluegen/cgram/types/MachineDescription.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.gluegen.cgram.types;
-
-public class MachineDescription {
- private int charSizeInBytes;
- private int shortSizeInBytes;
- private int intSizeInBytes;
- private int longSizeInBytes;
- private int int64SizeInBytes;
- private int floatSizeInBytes;
- private int doubleSizeInBytes;
- private int pointerSizeInBytes;
- private int structAlignmentInBytes;
-
- public MachineDescription(int charSizeInBytes,
- int shortSizeInBytes,
- int intSizeInBytes,
- int longSizeInBytes,
- int int64SizeInBytes,
- int floatSizeInBytes,
- int doubleSizeInBytes,
- int pointerSizeInBytes,
- int structAlignmentInBytes) {
- this.charSizeInBytes = charSizeInBytes;
- this.shortSizeInBytes = shortSizeInBytes;
- this.intSizeInBytes = intSizeInBytes;
- this.longSizeInBytes = longSizeInBytes;
- this.int64SizeInBytes = int64SizeInBytes;
- this.floatSizeInBytes = floatSizeInBytes;
- this.doubleSizeInBytes = doubleSizeInBytes;
- this.pointerSizeInBytes = pointerSizeInBytes;
- this.structAlignmentInBytes = structAlignmentInBytes;
- }
-
- public int charSizeInBytes() { return charSizeInBytes; }
- public int shortSizeInBytes() { return shortSizeInBytes; }
- public int intSizeInBytes() { return intSizeInBytes; }
- public int longSizeInBytes() { return longSizeInBytes; }
- public int int64SizeInBytes() { return int64SizeInBytes; }
- public int floatSizeInBytes() { return floatSizeInBytes; }
- public int doubleSizeInBytes() { return doubleSizeInBytes; }
- public int pointerSizeInBytes() { return pointerSizeInBytes; }
- public int structAlignmentInBytes() { return structAlignmentInBytes; }
-}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/MachineDescription32Bit.java b/src/java/com/jogamp/gluegen/cgram/types/MachineDescription32Bit.java
deleted file mode 100644
index 6bbb801..0000000
--- a/src/java/com/jogamp/gluegen/cgram/types/MachineDescription32Bit.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.gluegen.cgram.types;
-
-public class MachineDescription32Bit extends MachineDescription {
- public MachineDescription32Bit() {
- super(1, 2, 4, 4, 8, 4, 8, 4, 8);
- }
-}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/MachineDescription64Bit.java b/src/java/com/jogamp/gluegen/cgram/types/MachineDescription64Bit.java
deleted file mode 100644
index 38328e4..0000000
--- a/src/java/com/jogamp/gluegen/cgram/types/MachineDescription64Bit.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.gluegen.cgram.types;
-
-public class MachineDescription64Bit extends MachineDescription {
- public MachineDescription64Bit() {
- super(1, 2, 4, 8, 8, 4, 8, 8, 16);
- }
-}
diff --git a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java
index 40ddd57..1584a13 100755
--- a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java
@@ -40,6 +40,8 @@
package com.jogamp.gluegen.cgram.types;
+import com.jogamp.common.os.MachineDescription;
+
/** Provides a level of indirection between the definition of a type's
size and the absolute value of this size. Necessary when
generating glue code for two different CPU architectures (e.g.,
@@ -84,6 +86,24 @@ public abstract class SizeThunk implements Cloneable {
}
};
+ public static final SizeThunk INT8 = new SizeThunk() {
+ public long compute(MachineDescription machDesc) {
+ return machDesc.int8SizeInBytes();
+ }
+ };
+
+ public static final SizeThunk INT16 = new SizeThunk() {
+ public long compute(MachineDescription machDesc) {
+ return machDesc.int16SizeInBytes();
+ }
+ };
+
+ public static final SizeThunk INT32 = new SizeThunk() {
+ public long compute(MachineDescription machDesc) {
+ return machDesc.int32SizeInBytes();
+ }
+ };
+
public static final SizeThunk INT64 = new SizeThunk() {
public long compute(MachineDescription machDesc) {
return machDesc.int64SizeInBytes();
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java
index c58bfae..95afc2c 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/Type.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java
@@ -42,6 +42,8 @@ package com.jogamp.gluegen.cgram.types;
import java.util.List;
+import com.jogamp.common.os.MachineDescription;
+
/** Models a C type. Primitive types include int, float, and
double. All types have an associated name. Structs and unions are
modeled as "compound" types -- composed of fields of primitive or