13464ebd5Sriastradh/************************************************************************** 23464ebd5Sriastradh * 33464ebd5Sriastradh * Copyright 2010 LunarG, Inc. 43464ebd5Sriastradh * All Rights Reserved. 53464ebd5Sriastradh * 63464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a 73464ebd5Sriastradh * copy of this software and associated documentation files (the 83464ebd5Sriastradh * "Software"), to deal in the Software without restriction, including 93464ebd5Sriastradh * without limitation the rights to use, copy, modify, merge, publish, 103464ebd5Sriastradh * distribute, sub license, and/or sell copies of the Software, and to 113464ebd5Sriastradh * permit persons to whom the Software is furnished to do so, subject to 123464ebd5Sriastradh * the following conditions: 133464ebd5Sriastradh * 143464ebd5Sriastradh * The above copyright notice and this permission notice (including the 153464ebd5Sriastradh * next paragraph) shall be included in all copies or substantial portions 163464ebd5Sriastradh * of the Software. 173464ebd5Sriastradh * 183464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 193464ebd5Sriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 203464ebd5Sriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 213464ebd5Sriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 223464ebd5Sriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 233464ebd5Sriastradh * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 243464ebd5Sriastradh * DEALINGS IN THE SOFTWARE. 253464ebd5Sriastradh * 263464ebd5Sriastradh **************************************************************************/ 273464ebd5Sriastradh 283464ebd5Sriastradh 293464ebd5Sriastradh#ifndef EGLARRAY_INCLUDED 303464ebd5Sriastradh#define EGLARRAY_INCLUDED 313464ebd5Sriastradh 3201e04c3fSmrg#include "c99_compat.h" 333464ebd5Sriastradh 343464ebd5Sriastradh#include "egltypedefs.h" 353464ebd5Sriastradh 363464ebd5Sriastradh 3701e04c3fSmrg#ifdef __cplusplus 3801e04c3fSmrgextern "C" { 3901e04c3fSmrg#endif 4001e04c3fSmrg 413464ebd5Sriastradhtypedef EGLBoolean (*_EGLArrayForEach)(void *elem, void *foreach_data); 423464ebd5Sriastradh 433464ebd5Sriastradh 443464ebd5Sriastradhstruct _egl_array { 453464ebd5Sriastradh const char *Name; 463464ebd5Sriastradh EGLint MaxSize; 473464ebd5Sriastradh 483464ebd5Sriastradh void **Elements; 493464ebd5Sriastradh EGLint Size; 503464ebd5Sriastradh}; 513464ebd5Sriastradh 523464ebd5Sriastradh 533464ebd5Sriastradhextern _EGLArray * 543464ebd5Sriastradh_eglCreateArray(const char *name, EGLint init_size); 553464ebd5Sriastradh 563464ebd5Sriastradh 5701e04c3fSmrgextern void 583464ebd5Sriastradh_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *)); 593464ebd5Sriastradh 603464ebd5Sriastradh 613464ebd5Sriastradhextern void 623464ebd5Sriastradh_eglAppendArray(_EGLArray *array, void *elem); 633464ebd5Sriastradh 643464ebd5Sriastradh 653464ebd5Sriastradhextern void 663464ebd5Sriastradh_eglEraseArray(_EGLArray *array, EGLint i, void (*free_cb)(void *)); 673464ebd5Sriastradh 683464ebd5Sriastradh 693464ebd5Sriastradhvoid * 703464ebd5Sriastradh_eglFindArray(_EGLArray *array, void *elem); 713464ebd5Sriastradh 723464ebd5Sriastradh 7301e04c3fSmrgextern EGLint 743464ebd5Sriastradh_eglFilterArray(_EGLArray *array, void **data, EGLint size, 753464ebd5Sriastradh _EGLArrayForEach filter, void *filter_data); 763464ebd5Sriastradh 773464ebd5Sriastradh 783464ebd5SriastradhEGLint 793464ebd5Sriastradh_eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, 803464ebd5Sriastradh _EGLArrayForEach flatten); 813464ebd5Sriastradh 823464ebd5Sriastradh 8301e04c3fSmrgstatic inline EGLint 843464ebd5Sriastradh_eglGetArraySize(_EGLArray *array) 853464ebd5Sriastradh{ 863464ebd5Sriastradh return (array) ? array->Size : 0; 873464ebd5Sriastradh} 883464ebd5Sriastradh 893464ebd5Sriastradh 9001e04c3fSmrg#ifdef __cplusplus 9101e04c3fSmrg} 9201e04c3fSmrg#endif 9301e04c3fSmrg 943464ebd5Sriastradh#endif /* EGLARRAY_INCLUDED */ 95