|
From: <sp...@us...> - 2010-03-16 17:58:55
|
Revision: 3288
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3288&view=rev
Author: spasi
Date: 2010-03-16 17:58:48 +0000 (Tue, 16 Mar 2010)
Log Message:
-----------
Added some alternate AL functions.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -153,6 +153,8 @@
}
void cleanup() {
+ GL15.glDeleteBuffers(bufferID);
+
GL20.glDetachShader(programID, shaderID);
GL20.glDeleteShader(shaderID);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -173,9 +173,7 @@
writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
}
- private void generateJavaSource(InterfaceDeclaration d) throws IOException {
- validateMethods(d);
- PrintWriter java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
+ private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException {
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
java_writer.println();
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
@@ -252,23 +250,25 @@
File input = d.getPosition().file();
File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
+ PrintWriter java_writer = null;
+
try {
// Skip this class if the output exists and the input has not been modified.
if ( output.exists() && input.lastModified() < output.lastModified() )
return;
- if (d.getMethods().size() > 0 || d.getFields().size() > 0)
- generateJavaSource(d);
+ if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
+ validateMethods(d);
+ java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
+ generateJavaSource(d, java_writer);
+ }
if (d.getMethods().size() > 0)
generateNativeSource(d);
} catch (Exception e) {
- try {
- // If anything goes wrong mid-gen, delete output to allow regen next time we run.
- if ( output.exists() )
- output.delete();
- } catch (Exception e2) {
- // ignore
- }
+ // If anything goes wrong mid-gen, delete output to allow regen next time we run.
+ if ( java_writer != null ) java_writer.close();
+ if ( output.exists() ) output.delete();
+
throw new RuntimeException(e);
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -73,6 +73,8 @@
}
Alternate alt_annotation = method.getAnnotation(Alternate.class);
if ( alt_annotation == null || alt_annotation.nativeAlt() ) {
+ if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) )
+ throw new RuntimeException("An alternate function with native code should have a different name than the main function.");
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
if (Utils.hasMethodBufferObjectParameter(method)) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -52,6 +52,8 @@
Iterator<? extends MethodDeclaration> it = d.getMethods().iterator();
while (it.hasNext()) {
MethodDeclaration method = it.next();
+ if ( method.getAnnotation(Alternate.class) != null )
+ continue;
EnumSet<Platform> platforms;
PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
if (platform_annotation != null)
Modified: trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2010-03-14 23:24:40 UTC (rev 3287)
+++ trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2010-03-16 17:58:48 UTC (rev 3288)
@@ -721,6 +721,10 @@
@ALvoid
void alGenSources(@AutoSize("sources") @ALsizei int n, @OutParameter @ALuint IntBuffer sources);
+ @Alternate(value = "alGenSources", nativeAlt = true)
+ @ALvoid
+ void alGenSources2(@Constant("1") @ALsizei int n, @Result @ALuint int source);
+
/**
* The application requests deletion of a number of Sources by DeleteSources.
*
@@ -729,6 +733,10 @@
@ALvoid
void alDeleteSources(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources);
+ @Alternate(value = "alDeleteSources", nativeAlt = true)
+ @ALvoid
+ void alDeleteSources2(@Constant("1") @ALsizei int n, @Indirect @ALuint int source);
+
/**
* The application can verify whether a source name is valid using the IsSource query.
*
@@ -945,6 +953,10 @@
@ALvoid
void alGenBuffers(@AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
+ @Alternate(value = "alGenBuffers", nativeAlt = true)
+ @ALvoid
+ void alGenBuffers2(@Constant("1") @ALsizei int n, @Result @ALuint int buffer);
+
/**
* <p>
* The application requests deletion of a number of Buffers by calling DeleteBuffers.
@@ -964,6 +976,10 @@
@ALvoid
void alDeleteBuffers(@AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
+ @Alternate(value = "alDeleteBuffers", nativeAlt = true)
+ @ALvoid
+ void alDeleteBuffers2(@Constant("1") @ALsizei int n, @Indirect @ALuint int buffer);
+
/**
* The application can verify whether a buffer Name is valid using the IsBuffer query.
*
@@ -1052,6 +1068,10 @@
@ALvoid
void alSourceQueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
+ @Alternate(value = "alSourceQueueBuffers", nativeAlt = true)
+ @ALvoid
+ void alSourceQueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Indirect @ALuint int buffer);
+
/**
* <p>
* Once a queue entry for a buffer has been appended to a queue and is pending
@@ -1074,6 +1094,10 @@
@ALvoid
void alSourceUnqueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
+ @Alternate(value = "alSourceUnqueueBuffers", nativeAlt = true)
+ @ALvoid
+ void alSourceUnqueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Result @ALuint int buffer);
+
/**
* <p>
* Samples usually use the entire dynamic range of the chosen format/encoding,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|