diff options
author | Sven Gothel <[email protected]> | 2014-01-26 00:34:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-26 00:34:45 +0100 |
commit | 2b5522690722cb3b02a4b2aced6e4bd7b2f82dfe (patch) | |
tree | 44310a515a3aa77b55ff61bb4c2d230bf788f6f7 /make/config | |
parent | 23183ccf782c0252957c8d9cf2b51f70b9815acf (diff) |
Build: Move gluegen config files into make/config (cleanup)
Diffstat (limited to 'make/config')
-rwxr-xr-x | make/config/joal-alc-CustomJavaCode.java | 7 | ||||
-rwxr-xr-x | make/config/joal-alc-constants.cfg | 8 | ||||
-rwxr-xr-x | make/config/joal-alc-impl-CustomCCode.c | 16 | ||||
-rwxr-xr-x | make/config/joal-alc.cfg | 54 | ||||
-rwxr-xr-x | make/config/joal-alcabstract-CustomJavaCode.java | 16 | ||||
-rw-r--r-- | make/config/joal-alext-constants.cfg | 14 | ||||
-rw-r--r-- | make/config/joal-alext.cfg | 54 | ||||
-rw-r--r-- | make/config/joal-alextabstract-CustomJavaCode.java | 16 | ||||
-rwxr-xr-x | make/config/joal-common-CustomCCode.c | 3 | ||||
-rw-r--r-- | make/config/joal-common-CustomJavaCode.java | 38 | ||||
-rwxr-xr-x | make/config/joal-common.cfg | 61 | ||||
-rwxr-xr-x | make/config/joal-constants.cfg | 8 | ||||
-rwxr-xr-x | make/config/joal.cfg | 42 |
13 files changed, 337 insertions, 0 deletions
diff --git a/make/config/joal-alc-CustomJavaCode.java b/make/config/joal-alc-CustomJavaCode.java new file mode 100755 index 0000000..be28d8c --- /dev/null +++ b/make/config/joal-alc-CustomJavaCode.java @@ -0,0 +1,7 @@ +/** Fetches the names of the available ALC device specifiers. + Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER). */ +public java.lang.String[] alcGetDeviceSpecifiers(); + +/** Fetches the names of the available ALC capture device specifiers. + Equivalent to the C call alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER). */ +public java.lang.String[] alcGetCaptureDeviceSpecifiers(); diff --git a/make/config/joal-alc-constants.cfg b/make/config/joal-alc-constants.cfg new file mode 100755 index 0000000..83ea061 --- /dev/null +++ b/make/config/joal-alc-constants.cfg @@ -0,0 +1,8 @@ +# This .cfg file is used to generate the ALCConstants interface. +Include joal-common.cfg + +Style InterfaceOnly +JavaClass ALCConstants + +# Factor out the OpenAL constants into their own interface +IgnoreNot ^ALC_.+ diff --git a/make/config/joal-alc-impl-CustomCCode.c b/make/config/joal-alc-impl-CustomCCode.c new file mode 100755 index 0000000..9207210 --- /dev/null +++ b/make/config/joal-alc-impl-CustomCCode.c @@ -0,0 +1,16 @@ +int strlen_alc(ALCdevice *device, int param, const char* str) { + int len = 0; + if ((device == NULL) && (param == ALC_DEVICE_SPECIFIER)) { + while (*str != 0) { + while (*str != 0) { + ++str; + ++len; + } + ++str; + ++len; + } + return len; + } else { + return strlen(str); + } +} diff --git a/make/config/joal-alc.cfg b/make/config/joal-alc.cfg new file mode 100755 index 0000000..efba5a6 --- /dev/null +++ b/make/config/joal-alc.cfg @@ -0,0 +1,54 @@ +# This .cfg file is used to generate the JOAL interface. +Include joal-common.cfg + +Style InterfaceAndImpl +JavaClass ALC +ImplPackage jogamp.openal +ImplJavaClass ALCAbstractImpl +AccessControl ALCAbstractImpl PUBLIC_ABSTRACT +Extends ALC ALCConstants + +EmitProcAddressTable true +ProcAddressTableClassName ALCProcAddressTable +GetProcAddressTableExpr alcProcAddressTable +ProcAddressNameExpr LP $UPPERCASE({0}) + +# Force all of the methods to be emitted using dynamic linking so we +# don't need to link against any emulation library on the desktop or +# depend on the presence of an import library for a particular device +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to ALC_APIENTRY +LocalProcAddressCallingConvention __ALL__ ALC_APIENTRY + +Import java.io.UnsupportedEncodingException +Import java.util.* +Import com.jogamp.openal.* +Import jogamp.openal.* +Import java.security.AccessController +Import java.security.PrivilegedAction + +# Factor out the OpenAL constants into their own interface +Ignore ^AL_.+ +Ignore ^ALC_.+ + +# Manually implement alcGetString so we can +# implement alcGetString(NULL, ALC_DEVICE_SPECIFIER) in another method +ReturnsString alcGetString +ManuallyImplement alcGetString + +# Note that we don't declare this as "ReturnsString" because we're +# going to wrap it in another method +IncludeAs CustomJavaCode ALC joal-alc-CustomJavaCode.java +IncludeAs CustomJavaCode ALCAbstractImpl joal-alcabstract-CustomJavaCode.java + +# These routines use strings +ArgumentIsString alcIsExtensionPresent 1 +ArgumentIsString alcOpenDevice 0 + +# Provide #includes to native code +CustomCCode #include "alc.h" + +IncludeAs CustomCCode joal-common-CustomCCode.c +IncludeAs CustomCCode joal-alc-impl-CustomCCode.c diff --git a/make/config/joal-alcabstract-CustomJavaCode.java b/make/config/joal-alcabstract-CustomJavaCode.java new file mode 100755 index 0000000..debadad --- /dev/null +++ b/make/config/joal-alcabstract-CustomJavaCode.java @@ -0,0 +1,16 @@ +private static final ALCProcAddressTable alcProcAddressTable; + +static { + alcProcAddressTable = AccessController.doPrivileged(new PrivilegedAction<ALCProcAddressTable>() { + public ALCProcAddressTable run() { + final ALCProcAddressTable alcProcAddressTable = new ALCProcAddressTable(); + if(null==alcProcAddressTable) { + throw new RuntimeException("Couldn't instantiate ALCProcAddressTable"); + } + alcProcAddressTable.reset(ALImpl.alDynamicLookupHelper); + return alcProcAddressTable; + } } ); +} + +public static ALCProcAddressTable getALCProcAddressTable() { return alcProcAddressTable; } + diff --git a/make/config/joal-alext-constants.cfg b/make/config/joal-alext-constants.cfg new file mode 100644 index 0000000..4cd8cf0 --- /dev/null +++ b/make/config/joal-alext-constants.cfg @@ -0,0 +1,14 @@ +# This .cfg file is used to generate the ALCConstants interface. +Include joal-common.cfg + +Style InterfaceOnly +JavaClass ALExtConstants + +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/AL.java +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALConstants.java +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALC.java +ExtendedIntfAndImplSymbolsIgnore ../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/config/joal-alext.cfg b/make/config/joal-alext.cfg new file mode 100644 index 0000000..da63612 --- /dev/null +++ b/make/config/joal-alext.cfg @@ -0,0 +1,54 @@ +# This .cfg file is used to generate the JOAL interface. +Include joal-common.cfg + +Style InterfaceAndImpl +JavaClass ALExt +ImplPackage jogamp.openal +ImplJavaClass ALExtAbstractImpl +AccessControl ALExtAbstractImpl PUBLIC_ABSTRACT +Extends ALExt ALExtConstants + +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/AL.java +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALConstants.java +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALC.java +ExtendedIntfAndImplSymbolsIgnore ../build-temp/gensrc/classes/com/jogamp/openal/ALCConstants.java + +EmitProcAddressTable true +ProcAddressTableClassName ALExtProcAddressTable +GetProcAddressTableExpr alExtProcAddressTable +ProcAddressNameExpr LP $UPPERCASE({0}) + +# Force all of the methods to be emitted using dynamic linking so we +# don't need to link against any emulation library on the desktop or +# depend on the presence of an import library for a particular device +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to AL_APIENTRY +LocalProcAddressCallingConvention __ALL__ AL_APIENTRY + +Import java.io.UnsupportedEncodingException +Import java.util.* +Import com.jogamp.openal.* +Import jogamp.openal.* +Import java.security.AccessController +Import java.security.PrivilegedAction + +# Factor out the OpenAL constants into their own interface +Ignore ^AL_.+ +Ignore ^ALC_.+ + +IncludeAs CustomJavaCode ALExtAbstractImpl joal-alextabstract-CustomJavaCode.java + +# These routines use or return strings +ArgumentIsString alcLoopbackOpenDeviceSOFT 0 + +# Provide #includes to native code +CustomCCode #include "alext.h" + +# Indicate that the direct buffers for ALCcontext, etc. are "opaque", +# i.e., the user shouldn't be poking around in them +ReturnValueCapacity alcLoopbackOpenDeviceSOFT 0 + +IncludeAs CustomCCode joal-common-CustomCCode.c + diff --git a/make/config/joal-alextabstract-CustomJavaCode.java b/make/config/joal-alextabstract-CustomJavaCode.java new file mode 100644 index 0000000..e467fc7 --- /dev/null +++ b/make/config/joal-alextabstract-CustomJavaCode.java @@ -0,0 +1,16 @@ +private static final ALExtProcAddressTable alExtProcAddressTable; + +static { + alExtProcAddressTable = AccessController.doPrivileged(new PrivilegedAction<ALExtProcAddressTable>() { + public ALExtProcAddressTable run() { + final ALExtProcAddressTable alExtProcAddressTable = new ALExtProcAddressTable(); + if(null==alExtProcAddressTable) { + throw new RuntimeException("Couldn't instantiate ALExtProcAddressTable"); + } + alExtProcAddressTable.reset(ALImpl.alDynamicLookupHelper); + return alExtProcAddressTable; + } } ); +} + +public static ALExtProcAddressTable getALExtProcAddressTable() { return alExtProcAddressTable; } + diff --git a/make/config/joal-common-CustomCCode.c b/make/config/joal-common-CustomCCode.c new file mode 100755 index 0000000..e620735 --- /dev/null +++ b/make/config/joal-common-CustomCCode.c @@ -0,0 +1,3 @@ +#include <al-types.h> +#include <alc-types.h> +#include <string.h> diff --git a/make/config/joal-common-CustomJavaCode.java b/make/config/joal-common-CustomJavaCode.java new file mode 100644 index 0000000..5df6cfd --- /dev/null +++ b/make/config/joal-common-CustomJavaCode.java @@ -0,0 +1,38 @@ +static final DynamicLibraryBundle alDynamicLookupHelper; +private static final ALProcAddressTable alProcAddressTable; + +static { + alProcAddressTable = new ALProcAddressTable(); + if(null==alProcAddressTable) { + throw new RuntimeException("Couldn't instantiate ALProcAddressTable"); + } + + alDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() { + public DynamicLibraryBundle run() { + final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new ALDynamicLibraryBundleInfo()); + if(null==bundle) { + throw new RuntimeException("Null ALDynamicLookupHelper"); + } + if(!bundle.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native AL library"); + } + if(!bundle.isLibComplete()) { + throw new RuntimeException("Couln't load native AL/JNI glue library"); + } + alProcAddressTable.reset(bundle); + return bundle; + } } ); +} + +public static ALProcAddressTable getALProcAddressTable() { return alProcAddressTable; } + +static long alGetProcAddress(long alGetProcAddressHandle, java.lang.String procname) +{ + if (alGetProcAddressHandle == 0) { + throw new RuntimeException("Passed null pointer for method \"alGetProcAddress\""); + } + return dispatch_alGetProcAddressStatic(procname, alGetProcAddressHandle); +} + +static native long dispatch_alGetProcAddressStatic(String fname, long procAddress); + diff --git a/make/config/joal-common.cfg b/make/config/joal-common.cfg new file mode 100755 index 0000000..36a8e8b --- /dev/null +++ b/make/config/joal-common.cfg @@ -0,0 +1,61 @@ +Package com.jogamp.openal + +# Specify output directories +HierarchicalNativeOutput false +JavaOutputDir gensrc/classes +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/config/joal-constants.cfg b/make/config/joal-constants.cfg new file mode 100755 index 0000000..1385370 --- /dev/null +++ b/make/config/joal-constants.cfg @@ -0,0 +1,8 @@ +# This .cfg file is used to generate the ALConstants interface. +Include joal-common.cfg + +Style InterfaceOnly +JavaClass ALConstants + +# Factor out the OpenAL constants into their own interface +IgnoreNot ^AL_.+ diff --git a/make/config/joal.cfg b/make/config/joal.cfg new file mode 100755 index 0000000..661b84e --- /dev/null +++ b/make/config/joal.cfg @@ -0,0 +1,42 @@ +# This .cfg file is used to generate the JOAL interface. +Include joal-common.cfg + +Style InterfaceAndImpl +JavaClass AL +ImplPackage jogamp.openal +ImplJavaClass ALImpl +Extends AL ALConstants + +EmitProcAddressTable true +ProcAddressTableClassName ALProcAddressTable +GetProcAddressTableExpr alProcAddressTable +ProcAddressNameExpr LP $UPPERCASE({0}) + +# Force all of the methods to be emitted using dynamic linking so we +# don't need to link against any emulation library on the desktop or +# depend on the presence of an import library for a particular device +ForceProcAddressGen __ALL__ + +# Also force the calling conventions of the locally generated function +# pointer typedefs for these routines to AL_APIENTRY +LocalProcAddressCallingConvention __ALL__ AL_APIENTRY + +Import com.jogamp.openal.* +Import jogamp.openal.* +Import java.security.AccessController +Import java.security.PrivilegedAction + +# Factor out the OpenAL constants into their own interface +Ignore ^AL_.+ + +IncludeAs CustomJavaCode ALImpl joal-common-CustomJavaCode.java + +# Provide #includes to native code +CustomCCode #include "al.h" +CustomCCode #ifndef _MSC_VER /* Non-Windows platforms */ +CustomCCode #define __cdecl /* Trim non-standard keyword */ +CustomCCode #endif +CustomCCode #include "efx.h" + +IncludeAs CustomCCode joal-common-CustomCCode.c + |