summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-junit.xml12
-rwxr-xr-xmake/build.xml12
-rw-r--r--src/java/com/jogamp/gluegen/GlueGen.java27
-rw-r--r--src/java/com/jogamp/gluegen/pcpp/PCPP.java10
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/test1.h7
5 files changed, 47 insertions, 21 deletions
diff --git a/make/build-junit.xml b/make/build-junit.xml
index 72428b4..f006a1c 100644
--- a/make/build-junit.xml
+++ b/make/build-junit.xml
@@ -252,7 +252,9 @@
config="${test.junit.generation.dir}/test1-gluegen.cfg"
literalInclude="${test.junit.generation.dir}"
includeRefid="stub.includes.fileset.test"
- emitter="com.jogamp.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -261,7 +263,9 @@
config="${test.junit.generation.dir}/test1p1-gluegen.cfg"
literalInclude="${test.junit.generation.dir}"
includeRefid="stub.includes.fileset.test"
- emitter="com.jogamp.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -270,7 +274,9 @@
config="${test.junit.generation.dir}/test1p2-gluegen.cfg"
literalInclude="${test.junit.generation.dir}"
includeRefid="stub.includes.fileset.test"
- emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter">
+ emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"
+ dumpCPP="false"
+ debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>
</target>
diff --git a/make/build.xml b/make/build.xml
index 0017a3e..61a1e8c 100755
--- a/make/build.xml
+++ b/make/build.xml
@@ -152,19 +152,25 @@
<gluegen src="stub_includes/windows/dynamic-linker.h"
config="dynlink-windows.cfg"
includeRefId="stub.includes.fileset.windows"
- emitter="com.jogamp.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>
<gluegen src="stub_includes/unix/dynamic-linker.h"
config="dynlink-unix.cfg"
includeRefId="stub.includes.fileset.unix"
- emitter="com.jogamp.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>
<gluegen src="stub_includes/macosx/dynamic-linker.h"
config="dynlink-macosx.cfg"
includeRefId="stub.includes.fileset.macosx"
- emitter="com.jogamp.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
<classpath refid="gluegen.classpath" />
</gluegen>
</target>
diff --git a/src/java/com/jogamp/gluegen/GlueGen.java b/src/java/com/jogamp/gluegen/GlueGen.java
index 719d54c..f24d0b2 100644
--- a/src/java/com/jogamp/gluegen/GlueGen.java
+++ b/src/java/com/jogamp/gluegen/GlueGen.java
@@ -107,23 +107,24 @@ public class GlueGen implements GlueEmitterControls {
final PipedInputStream ppIn = new PipedInputStream();
final PipedOutputStream ppOut = new PipedOutputStream(ppIn);
+ File out = File.createTempFile("PCPPTemp", ".pcpp");
+ FileOutputStream outStream = new FileOutputStream(out);
+
+ if(debug) {
+ System.err.println("PCPP output at (persistent): " + out.getAbsolutePath());
+ } else {
+ out.deleteOnExit();
+ }
+
preprocessor = new PCPP(includePaths, debug, copyPCPPOutput2Stderr);
- preprocessor.setOut(ppOut);
+ preprocessor.setOut(outStream);
- new Thread("PCPP") {
+ preprocessor.run(reader, filename);
+ outStream.flush();
- @Override
- public void run() {
- try {
- preprocessor.run(reader, filename);
- ppOut.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }.start();
+ FileInputStream inStream = new FileInputStream(out);
+ DataInputStream dis = new DataInputStream(inStream);
- DataInputStream dis = new DataInputStream(ppIn);
GnuCLexer lexer = new GnuCLexer(dis);
lexer.setTokenObjectClass(CToken.class.getName());
lexer.initialize();
diff --git a/src/java/com/jogamp/gluegen/pcpp/PCPP.java b/src/java/com/jogamp/gluegen/pcpp/PCPP.java
index 95a4b43..db45e3e 100644
--- a/src/java/com/jogamp/gluegen/pcpp/PCPP.java
+++ b/src/java/com/jogamp/gluegen/pcpp/PCPP.java
@@ -551,17 +551,23 @@ public class PCPP {
debugPrint(true, "DEFINE " + name + " ["+oldDef+" ] -> "+value + " CONST");
//System.err.println("//---DEFINED: " + name + " to \"" + value + "\"");
} else {
- debugPrint(true, "DEFINE " + name + " -> "+value + " SYMB");
// Value is a symbolic constant like "#define FOO BAR".
// Try to look up the symbol's value
String newValue = resolveDefine(value, true);
+ debugPrint(true, "DEFINE " + name + " -> "+value + " -> <" + newValue + "> SYMB");
if (newValue != null) {
// Set the value to the value of the symbol.
//
// TO DO: Is this correct? Why not output the symbol unchanged?
// I think that it's a good thing to see that some symbols are
// defined in terms of others. -chris
- values.set(0, newValue);
+ macroDefinition = newValue.contains("(");
+ if(macroDefinition) {
+ // parser can't dig this currently
+ emitDefine = false;
+ } else {
+ values.set(0, newValue);
+ }
} else {
// Still perform textual replacement
defineMap.put(name, value);
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 eb7bb00..6cdb025 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h
@@ -92,3 +92,10 @@ MYAPI MYAPIConfig MYAPIENTRY typeTestAnonSingle(const MYAPIConfig a);
/** Return a copy of the passed MYAPIConfig*, incremented by 1 */
MYAPI MYAPIConfig * MYAPIENTRY typeTestAnonPointer(const MYAPIConfig * a);
+#define DOUBLE_DEFINE_BRACKETS_1 ( ( int ) 1e51 )
+#define DOUBLE_DEFINE_BRACKETS_2 ((int) 1e52)
+
+#define HUGE_VALF_3 ((int) 1e53)
+#define DOUBLE_DEFINE_BRACKETS_3 HUGE_VALF_3
+
+