aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/GlueGen.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-06 03:44:12 +0100
committerSven Gothel <[email protected]>2010-11-06 03:44:12 +0100
commit6b6b9b3b81cdc85b7260664ebec547756a6be5d7 (patch)
tree5f2b4e83d4d04117ea27571d278b4074ae9ca038 /src/java/com/sun/gluegen/GlueGen.java
parent33ea83cfcad373e477791a0aca49864399357877 (diff)
Fix native type representation; Retain typedef declName in resulting Type for variables; Misc
Fix native type representation ---------------------------------- The following custom types were previously build-in: __int32, __int64 Adding the following native build-in types (necessary): ptrdiff_t, size_t These compiler/platform specific types shall not be typedef'ed via header files. Hence we provide proper typing for such, as the compiler would do. Adding the following native build-in types (convenience): int32_t, uint32_t, int64_t, uint64_t These are provided due to their lack of support on certain platforms, and probable source of bugs, when defined by the user. Retain typedef declName in resulting Type for variables. -------------------------------------------------------- Adding Clonable to all cgram Type derivations. Assume use case: typedef khronos_ssize_t GLsizeiptr typedef size_t khronos_ssize_t The previous code picked a one level depth type in the dictionary if exists. Hence it made khronos_ssize_t visible in the javadoc and native code. It is our believe that the generated native code, as well as the javadoc comments shall reflect the original GlueGen'ed API and it's types. Also, aliasing or reducing native types via GlueGen could result in plattorm dependencies and in worst cases, incompatible native types. This patch clones the 1 level depth Type (typedef), clones it and sets the declName, so it's visible to the GlueGen layers. Misc ------- GlueGen's debug flag is passed to HeaderParser, where it traces misc information.
Diffstat (limited to 'src/java/com/sun/gluegen/GlueGen.java')
-rw-r--r--src/java/com/sun/gluegen/GlueGen.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/GlueGen.java b/src/java/com/sun/gluegen/GlueGen.java
index 866f602..b03109c 100644
--- a/src/java/com/sun/gluegen/GlueGen.java
+++ b/src/java/com/sun/gluegen/GlueGen.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -48,7 +49,23 @@ import com.sun.gluegen.pcpp.*;
import static java.lang.System.*;
-/** Glue code generator for C functions and data structures. */
+/**
+ * Glue code generator for C functions and data structures.<br>
+ * <br>
+ * Gluegen has build-in types (terminal symbols) for:<br>
+ * <br>
+ * <table border="1">
+ * <tr><th>type</th> <th>java</th> <th>native-x32</th><th>native-x64</th><th>type</th> <th>signed</th></tr>
+ * <tr><th>__int32</th> <th>32bit</th><th>32bit</th> <th>32bit</th> <th>integer</th><th>signed or unsigned</th></tr>
+ * <tr><th>int32_t</th> <th>32bit</th><th>32bit</th> <th>32bit</th> <th>integer</th><th>signed</th></tr>
+ * <tr><th>uint32_t</th> <th>32bit</th><th>32bit</th> <th>32bit</th> <th>integer</th><th>unsigned</th></tr>
+ * <tr><th>__int64</th> <th>64bit</th><th>64bit</th> <th>64bit</th> <th>integer</th><th>signed or unsigned</th></tr>
+ * <tr><th>int64_t</th> <th>64bit</th><th>64bit</th> <th>64bit</th> <th>integer</th><th>signed</th></tr>
+ * <tr><th>uint64_t</th> <th>64bit</th><th>64bit</th> <th>64bit</th> <th>integer</th><th>unsigned</th></tr>
+ * <tr><th>ptrdiff_t</th> <th>64bit</th><th>32bit</th> <th>64bit</th> <th>integer</th><th>signed</th></tr>
+ * <tr><th>size_t</th> <th>64bit</th><th>32bit</th> <th>64bit</th> <th>integer</th><th>unsigned</th></tr>
+ * </table>
+ */
public class GlueGen implements GlueEmitterControls {
static{
@@ -127,6 +144,7 @@ public class GlueGen implements GlueEmitterControls {
}
HeaderParser headerParser = new HeaderParser();
+ headerParser.setDebug(debug);
TypeDictionary td = new TypeDictionary();
headerParser.setTypedefDictionary(td);
TypeDictionary sd = new TypeDictionary();