diff options
Diffstat (limited to 'make')
-rwxr-xr-x | make/build.xml | 42 | ||||
-rwxr-xr-x | make/joal-alc.cfg | 18 | ||||
-rw-r--r-- | make/joal-alext-constants.cfg | 5 | ||||
-rw-r--r-- | make/joal-alext.cfg | 9 | ||||
-rwxr-xr-x | make/joal-common.cfg | 52 | ||||
-rwxr-xr-x | make/joal.cfg | 18 | ||||
-rw-r--r-- | make/scripts/tests.sh | 90 | ||||
-rw-r--r-- | make/stub_includes/openal/al-types.h | 12 | ||||
-rw-r--r-- | make/stub_includes/openal/al.h | 18 | ||||
-rw-r--r-- | make/stub_includes/openal/alc-types.h | 16 | ||||
-rw-r--r-- | make/stub_includes/openal/alc.h | 74 |
11 files changed, 212 insertions, 142 deletions
diff --git a/make/build.xml b/make/build.xml index 99fbb37..996bbdf 100755 --- a/make/build.xml +++ b/make/build.xml @@ -132,6 +132,8 @@ <property name="src.c" value="${project.root}/${rootrel.src.c}" /> <property name="src.java" value="${project.root}/${rootrel.src.java}" /> <property name="build" value="${project.root}/${rootrel.build}" /> + <property name="tempdir" value="${project.root}/build-temp" /> + <mkdir dir="${tempdir}" /> <!-- The generated source directories. --> <property name="src.generated" value="${build}/gensrc" /> @@ -232,6 +234,13 @@ </uptodate> </target> + <target name="java.generate.copy2temp"> + <copy todir="${tempdir}"> + <fileset dir="${build}" + includes="gensrc/classes/**" /> + </copy> + </target> + <!-- - Setup the generating ANT tasks and use it to generate the Java files - from the C AL headers. This involves setting the taskdef and creating @@ -244,67 +253,74 @@ <!-- Use the GlueGen task to generate the Java files --> - <!-- Generate the AL interface class and implementation --> + <echo message="Generate the AL interface class and implementation" /> <gluegen src="${stub.includes.openal}/al.h" outputRootDir="${build}" config="${joal.cfg}" includeRefid="stub.includes.fileset.all" literalInclude="${stub.includes.gluegen.gg}" - emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"> + emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter" + debug="false"> <classpath refid="gluegen.classpath" /> </gluegen> - <!-- Generate the ALConstants interface class --> + <echo message="Generate the ALConstants interface class" /> <gluegen src="${stub.includes.openal}/al.h" outputRootDir="${build}" config="${joal.constants.cfg}" includeRefid="stub.includes.fileset.all" literalInclude="${stub.includes.gluegen.gg}" - emitter="com.jogamp.gluegen.JavaEmitter"> + emitter="com.jogamp.gluegen.JavaEmitter" + debug="false"> <classpath refid="gluegen.classpath" /> </gluegen> - <!-- Generate the ALC interface class and implementation --> + <echo message="Generate the ALC interface class and implementation" /> <gluegen src="${stub.includes.openal}/alc.h" outputRootDir="${build}" config="${joal.alc.cfg}" includeRefid="stub.includes.fileset.all" literalInclude="${stub.includes.gluegen.gg}" - emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"> + emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter" + debug="false"> <classpath refid="gluegen.classpath" /> </gluegen> - <!-- Generate the ALCConstants interface class --> + <echo message="Generate the ALCConstants interface class" /> <gluegen src="${stub.includes.openal}/alc.h" outputRootDir="${build}" config="${joal.alc.constants.cfg}" includeRefid="stub.includes.fileset.all" literalInclude="${stub.includes.gluegen.gg}" - emitter="com.jogamp.gluegen.JavaEmitter"> + emitter="com.jogamp.gluegen.JavaEmitter" + debug="false"> <classpath refid="gluegen.classpath" /> </gluegen> - <!-- Generate the ALExt interface class and implementation --> + <echo message="Generate the ALExt interface class and implementation" /> + <antcall target="java.generate.copy2temp" inheritRefs="true" /> <gluegen src="${stub.includes.openal}/alext.h" outputRootDir="${build}" config="${joal.alext.cfg}" includeRefid="stub.includes.fileset.all" literalInclude="${stub.includes.gluegen.gg}" - emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"> + emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter" + debug="false"> <classpath refid="gluegen.classpath" /> </gluegen> - <!-- Generate the ALExt constants interface --> + <echo message="Generate the ALExt constants interface" /> + <antcall target="java.generate.copy2temp" inheritRefs="true" /> <gluegen src="${stub.includes.openal}/alext.h" outputRootDir="${build}" config="${joal.alext.constants.cfg}" includeRefid="stub.includes.fileset.all" literalInclude="${stub.includes.gluegen.gg}" - emitter="com.jogamp.gluegen.JavaEmitter"> + emitter="com.jogamp.gluegen.JavaEmitter" + debug="false"> <classpath refid="gluegen.classpath" /> </gluegen> - <!-- Inform the user that the generators have successfully created - the necessary Java files --> <echo message="" /> diff --git a/make/joal-alc.cfg b/make/joal-alc.cfg index 71b5fa6..c319078 100755 --- a/make/joal-alc.cfg +++ b/make/joal-alc.cfg @@ -22,18 +22,11 @@ Import jogamp.openal.* Ignore ^AL_.+ Ignore ^ALC_.+ -# This routine is ignored. The analogous routine alGetProcAddress is -# broken at least up through OpenAL 1.1 so there is no point in trying -# to use this routine to look up the ALC function pointers. -Ignore alcGetProcAddress - # Manually implement alcGetString so we can # implement alcGetString(NULL, ALC_DEVICE_SPECIFIER) in another method ReturnsString alcGetString ManuallyImplement alcGetString ForceProcAddressGen alcGetString -## Specify the return length of this function with our own custom strlen -##ReturnValueCapacity alcGetStringImpl strlen_alc(_device_ptr, {1}, _res) # Note that we don't declare this as "ReturnsString" because we're # going to wrap it in another method @@ -44,19 +37,8 @@ IncludeAs CustomJavaCode ALCAbstractImpl joal-alcabstract-CustomJavaCode.java ArgumentIsString alcIsExtensionPresent 1 ArgumentIsString alcOpenDevice 0 -# Mappings for data types -Opaque boolean ALCboolean - # Provide #includes to native code CustomCCode #include "alc.h" -# Indicate that the direct buffers for ALCcontext, etc. are "opaque", -# i.e., the user shouldn't be poking around in them -ReturnValueCapacity alcCreateContext 0 -ReturnValueCapacity alcGetContextsDevice 0 -ReturnValueCapacity alcGetCurrentContext 0 -ReturnValueCapacity alcGetCurrentDevice 0 -ReturnValueCapacity alcOpenDevice 0 - IncludeAs CustomCCode joal-common-CustomCCode.c IncludeAs CustomCCode joal-alc-impl-CustomCCode.c diff --git a/make/joal-alext-constants.cfg b/make/joal-alext-constants.cfg index e645bb8..2d6e03c 100644 --- a/make/joal-alext-constants.cfg +++ b/make/joal-alext-constants.cfg @@ -4,6 +4,11 @@ Include joal-common.cfg Style InterfaceOnly JavaClass ALExtConstants +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/AL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALConstants.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALC.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALCConstants.java + # Factor out the OpenAL constants into their own interface #IgnoreNot ^ALC_.+ IgnoreNot ^AL.+ diff --git a/make/joal-alext.cfg b/make/joal-alext.cfg index 826f73e..96c0322 100644 --- a/make/joal-alext.cfg +++ b/make/joal-alext.cfg @@ -8,6 +8,11 @@ ImplJavaClass ALExtAbstractImpl AccessControl ALExtAbstractImpl PUBLIC_ABSTRACT Extends ALExt ALExtConstants +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/AL.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALConstants.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALC.java +ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALCConstants.java + EmitProcAddressTable true ProcAddressTableClassName ALExtProcAddressTable GetProcAddressTableExpr alExtProcAddressTable @@ -24,10 +29,6 @@ Ignore ^ALC_.+ IncludeAs CustomJavaCode ALExtAbstractImpl joal-alextabstract-CustomJavaCode.java -# Mappings for data types -Opaque boolean ALCboolean -Opaque boolean ALboolean - # These routines use or return strings ArgumentIsString alcLoopbackOpenDeviceSOFT 0 diff --git a/make/joal-common.cfg b/make/joal-common.cfg index 6a2929b..36a8e8b 100755 --- a/make/joal-common.cfg +++ b/make/joal-common.cfg @@ -7,3 +7,55 @@ NativeOutputDir gensrc/native/joal # Raise ALException instead of RuntimeException in glue code RuntimeExceptionType ALException + +# We also have to hack its return type for now because we can't make +# just that void* opaque +Opaque long ALproc +Opaque long ALCproc + +# ALCdevice and ALCcontext are 'typesafe' opaque instances, +# i.e., using Java class instance without allowing the user poking around in them. +#Opaque long ALCdevice* +#Opaque long ALCcontext* +ReturnValueCapacity alcGetContextsDevice 0 +ReturnValueCapacity alcOpenDevice 0 +ReturnValueCapacity alcCaptureOpenDevice 0 +ReturnValueCapacity alcLoopbackOpenDeviceSOFT 0 +ReturnValueCapacity alcCreateContext 0 +ReturnValueCapacity alcGetCurrentContext 0 +ReturnValueCapacity alcGetThreadContext 0 +#ReturnValueCapacity alcGetCurrentDevice 0 ?? does not exist ?? + +# Mappings for data types +Opaque boolean ALboolean +Opaque boolean ALCboolean + +# This routine is not exposed in the public API +AccessControl alGetProcAddress PACKAGE_PRIVATE + +# This routine is ignored. The analogous routine alGetProcAddress is +# broken at least up through OpenAL 1.1 so there is no point in trying +# to use this routine to look up the ALC function pointers. +#Ignore alcGetProcAddress +AccessControl alcGetProcAddress PACKAGE_PRIVATE + +# This routine doesn't seem to exist +Ignore alHint + +# These routines use or return strings +ReturnsString alGetString +ArgumentIsString alIsExtensionPresent 0 +ArgumentIsString alGetEnumValue 0 +ArgumentIsString alGetProcAddress 0 + +ReturnsString alcGetString +ArgumentIsString alcOpenDevice 0 +ArgumentIsString alcIsExtensionPresent 1 +ArgumentIsString alcGetProcAddress 1 +ArgumentIsString alcGetEnumValue 1 +ArgumentIsString alcCaptureOpenDevice 0 +ArgumentIsString alcLoopbackOpenDeviceSOFT 0 + +## Specify the return length of this function with our own custom strlen +##ReturnValueCapacity alcGetStringImpl strlen_alc(_device_ptr, {1}, _res) + diff --git a/make/joal.cfg b/make/joal.cfg index 5ce03f8..6b1bd32 100755 --- a/make/joal.cfg +++ b/make/joal.cfg @@ -21,24 +21,6 @@ Import java.security.PrivilegedAction # Factor out the OpenAL constants into their own interface Ignore ^AL_.+ -# This routine is not exposed in the public API -AccessControl alGetProcAddress PACKAGE_PRIVATE -# We also have to hack its return type for now because we can't make -# just that void* opaque -Opaque long ALproc - -# This routine doesn't seem to exist -Ignore alHint - -# Mappings for data types -Opaque boolean ALboolean - -# These routines use or return strings -ReturnsString alGetString -ArgumentIsString alIsExtensionPresent 0 -ArgumentIsString alGetEnumValue 0 -ArgumentIsString alGetProcAddress 0 - IncludeAs CustomJavaCode ALImpl joal-common-CustomJavaCode.java # Provide #includes to native code diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh new file mode 100644 index 0000000..e7c4189 --- /dev/null +++ b/make/scripts/tests.sh @@ -0,0 +1,90 @@ +function print_usage() { + echo "Usage: $0 java-exe java-xargs joal-build-dir" + echo "e.g.: bash scripts/tests.sh `which java` -d64 ../build-x86_64" +} + +if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then + print_usage + exit 0 +fi + +javaexe="$1" +shift +javaxargs=$1 +shift +bdir=$1 +shift +bdir_base=`basename $bdir` + +if [ ! -x "$javaexe" ] ; then + echo java-exe "$javaexe" is not an executable + print_usage + exit 1 +fi +if [ ! -d $bdir ] ; then + echo build-dir $bdir is not a directory + print_usage + exit 1 +fi + +rm -f java-run.log + +spath=`dirname $0` + +unset CLASSPATH + +which "$javaexe" 2>&1 | tee -a java-run.log +"$javaexe" -version 2>&1 | tee -a java-run.log + +GLUEGEN_DIR=$spath/../../../gluegen +GLUEGEN_BDIR=$GLUEGEN_DIR/$bdir_base +if [ ! -d $GLUEGEN_DIR -o ! -d $GLUEGEN_BDIR ] ; then + echo GLUEGEN not found + print_usage + exit +fi +JUNIT_JAR=$GLUEGEN_DIR/make/lib/junit.jar + +if [ -z "$ANT_PATH" ] ; then + ANT_PATH=$(dirname $(dirname $(which ant))) + if [ -e $ANT_PATH/lib/ant.jar ] ; then + export ANT_PATH + echo autosetting ANT_PATH to $ANT_PATH + fi +fi +if [ -z "$ANT_PATH" ] ; then + echo ANT_PATH does not exist, set it + print_usage + exit +fi +ANT_JARS=$ANT_PATH/lib/ant.jar:$ANT_PATH/lib/ant-junit.jar + +function jrun() { + #D_ARGS="-Djogamp.debug=all" + #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djoal.debug=true" + #D_ARGS="-Djoal.debug=all" + #X_ARGS="-verbose:jni" + #X_ARGS="-Xrs" + + export CLASSPATH=$GLUEGEN_BDIR/gluegen-rt.jar:$bdir/joal.jar:$bdir/joal-test.jar:$JUNIT_JAR:$ANT_JARS + echo CLASSPATH $CLASSPATH + + echo + echo "Test Start: $*" + echo + echo "$javaexe" $javaxargs $X_ARGS $D_ARGS $C_ARG $* + #gdb --args "$javaexe" $javaxargs $X_ARGS $D_ARGS $C_ARG $* + "$javaexe" $javaxargs $X_ARGS $D_ARGS $C_ARG $* + echo + echo "Test End: $*" + echo +} + +function testnormal() { + jrun $* 2>&1 | tee -a java-run.log +} + + +#testnormal com.jogamp.openal.test.manual.OpenALTest $* +#testnormal com.jogamp.openal.test.manual.Sound3DTest $* +testnormal com.jogamp.openal.test.junit.ALExtLoopbackDeviceSOFTTest $* diff --git a/make/stub_includes/openal/al-types.h b/make/stub_includes/openal/al-types.h index 373e125..86c952d 100644 --- a/make/stub_includes/openal/al-types.h +++ b/make/stub_includes/openal/al-types.h @@ -90,16 +90,8 @@ typedef double ALdouble; /** void type (for opaque pointers only) */ typedef void ALvoid; -/* Enumerant values begin at column 50. No tabs. */ - -/** "no distance model" or "no buffer" */ -#define AL_NONE 0 - -/** Boolean False. */ -#define AL_FALSE 0 - -/** Boolean True. */ -#define AL_TRUE 1 +/** void* function pointer type for all al*GetProcAddress (By JOAL/GlueGen) */ +typedef void* ALproc; #if defined(__cplusplus) } /* extern "C" */ diff --git a/make/stub_includes/openal/al.h b/make/stub_includes/openal/al.h index 49a4119..49ed277 100644 --- a/make/stub_includes/openal/al.h +++ b/make/stub_includes/openal/al.h @@ -5,7 +5,21 @@ #define AL_ALEXT_PROTOTYPES #define AL_EXT_FOLDBACK #include "al-types.h" -#include "alc-types.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/* Enumerant values begin at column 50. No tabs. */ + +/** "no distance model" or "no buffer" */ +#define AL_NONE 0 + +/** Boolean False. */ +#define AL_FALSE 0 + +/** Boolean True. */ +#define AL_TRUE 1 /** * Relative source. @@ -400,7 +414,7 @@ AL_API ALenum AL_APIENTRY alGetError(void); * pointers and enum values. */ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname); -AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname); +AL_API ALproc AL_APIENTRY alGetProcAddress(const ALchar *fname); AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename); diff --git a/make/stub_includes/openal/alc-types.h b/make/stub_includes/openal/alc-types.h index b84fe7b..2616af8 100644 --- a/make/stub_includes/openal/alc-types.h +++ b/make/stub_includes/openal/alc-types.h @@ -29,17 +29,18 @@ extern "C" { * The ALCAPI, ALCAPIENTRY, and ALC_INVALID macros are deprecated, but are * included for applications porting code from AL 1.0 */ -#define ALCAPI ALC_API -#define ALCAPIENTRY ALC_APIENTRY -#define ALC_INVALID 0 +#define ALCAPI ALC_API +#define ALCAPIENTRY ALC_APIENTRY +#define ALC_INVALID 0 +/** ALC Version */ +#define ALC_VERSION_0_1 1 -#define ALC_VERSION_0_1 1 - +/** Opaque device handle */ typedef struct ALCdevice_struct ALCdevice; +/** Opaque context handle */ typedef struct ALCcontext_struct ALCcontext; - /** 8-bit boolean */ typedef char ALCboolean; @@ -79,6 +80,9 @@ typedef double ALCdouble; /** void type (for opaque pointers only) */ typedef void ALCvoid; +/** void* function pointer type for all al*GetProcAddress (By JOAL/GlueGen) */ +typedef void* ALCproc; + /** * intptr_t: * Using <gluegen_stddef.h> diff --git a/make/stub_includes/openal/alc.h b/make/stub_includes/openal/alc.h index 294e8b3..4170b62 100644 --- a/make/stub_includes/openal/alc.h +++ b/make/stub_includes/openal/alc.h @@ -1,80 +1,12 @@ #ifndef AL_ALC_H #define AL_ALC_H +#include "alc-types.h" + #if defined(__cplusplus) extern "C" { #endif -#ifndef ALC_API - #if defined(AL_LIBTYPE_STATIC) - #define ALC_API - #elif defined(_WIN32) - #define ALC_API __declspec(dllimport) - #else - #define ALC_API extern - #endif -#endif - -#if defined(_WIN32) - #define ALC_APIENTRY __cdecl -#else - #define ALC_APIENTRY -#endif - - -/** Deprecated macro. */ -#define ALCAPI ALC_API -#define ALCAPIENTRY ALC_APIENTRY -#define ALC_INVALID 0 - -/** Supported ALC version? */ -#define ALC_VERSION_0_1 1 - -/** Opaque device handle */ -typedef struct ALCdevice_struct ALCdevice; -/** Opaque context handle */ -typedef struct ALCcontext_struct ALCcontext; - -/** 8-bit boolean */ -typedef char ALCboolean; - -/** character */ -typedef char ALCchar; - -/** signed 8-bit 2's complement integer */ -typedef signed char ALCbyte; - -/** unsigned 8-bit integer */ -typedef unsigned char ALCubyte; - -/** signed 16-bit 2's complement integer */ -typedef short ALCshort; - -/** unsigned 16-bit integer */ -typedef unsigned short ALCushort; - -/** signed 32-bit 2's complement integer */ -typedef int ALCint; - -/** unsigned 32-bit integer */ -typedef unsigned int ALCuint; - -/** non-negative 32-bit binary integer size */ -typedef int ALCsizei; - -/** enumerated 32-bit value */ -typedef int ALCenum; - -/** 32-bit IEEE754 floating-point */ -typedef float ALCfloat; - -/** 64-bit IEEE754 floating-point */ -typedef double ALCdouble; - -/** void type (for opaque pointers only) */ -typedef void ALCvoid; - - /* Enumerant values begin at column 50. No tabs. */ /** Boolean False. */ @@ -194,7 +126,7 @@ ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device); * function pointers and enum values. */ ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname); -ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname); +ALC_API ALCproc ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname); ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname); /** Query function. */ |