From 95617805768e0100f8691eb1b3afd1761e406cd1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 18 Jul 2008 15:32:57 +0000 Subject: Adden Config: 'NioOnly [__ALL__|]', fixed other __ALL__ logic git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@102 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- src/java/com/sun/gluegen/JavaConfiguration.java | 28 +++++++++++++++++++++- src/java/com/sun/gluegen/JavaEmitter.java | 5 ++-- src/java/com/sun/gluegen/opengl/GLEmitter.java | 4 ++-- .../procaddress/ProcAddressConfiguration.java | 5 ++-- .../gluegen/procaddress/ProcAddressEmitter.java | 16 +------------ 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/java/com/sun/gluegen/JavaConfiguration.java b/src/java/com/sun/gluegen/JavaConfiguration.java index a6ed790..b64361f 100644 --- a/src/java/com/sun/gluegen/JavaConfiguration.java +++ b/src/java/com/sun/gluegen/JavaConfiguration.java @@ -117,6 +117,8 @@ public class JavaConfiguration { private Set/**/ ignoreNots = new HashSet(); private Set/**/ unignores = new HashSet(); private Set/**/ unimplemented = new HashSet(); + private boolean forceNioOnly4All=false; + private Set/**/ nioOnly = new HashSet(); private Set/**/ nioDirectOnly = new HashSet(); private Set/**/ manuallyImplement = new HashSet(); private Map/*>*/ customJavaCode = new HashMap(); @@ -431,6 +433,18 @@ public class JavaConfiguration { return (List) argumentsAreString.get(functionName); } + public boolean isForceNioOnly4All() { return forceNioOnly4All; } + + public void addNioOnly(String fname ) { + nioOnly.add(fname); + } + public boolean nioOnly(String functionName) { + return forceNioOnly4All || nioOnly.contains(functionName); + } + + public void addNioDirectOnly(String fname ) { + nioDirectOnly.add(fname); + } /** Returns true if the given function should only create a java.nio variant, and no array variants, for void* and other C primitive pointers. */ @@ -807,8 +821,20 @@ public class JavaConfiguration { readClassJavadoc(tok, filename, lineNo); // Warning: make sure delimiters are reset at the top of this loop // because readClassJavadoc changes them. + } else if (cmd.equalsIgnoreCase("NioOnly")) { + String funcName = readString("NioOnly", tok, filename, lineNo); + if(funcName.equals("__ALL__")) { + forceNioOnly4All=true; + } else { + addNioOnly( funcName ); + } } else if (cmd.equalsIgnoreCase("NioDirectOnly")) { - nioDirectOnly.add(readString("NioDirectOnly", tok, filename, lineNo)); + String funcName = readString("NioDirectOnly", tok, filename, lineNo); + if(funcName.equals("__ALL__")) { + forceNioOnly4All=true; + } else { + addNioDirectOnly( funcName ); + } } else if (cmd.equalsIgnoreCase("EmitStruct")) { forcedStructs.add(readString("EmitStruct", tok, filename, lineNo)); } else if (cmd.equalsIgnoreCase("StructPackage")) { diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java index ac9644a..ddcb636 100644 --- a/src/java/com/sun/gluegen/JavaEmitter.java +++ b/src/java/com/sun/gluegen/JavaEmitter.java @@ -622,7 +622,7 @@ public class JavaEmitter implements GlueEmitter { } protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { - // nothing to be done per default + // nothing to do .. } /** @@ -1768,7 +1768,8 @@ public class JavaEmitter implements GlueEmitter { if (canProduceArrayVariant[0] && (binding.signatureUsesCPrimitivePointers() || binding.signatureUsesCArrays()) && - !cfg.nioDirectOnly(binding.getName())) { + !cfg.nioDirectOnly(binding.getName()) && + !cfg.nioOnly(binding.getName())) { result.add(lowerMethodBindingPointerTypes(binding, true, null)); } } else { diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index c5477a0..b0b12c5 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -346,8 +346,6 @@ public class GLEmitter extends ProcAddressEmitter } protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { - super.validateFunctionsToBind(funcsSet); - String localCallingConvention = ((GLConfiguration)cfg).getLocalProcAddressCallingConvention4All(); if(null==localCallingConvention) { localCallingConvention="GL_APIENTRY"; @@ -422,6 +420,8 @@ public class GLEmitter extends ProcAddressEmitter } } } + + super.validateFunctionsToBind(funcsSet); } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java index e05fb0a..9409a1e 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java @@ -87,7 +87,7 @@ public class ProcAddressConfiguration extends JavaConfiguration if(funcName.equals("__ALL__")) { forceProcAddressGen4All=true; } else { - addForceProcAddressGen( readString("ForceProcAddressGen", tok, filename, lineNo) ); + addForceProcAddressGen( funcName ); } } else if (cmd.equalsIgnoreCase("GetProcAddressTableExpr")) @@ -285,7 +285,7 @@ public class ProcAddressConfiguration extends JavaConfiguration return procAddressNameConverter.convert(funcName); } public boolean forceProcAddressGen(String funcName) { - return forceProcAddressGenSet.contains(funcName); + return forceProcAddressGen4All || forceProcAddressGenSet.contains(funcName); } public void addForceProcAddressGen(String funcName) { @@ -298,6 +298,7 @@ public class ProcAddressConfiguration extends JavaConfiguration } public String getLocalProcAddressCallingConvention(String funcName) { + if(isLocalProcAddressCallingConvention4All()) return getLocalProcAddressCallingConvention4All(); return (String) localProcAddressCallingConventionMap.get(funcName); } public boolean isLocalProcAddressCallingConvention4All() { return localProcAddressCallingConvention4All!=null; } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java index ea1feb6..6fb1ad8 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java @@ -182,21 +182,7 @@ public class ProcAddressEmitter extends JavaEmitter // protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { - if(!((ProcAddressConfiguration)cfg).isForceProcAddressGen4All() && - !((ProcAddressConfiguration)cfg).isLocalProcAddressCallingConvention4All()) { - return; // bail out, nothing todo .. - } - - for (Iterator iter = funcsSet.iterator(); iter.hasNext(); ) { - FunctionSymbol fsOrig = (FunctionSymbol) iter.next(); - if(((ProcAddressConfiguration)cfg).isForceProcAddressGen4All()) { - ((ProcAddressConfiguration)cfg).addForceProcAddressGen(fsOrig.getName()); - } - if(((ProcAddressConfiguration)cfg).isLocalProcAddressCallingConvention4All()) { - ((ProcAddressConfiguration)cfg).addLocalProcAddressCallingConvention(fsOrig.getName(), - ((ProcAddressConfiguration)cfg).getLocalProcAddressCallingConvention4All()); - } - } + super.validateFunctionsToBind(funcsSet); } protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List emitters) { -- cgit v1.2.3