1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright 2010 LunarG, Inc. 4848b8605Smrg * All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the 8848b8605Smrg * "Software"), to deal in the Software without restriction, including 9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to 11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to 12848b8605Smrg * the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice (including the 15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions 16848b8605Smrg * of the Software. 17848b8605Smrg * 18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19848b8605Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22848b8605Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23848b8605Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24848b8605Smrg * DEALINGS IN THE SOFTWARE. 25848b8605Smrg * 26848b8605Smrg **************************************************************************/ 27848b8605Smrg 28848b8605Smrg 29848b8605Smrg#ifndef EGLARRAY_INCLUDED 30848b8605Smrg#define EGLARRAY_INCLUDED 31848b8605Smrg 32b8e80941Smrg#include "c99_compat.h" 33848b8605Smrg 34848b8605Smrg#include "egltypedefs.h" 35848b8605Smrg 36848b8605Smrg 37b8e80941Smrg#ifdef __cplusplus 38b8e80941Smrgextern "C" { 39b8e80941Smrg#endif 40b8e80941Smrg 41848b8605Smrgtypedef EGLBoolean (*_EGLArrayForEach)(void *elem, void *foreach_data); 42848b8605Smrg 43848b8605Smrg 44848b8605Smrgstruct _egl_array { 45848b8605Smrg const char *Name; 46848b8605Smrg EGLint MaxSize; 47848b8605Smrg 48848b8605Smrg void **Elements; 49848b8605Smrg EGLint Size; 50848b8605Smrg}; 51848b8605Smrg 52848b8605Smrg 53848b8605Smrgextern _EGLArray * 54848b8605Smrg_eglCreateArray(const char *name, EGLint init_size); 55848b8605Smrg 56848b8605Smrg 57b8e80941Smrgextern void 58848b8605Smrg_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *)); 59848b8605Smrg 60848b8605Smrg 61848b8605Smrgextern void 62848b8605Smrg_eglAppendArray(_EGLArray *array, void *elem); 63848b8605Smrg 64848b8605Smrg 65848b8605Smrgextern void 66848b8605Smrg_eglEraseArray(_EGLArray *array, EGLint i, void (*free_cb)(void *)); 67848b8605Smrg 68848b8605Smrg 69848b8605Smrgvoid * 70848b8605Smrg_eglFindArray(_EGLArray *array, void *elem); 71848b8605Smrg 72848b8605Smrg 73b8e80941Smrgextern EGLint 74848b8605Smrg_eglFilterArray(_EGLArray *array, void **data, EGLint size, 75848b8605Smrg _EGLArrayForEach filter, void *filter_data); 76848b8605Smrg 77848b8605Smrg 78848b8605SmrgEGLint 79848b8605Smrg_eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, 80848b8605Smrg _EGLArrayForEach flatten); 81848b8605Smrg 82848b8605Smrg 83b8e80941Smrgstatic inline EGLint 84848b8605Smrg_eglGetArraySize(_EGLArray *array) 85848b8605Smrg{ 86848b8605Smrg return (array) ? array->Size : 0; 87848b8605Smrg} 88848b8605Smrg 89848b8605Smrg 90b8e80941Smrg#ifdef __cplusplus 91b8e80941Smrg} 92b8e80941Smrg#endif 93b8e80941Smrg 94848b8605Smrg#endif /* EGLARRAY_INCLUDED */ 95