00001 // Copyright (C) 2011 CNRS - Ecole Polytechnique - INRIA. 00002 // 00003 // This file is part of TIFA. 00004 // 00005 // TIFA is free software; you can redistribute it and/or modify it under the 00006 // terms of the GNU Lesser General Public License as published by the Free 00007 // Software Foundation; either version 2.1 of the License, or (at your option) 00008 // any later version. 00009 // 00010 // TIFA is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00013 // more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, 00017 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00032 #if !defined(_TIFA_X_ARRAY_LIST_H_) 00033 00037 #define _TIFA_X_ARRAY_LIST_H_ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 #include <inttypes.h> 00044 #include "array.h" 00045 00046 /* 00047 *----------------------------------------------------------------------------- 00048 * uint32_array_list_t and associated functions 00049 *----------------------------------------------------------------------------- 00050 */ 00051 00062 struct struct_uint32_array_list_t { 00067 uint32_t alloced; 00072 uint32_t length; 00077 uint32_array_t** data; 00078 }; 00079 00084 typedef struct struct_uint32_array_list_t uint32_array_list_t; 00085 00098 uint32_array_list_t* alloc_uint32_array_list(uint32_t alloced); 00099 00116 inline static void 00117 add_entry_in_uint32_array_list(uint32_array_t* const entry, 00118 uint32_array_list_t* const list) { 00119 // 00120 // _WARNING_: Ownership of the uint32_array_t pointed by entry is 00121 // transfered to the uint32_array_list_t 00122 // 00123 if (list->length != list->alloced) { 00124 list->data[list->length] = entry; 00125 list->length++; 00126 } 00127 } 00128 00139 void free_uint32_array_list(uint32_array_list_t* const list); 00140 00151 void print_uint32_array_list(const uint32_array_list_t* const list); 00152 00153 00154 /* 00155 *----------------------------------------------------------------------------- 00156 * mpz_array_list_t and associated functions 00157 *----------------------------------------------------------------------------- 00158 */ 00159 00170 struct struct_mpz_array_list_t { 00175 uint32_t alloced; 00180 uint32_t length; 00185 mpz_array_t** data; 00186 }; 00187 00192 typedef struct struct_mpz_array_list_t mpz_array_list_t; 00193 00206 mpz_array_list_t* alloc_mpz_array_list(uint32_t alloced); 00207 00224 inline static void 00225 add_entry_in_mpz_array_list(mpz_array_t* const entry, 00226 mpz_array_list_t* const list) { 00227 // 00228 // _WARNING_: Ownership of the mpz_array_t pointed by entry is 00229 // transfered to the mpz_array_list_t 00230 // 00231 list->data[list->length] = entry; 00232 list->length++; 00233 } 00234 00245 void free_mpz_array_list(mpz_array_list_t* const list); 00246 00257 void print_mpz_array_list(const mpz_array_list_t* const list); 00258 00259 #ifdef __cplusplus 00260 } 00261 #endif 00262 00263 #endif