diff options
author | Kenneth Russel <[email protected]> | 2008-05-27 10:06:20 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-05-27 10:06:20 +0000 |
commit | f1e08a23facb2d718276b3fbf59b0df2b54fceb9 (patch) | |
tree | b7f5b37c2187d39e90681400206685293d758aaa /src/java/com/sun/gluegen/JavaEmitter.java | |
parent | 0ce0a36ec694da77a0ef02ed46c2b152a17d5c80 (diff) |
Changed implementation of ArgumentIsString to work with wide-character
null-terminated strings on Windows. Changed Windows dynamic linker to
use LoadLibraryW which is the only variant available on Windows CE.
Changed GetProcAddress to explicitly named GetProcAddressA; this is
implicitly the only variant available on Windows XP. Tested by
compiling gluegen-rt.dll for both Windows XP and Windows CE. Also
brought dynlink-unix-CustomJavaCode.java in line with modifications
that were apparently hand made to the UnixDynamicLinkerImpl and
MacOSXDynamicLinkerImpl classes.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@79 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen/JavaEmitter.java')
-rw-r--r-- | src/java/com/sun/gluegen/JavaEmitter.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java index 6b51ef0..ef5c36d 100644 --- a/src/java/com/sun/gluegen/JavaEmitter.java +++ b/src/java/com/sun/gluegen/JavaEmitter.java @@ -508,7 +508,8 @@ public class JavaEmitter implements GlueEmitter { true, /* NOTE: we always disambiguate with a suffix now, so this is optional */ cfg.allStatic(), (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue), - false); + false, + machDesc64); if (returnValueCapacityFormat != null) { cEmitter.setReturnValueCapacityExpression(returnValueCapacityFormat); } @@ -532,7 +533,8 @@ public class JavaEmitter implements GlueEmitter { true, /* NOTE: we always disambiguate with a suffix now, so this is optional */ cfg.allStatic(), binding.needsNIOWrappingOrUnwrapping(), - true); + true, + machDesc64); if (returnValueCapacityFormat != null) { cEmitter.setReturnValueCapacityExpression(returnValueCapacityFormat); } @@ -898,7 +900,8 @@ public class JavaEmitter implements GlueEmitter { true, // FIXME: this is optional at this point false, true, - false); // FIXME: should unify this with the general emission code + false, // FIXME: should unify this with the general emission code + machDesc64); cEmitter.emit(); } catch (Exception e) { System.err.println("While processing field " + field + " of type " + name + ":"); @@ -1520,7 +1523,7 @@ public class JavaEmitter implements GlueEmitter { } // List of the indices of the arguments in this function that should be - // converted from byte[] to String + // converted from byte[] or short[] to String List stringArgIndices = cfg.stringArguments(binding.getName()); for (int i = 0; i < sym.getNumArguments(); i++) { @@ -1534,9 +1537,14 @@ public class JavaEmitter implements GlueEmitter { //System.out.println("Forcing conversion of " + binding.getName() + " arg #" + i + " from byte[] to String "); if (mappedType.isCVoidPointerType() || mappedType.isCCharPointerType() || - (mappedType.isArray() && mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass)) { - // convert mapped type from void* and byte[] to String, or ByteBuffer[] to String[] - if (mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass) { + mappedType.isCShortPointerType() || + (mappedType.isArray() && + (mappedType.getJavaClass() == ArrayTypes.byteBufferArrayClass) || + (mappedType.getJavaClass() == ArrayTypes.shortBufferArrayClass))) { + // convert mapped type from: + // void*, byte[], and short[] to String + // ByteBuffer[] and ShortBuffer[] to String[] + if (mappedType.isArray()) { mappedType = javaType(ArrayTypes.stringArrayClass); } else { mappedType = javaType(String.class); @@ -1546,7 +1554,7 @@ public class JavaEmitter implements GlueEmitter { throw new RuntimeException( "Cannot apply ArgumentIsString configuration directive to " + "argument " + i + " of \"" + sym + "\": argument type is not " + - "a \"void*\", \"char *\", or \"char**\" equivalent"); + "a \"void*\", \"char *\", \"short *\", \"char**\", or \"short**\" equivalent"); } } binding.addJavaArgumentType(mappedType); |