OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved. |
| 3 * |
| 4 * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 * copy of this software and associated documentation files (the |
| 6 * "Software"), to deal in the Software without restriction, including |
| 7 * without limitation the rights to use, copy, modify, merge, publish, |
| 8 * distribute, sub license, and/or sell copies of the Software, and to |
| 9 * permit persons to whom the Software is furnished to do so, subject to |
| 10 * the following conditions: |
| 11 * |
| 12 * The above copyright notice and this permission notice (including the |
| 13 * next paragraph) shall be included in all copies or substantial portions |
| 14 * of the Software. |
| 15 * |
| 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 19 * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR |
| 20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 */ |
| 24 |
| 25 /** |
| 26 * \file va_compat.h |
| 27 * \brief The Compatibility API |
| 28 * |
| 29 * This file contains the \ref api_compat "Compatibility API". |
| 30 */ |
| 31 |
| 32 #ifndef VA_COMPAT_H |
| 33 #define VA_COMPAT_H |
| 34 |
| 35 #ifdef __cplusplus |
| 36 extern "C" { |
| 37 #endif |
| 38 |
| 39 /** |
| 40 * \defgroup api_compat Compatibility API |
| 41 * |
| 42 * The Compatibility API allows older programs that are not ported to |
| 43 * the current API to still build and run correctly. In particular, |
| 44 * this exposes older API to allow for backwards source compatibility. |
| 45 * |
| 46 * @{ |
| 47 */ |
| 48 |
| 49 /** |
| 50 * Makes a string literal out of the macro argument |
| 51 */ |
| 52 #define VA_CPP_HELPER_STRINGIFY(x) \ |
| 53 VA_CPP_HELPER_STRINGIFY_(x) |
| 54 #define VA_CPP_HELPER_STRINGIFY_(x) \ |
| 55 #x |
| 56 |
| 57 /** |
| 58 * Concatenates two macro arguments at preprocessing time. |
| 59 */ |
| 60 #define VA_CPP_HELPER_CONCAT(a, b) \ |
| 61 VA_CPP_HELPER_CONCAT_(a, b) |
| 62 #define VA_CPP_HELPER_CONCAT_(a, b) \ |
| 63 a ## b |
| 64 |
| 65 /** |
| 66 * Generates the number of macro arguments at preprocessing time. |
| 67 * <http://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4a
3fb/346fc464319b1ee5> |
| 68 * |
| 69 * Note: this doesn't work for macros with no arguments |
| 70 */ |
| 71 #define VA_CPP_HELPER_N_ARGS(...) \ |
| 72 VA_CPP_HELPER_N_ARGS_(__VA_ARGS__, VA_CPP_HELPER_N_ARGS_LIST_REV()) |
| 73 #define VA_CPP_HELPER_N_ARGS_(...) \ |
| 74 VA_CPP_HELPER_N_ARGS_LIST(__VA_ARGS__) |
| 75 #define VA_CPP_HELPER_N_ARGS_LIST(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a12,
a13, a14, a15, a16, N, ...) N |
| 76 #define VA_CPP_HELPER_N_ARGS_LIST_REV() \ |
| 77 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
| 78 |
| 79 /** |
| 80 * Generates a versioned function alias. |
| 81 * |
| 82 * VA_CPP_HELPER_ALIAS(vaSomeFunction, 0,32,0) will generate |
| 83 * .symber vaSomeFunction_0_32_0, vaSomeFunction@VA_API_0.32.0 |
| 84 */ |
| 85 #define VA_CPP_HELPER_ALIAS(func, major, minor, micro) \ |
| 86 VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@") |
| 87 #define VA_CPP_HELPER_ALIAS_DEFAULT(func, major, minor, micro) \ |
| 88 VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@@") |
| 89 #define VA_CPP_HELPER_ALIAS_(func, major, minor, micro, binding) \ |
| 90 asm(".symver " #func "_" #major "_" #minor "_" #micro ", " \ |
| 91 #func binding "VA_API_" #major "." #minor "." #micro) |
| 92 |
| 93 /* vaCreateSurfaces() */ |
| 94 |
| 95 #ifndef VA_COMPAT_DISABLED |
| 96 #define vaCreateSurfaces(dpy, ...) \ |
| 97 VA_CPP_HELPER_CONCAT(vaCreateSurfaces, \ |
| 98 VA_CPP_HELPER_N_ARGS(dpy, __VA_ARGS__)) \ |
| 99 (dpy, __VA_ARGS__) |
| 100 #endif |
| 101 |
| 102 #define vaCreateSurfaces6(dpy, width, height, format, num_surfaces, surfaces) \ |
| 103 (vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \ |
| 104 NULL, 0) |
| 105 |
| 106 #define vaCreateSurfaces8(dpy, format, width, height, surfaces, num_surfaces, at
tribs, num_attribs) \ |
| 107 (vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \ |
| 108 attribs, num_attribs) |
| 109 |
| 110 /*@}*/ |
| 111 |
| 112 #ifdef __cplusplus |
| 113 } |
| 114 #endif |
| 115 |
| 116 #endif /* VA_COMPAT_H */ |
OLD | NEW |