gdsl
1.7
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2006 Nicolas Darnis <ndarnis@free.fr>. 00004 * 00005 * The GDSL library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License as 00007 * published by the Free Software Foundation; either version 2 of 00008 * the License, or (at your option) any later version. 00009 * 00010 * The GDSL library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with the GDSL library; see the file COPYING. 00017 * If not, write to the Free Software Foundation, Inc., 00018 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00019 * 00020 * $RCSfile: gdsl_types.h,v $ 00021 * $Revision: 1.25 $ 00022 * $Date: 2012/08/21 13:00:04 $ 00023 */ 00024 00025 00026 #ifndef _GDSL_TYPES_H_ 00027 #define _GDSL_TYPES_H_ 00028 00029 00030 #include <stdio.h> 00031 00032 00033 #ifdef __cplusplus 00034 extern "C" 00035 { 00036 #endif /* __cplusplus */ 00037 00038 00048 typedef enum 00049 { 00051 GDSL_ERR_MEM_ALLOC = -1, 00052 00054 GDSL_MAP_STOP = 0, 00055 00057 GDSL_MAP_CONT = 1, 00058 00060 GDSL_INSERTED, 00061 00063 GDSL_FOUND 00064 00065 } gdsl_constant_t; 00066 00069 typedef enum 00070 { 00072 GDSL_LOCATION_UNDEF = 0, 00073 00075 /* (for _node, _list, list, queue) */ 00076 GDSL_LOCATION_HEAD = 1, 00077 00079 /* (for _bintree, _bstree) */ 00080 GDSL_LOCATION_ROOT = 1, 00081 00083 /* (for stack) */ 00084 GDSL_LOCATION_TOP = 1, 00085 00087 /* (for _node, _list, list, queue) */ 00088 GDSL_LOCATION_TAIL = 2, 00089 00091 /* (for _bintree, _bstree) */ 00092 GDSL_LOCATION_LEAF = 2, 00093 00095 /* (for stack) */ 00096 GDSL_LOCATION_BOTTOM = 2, 00097 00099 /* (for perm) */ 00100 GDSL_LOCATION_FIRST = 1, 00101 00103 /* (for perm) */ 00104 GDSL_LOCATION_LAST = 2, 00105 00107 /* (for 2darray) */ 00108 GDSL_LOCATION_FIRST_COL = 1, 00109 00111 /* (for 2darray) */ 00112 GDSL_LOCATION_LAST_COL = 2, 00113 00115 /* (for 2darray) */ 00116 GDSL_LOCATION_FIRST_ROW = 4, 00117 00119 /* (for 2darray) */ 00120 GDSL_LOCATION_LAST_ROW = 8 00121 00122 } gdsl_location_t; 00123 00130 typedef void* gdsl_element_t; 00131 00143 typedef gdsl_element_t 00144 (* gdsl_alloc_func_t) (void* USER_DATA 00145 ); 00146 00161 typedef void 00162 (* gdsl_free_func_t) (gdsl_element_t E 00163 ); 00164 00174 typedef gdsl_element_t 00175 (* gdsl_copy_func_t) (const gdsl_element_t E 00176 ); 00177 00191 typedef int 00192 (* gdsl_map_func_t) (const gdsl_element_t E, 00193 gdsl_location_t LOCATION, 00194 void* USER_DATA 00195 ); 00196 00212 typedef long int 00213 (* gdsl_compare_func_t) (const gdsl_element_t E, 00214 void* VALUE 00215 ); 00216 00228 typedef void 00229 (* gdsl_write_func_t) (const gdsl_element_t E, 00230 FILE* OUTPUT_FILE, 00231 gdsl_location_t LOCATION, 00232 void* USER_DATA 00233 ); 00234 00235 00236 #ifndef WITHOUT_GDSL_TYPES 00237 00238 00239 #include <sys/types.h> 00240 00241 #ifndef HAVE_ULONG 00242 typedef unsigned long int ulong; 00243 #endif /* HAVE_ULONG */ 00244 00245 #ifndef HAVE_USHORT 00246 typedef unsigned short int ushort; 00247 #endif /* HAVE_USHORT */ 00248 00249 #ifndef __cplusplus 00250 00251 #ifdef TRUE 00252 #undef TRUE 00253 #endif 00254 00255 #ifdef FALSE 00256 #undef FALSE 00257 #endif 00258 00259 #ifdef bool 00260 #undef bool 00261 #endif 00262 00267 typedef enum 00268 { 00270 FALSE = 0, 00271 00273 TRUE = 1 00274 } bool; 00275 00276 #endif /* not __cplusplus */ 00277 00278 #endif /* not WITHOUT_GDSL_TYPES */ 00279 00280 00281 /* 00282 * @} 00283 */ 00284 00285 00286 #ifdef __cplusplus 00287 } 00288 #endif /* __cplusplus */ 00289 00290 00291 #endif /* _GDSL_TYPES_H_ */ 00292 00293