summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/java/com/sun/gluegen/JavaConfiguration.java28
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java5
-rw-r--r--src/java/com/sun/gluegen/opengl/GLEmitter.java4
-rwxr-xr-xsrc/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java5
-rwxr-xr-xsrc/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java16
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/*<Pattern>*/ ignoreNots = new HashSet();
private Set/*<Pattern>*/ unignores = new HashSet();
private Set/*<Pattern>*/ unimplemented = new HashSet();
+ private boolean forceNioOnly4All=false;
+ private Set/*<String>*/ nioOnly = new HashSet();
private Set/*<String>*/ nioDirectOnly = new HashSet();
private Set/*<String>*/ manuallyImplement = new HashSet();
private Map/*<String,List<String>>*/ 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 <code>void*</code> 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) {