[17] | 1 | /* -*- mode: C; tab-width:8; c-basic-offset:8 -*- |
---|
| 2 | * vi:set ts=8: |
---|
| 3 | * |
---|
| 4 | * al_ext.h |
---|
| 5 | * |
---|
| 6 | * Extension handling. |
---|
| 7 | */ |
---|
| 8 | #ifndef _AL_EXT_H_ |
---|
| 9 | #define _AL_EXT_H_ |
---|
| 10 | |
---|
| 11 | #include "al_siteconfig.h" |
---|
| 12 | |
---|
| 13 | #include "al_types.h" |
---|
| 14 | #include "al_filter.h" |
---|
| 15 | #include "al_config.h" |
---|
| 16 | |
---|
| 17 | /* |
---|
| 18 | * the LAL... defines are used in conjunction with plugins, to determine the |
---|
| 19 | * symbols defined in each at runtime. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #define LAL_EXT_SUFFIX 03282000 |
---|
| 23 | #define LAL_EXT_TABLE alExtension |
---|
| 24 | #define LAL_EXT_INIT alExtInit |
---|
| 25 | #define LAL_EXT_FINI alExtFini |
---|
| 26 | |
---|
| 27 | #define LAL_EXT_TABLE_STR PASTE(LAL_EXT_TABLE, LAL_EXT_SUFFIX) |
---|
| 28 | #define LAL_EXT_INIT_STR PASTE(LAL_EXT_INIT, LAL_EXT_SUFFIX) |
---|
| 29 | #define LAL_EXT_FINI_STR PASTE(LAL_EXT_FINI, LAL_EXT_SUFFIX) |
---|
| 30 | |
---|
| 31 | #define PASTE__(a1) #a1 |
---|
| 32 | #define PASTE_(a1, a2) PASTE__(a1 ## _ ## a2) |
---|
| 33 | #define PASTE(a1, a2) PASTE_(a1, a2) |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | /* stuff that was in the standard 1.0 headers, but shouldn't have been... */ |
---|
| 37 | #ifndef AL_BYTE_LOKI |
---|
| 38 | #define AL_BYTE_LOKI 0x100C |
---|
| 39 | #endif |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | /* bookkeeping stuff */ |
---|
| 43 | |
---|
| 44 | /* |
---|
| 45 | * Initialize data structures neccesary for the registration and management of |
---|
| 46 | * extension groups and extension functions. Return AL_TRUE if successful, |
---|
| 47 | * AL_FALSE otherwise. |
---|
| 48 | */ |
---|
| 49 | ALboolean _alInitExtensions( void ); |
---|
| 50 | |
---|
| 51 | /* |
---|
| 52 | * Deallocs the data structures allocated in _alInitExtensions. |
---|
| 53 | */ |
---|
| 54 | void _alDestroyExtensions( void ); |
---|
| 55 | |
---|
| 56 | /* |
---|
| 57 | * Registers an extension group. Before registration, queries of |
---|
| 58 | * alIsExtensionPresent( extGroup) will return AL_FALSE, after will |
---|
| 59 | * return AL_TRUE. |
---|
| 60 | * |
---|
| 61 | * Returns AL_TRUE if registration was successful, AL_FALSE otherwise. |
---|
| 62 | */ |
---|
| 63 | ALboolean _alRegisterExtensionGroup( const ALubyte *extGroup ); |
---|
| 64 | |
---|
| 65 | /* |
---|
| 66 | * Destroy data structures needed to hold extension group information. |
---|
| 67 | */ |
---|
| 68 | void _alDestroyExtensionGroups( void ); |
---|
| 69 | |
---|
| 70 | /* |
---|
| 71 | * Gets a list of extension groups registered, populating buffer up to size. |
---|
| 72 | * |
---|
| 73 | * Returns AL_FALSE if size < 1, AL_TRUE otherwise. |
---|
| 74 | */ |
---|
| 75 | ALboolean _alGetExtensionStrings( ALchar *buffer, size_t size ); |
---|
| 76 | |
---|
| 77 | /* TODO: exporting this is a HACK */ |
---|
| 78 | ALboolean _alGetExtensionProcAddress( AL_funcPtr *procAddress, const ALchar *funcName ); |
---|
| 79 | |
---|
| 80 | /* |
---|
| 81 | * Adds a function to the available extension registry. Before registration, |
---|
| 82 | * queries of alGetProcAddress( name ) will return NULL. After, they will |
---|
| 83 | * return addr. |
---|
| 84 | * |
---|
| 85 | * Returns AL_FALSE if name has already been registered, AL_TRUE otherwise. |
---|
| 86 | */ |
---|
| 87 | ALboolean _alRegisterExtension( const ALubyte *name, AL_funcPtr addr ); |
---|
| 88 | |
---|
| 89 | /* |
---|
| 90 | * dlopens a shared object, gets the extension table from it, and |
---|
| 91 | * the runs _alRegisterExtension on each extension pair in it. |
---|
| 92 | * |
---|
| 93 | * Returns AL_TRUE if fname refers to a valid plugin, AL_FALSE otherwise. |
---|
| 94 | */ |
---|
| 95 | ALboolean _alLoadDL( const char *fname ); |
---|
| 96 | |
---|
| 97 | /* |
---|
| 98 | * Functions that extensions can call to add functionality. |
---|
| 99 | */ |
---|
| 100 | |
---|
| 101 | /* |
---|
| 102 | * add a filter by name, replacing if already there. Returns |
---|
| 103 | * AL_TRUE if function was added or replaced, AL_FALSE if that |
---|
| 104 | * wasn't possible. |
---|
| 105 | */ |
---|
| 106 | ALboolean lal_addTimeFilter( const char *name, time_filter *addr ); |
---|
| 107 | |
---|
| 108 | /* |
---|
| 109 | * alLokiTest( void *dummy ) |
---|
| 110 | * |
---|
| 111 | * For testing purposes |
---|
| 112 | */ |
---|
| 113 | void alLokiTest( void *dummy ); |
---|
| 114 | |
---|
| 115 | /* |
---|
| 116 | * look up bindings for symbols. |
---|
| 117 | * |
---|
| 118 | * FIXME: should replace with rc_lookup functions. |
---|
| 119 | */ |
---|
| 120 | #define lal_GetGlobalScalar(s,t,r) _alGetGlobalScalar(s,t,r) |
---|
| 121 | #define lal_GetGlobalVector(s,t,n,r) _alGetGlobalScalar(s,t,n,r) |
---|
| 122 | |
---|
| 123 | #endif /* _AL_EXT_H_ */ |
---|