diff options
author | Kenneth Russel <[email protected]> | 2005-02-26 01:41:28 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-02-26 01:41:28 +0000 |
commit | b41b720c4366d4e2cdc1ba146123b87da966d724 (patch) | |
tree | 6c6c8196e9ac0ef57f068f394c1720ec034639c2 /src/net/java/games/gluegen/opengl/GLEmitter.java | |
parent | 2bb02ad536c5404f008ff71c6d4ca013abaff683 (diff) |
Merged with current JOGL trunk (tag JOGL_1_1_PRE_B10)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@245 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/gluegen/opengl/GLEmitter.java')
-rw-r--r-- | src/net/java/games/gluegen/opengl/GLEmitter.java | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/src/net/java/games/gluegen/opengl/GLEmitter.java b/src/net/java/games/gluegen/opengl/GLEmitter.java index 861e85bb7..d30f145ab 100644 --- a/src/net/java/games/gluegen/opengl/GLEmitter.java +++ b/src/net/java/games/gluegen/opengl/GLEmitter.java @@ -93,14 +93,27 @@ public class GLEmitter extends JavaEmitter return new GLConfiguration(); } - protected Iterator generateMethodBindingEmitters(FunctionSymbol sym) throws Exception + protected List generateMethodBindingEmitters(FunctionSymbol sym) throws Exception { - Iterator defaultEmitters = super.generateMethodBindingEmitters(sym); + return generateMethodBindingEmittersImpl(sym); + } + + protected List generateMethodBindingEmitters(FunctionSymbol sym, boolean skipProcessing) throws Exception { + if (skipProcessing) { + return super.generateMethodBindingEmitters(sym); + } else { + return generateMethodBindingEmittersImpl(sym); + } + } + + private List generateMethodBindingEmittersImpl(FunctionSymbol sym) throws Exception + { + List defaultEmitters = super.generateMethodBindingEmitters(sym); // if the superclass didn't generate any bindings for the symbol, let's // honor that (for example, the superclass might have caught an Ignore // direction that matched the symbol's name). - if (!defaultEmitters.hasNext()) + if (defaultEmitters.isEmpty()) { return defaultEmitters; } @@ -121,9 +134,9 @@ public class GLEmitter extends JavaEmitter emitGLProcAddressTableEntryForSymbol(sym); } - while (defaultEmitters.hasNext()) + for (Iterator iter = defaultEmitters.iterator(); iter.hasNext(); ) { - FunctionEmitter emitter = (FunctionEmitter)defaultEmitters.next(); + FunctionEmitter emitter = (FunctionEmitter) iter.next(); if (emitter instanceof JavaMethodBindingEmitter) { JavaMethodBindingEmitter newEmitter = @@ -144,7 +157,7 @@ public class GLEmitter extends JavaEmitter } } - return modifiedEmitters.iterator(); + return modifiedEmitters; } /** @@ -168,7 +181,7 @@ public class GLEmitter extends JavaEmitter // Internals only below this point // - private JavaMethodBindingEmitter generateModifiedEmitter(JavaMethodBindingEmitter baseJavaEmitter) + protected JavaMethodBindingEmitter generateModifiedEmitter(JavaMethodBindingEmitter baseJavaEmitter) { if (!(baseJavaEmitter instanceof JavaMethodBindingImplEmitter)) { // We only want to wrap the native entry point in the implementation @@ -178,7 +191,7 @@ public class GLEmitter extends JavaEmitter // it needs argument conversion or similar, filter that out since we will // be providing such an emitter ourselves. Otherwise return the emitter // unmodified. - if (baseJavaEmitter.isForNIOBufferBaseRoutine()) + if (baseJavaEmitter.isForImplementingMethodCall()) return null; return baseJavaEmitter; } @@ -189,7 +202,7 @@ public class GLEmitter extends JavaEmitter return new JavaGLPAWrapperEmitter(baseJavaEmitter, getGLConfig().getProcAddressTableExpr()); } - private CMethodBindingEmitter generateModifiedEmitter(CMethodBindingEmitter baseCEmitter) + protected CMethodBindingEmitter generateModifiedEmitter(CMethodBindingEmitter baseCEmitter) { // The C-side JNI binding for this particular function will have an // extra final argument, which is the address (the OpenGL procedure @@ -202,7 +215,7 @@ public class GLEmitter extends JavaEmitter return res; } - private boolean needsProcAddressWrapper(FunctionSymbol sym) + protected boolean needsProcAddressWrapper(FunctionSymbol sym) { String symName = sym.getName(); @@ -275,6 +288,10 @@ public class GLEmitter extends JavaEmitter tableWriter.println("public class " + tableClassName); tableWriter.println("{"); numProcAddressEntries = 0; + + for (Iterator iter = getGLConfig().getForceProcAddressGen().iterator(); iter.hasNext(); ) { + emitGLProcAddressTableEntryForString((String) iter.next()); + } } private void endGLProcAddressTable() throws Exception @@ -316,16 +333,21 @@ public class GLEmitter extends JavaEmitter w.close(); } - private void emitGLProcAddressTableEntryForSymbol(FunctionSymbol cFunc) + protected void emitGLProcAddressTableEntryForSymbol(FunctionSymbol cFunc) + { + emitGLProcAddressTableEntryForString(cFunc.getName()); + } + + protected void emitGLProcAddressTableEntryForString(String str) { tableWriter.print(" public long "); tableWriter.print(PROCADDRESS_VAR_PREFIX); - tableWriter.print(cFunc.getName()); + tableWriter.print(str); tableWriter.println(";"); ++numProcAddressEntries; } - private GLConfiguration getGLConfig() { + protected GLConfiguration getGLConfig() { return (GLConfiguration) getConfig(); } @@ -335,6 +357,7 @@ public class GLEmitter extends JavaEmitter private String tableClassPackage; private String tableClassName = "ProcAddressTable"; private Set/*<String>*/ skipProcAddressGen = new HashSet(); + private List/*<String>*/ forceProcAddressGen = new ArrayList(); private String contextVariableName = "context"; private String defaultGetProcAddressTableExpr = ".getGLProcAddressTable()"; private String getProcAddressTableExpr; @@ -358,6 +381,11 @@ public class GLEmitter extends JavaEmitter String sym = readString("SkipProcAddressGen", tok, filename, lineNo); skipProcAddressGen.add(sym); } + else if (cmd.equalsIgnoreCase("ForceProcAddressGen")) + { + String sym = readString("ForceProcAddressGen", tok, filename, lineNo); + forceProcAddressGen.add(sym); + } else if (cmd.equalsIgnoreCase("ContextVariableName")) { contextVariableName = readString("ContextVariableName", tok, filename, lineNo); @@ -386,6 +414,7 @@ public class GLEmitter extends JavaEmitter public String tableClassPackage() { return tableClassPackage; } public String tableClassName() { return tableClassName; } public boolean skipProcAddressGen (String name) { return skipProcAddressGen.contains(name); } + public List getForceProcAddressGen() { return forceProcAddressGen; } public String contextVariableName() { return contextVariableName; } public String getProcAddressTableExpr() { if (getProcAddressTableExpr == null) { |