gdsl
1.8
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2017 Nicolas Darnis <ndarnis@free.fr>. 00004 * 00005 * GDSL is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * GDSL 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 GDSL. If not, see <http://www.gnu.org/licenses/>. 00017 * 00018 * $RCSfile: gdsl_types.h,v $ 00019 * $Revision: 1.26 $ 00020 * $Date: 2015/02/17 12:22:57 $ 00021 */ 00022 00023 00024 #ifndef _GDSL_TYPES_H_ 00025 #define _GDSL_TYPES_H_ 00026 00027 00028 #include <stdio.h> 00029 00030 00031 #ifdef __cplusplus 00032 extern "C" 00033 { 00034 #endif /* __cplusplus */ 00035 00036 00046 typedef enum 00047 { 00049 GDSL_ERR_MEM_ALLOC = -1, 00050 00052 GDSL_MAP_STOP = 0, 00053 00055 GDSL_MAP_CONT = 1, 00056 00058 GDSL_INSERTED, 00059 00061 GDSL_FOUND 00062 00063 } gdsl_constant_t; 00064 00067 typedef enum 00068 { 00070 GDSL_LOCATION_UNDEF = 0, 00071 00073 /* (for _node, _list, list, queue) */ 00074 GDSL_LOCATION_HEAD = 1, 00075 00077 /* (for _bintree, _bstree) */ 00078 GDSL_LOCATION_ROOT = 1, 00079 00081 /* (for stack) */ 00082 GDSL_LOCATION_TOP = 1, 00083 00085 /* (for _node, _list, list, queue) */ 00086 GDSL_LOCATION_TAIL = 2, 00087 00089 /* (for _bintree, _bstree) */ 00090 GDSL_LOCATION_LEAF = 2, 00091 00093 /* (for stack) */ 00094 GDSL_LOCATION_BOTTOM = 2, 00095 00097 /* (for perm) */ 00098 GDSL_LOCATION_FIRST = 1, 00099 00101 /* (for perm) */ 00102 GDSL_LOCATION_LAST = 2, 00103 00105 /* (for 2darray) */ 00106 GDSL_LOCATION_FIRST_COL = 1, 00107 00109 /* (for 2darray) */ 00110 GDSL_LOCATION_LAST_COL = 2, 00111 00113 /* (for 2darray) */ 00114 GDSL_LOCATION_FIRST_ROW = 4, 00115 00117 /* (for 2darray) */ 00118 GDSL_LOCATION_LAST_ROW = 8 00119 00120 } gdsl_location_t; 00121 00128 typedef void* gdsl_element_t; 00129 00141 typedef gdsl_element_t 00142 (* gdsl_alloc_func_t) (void* USER_DATA 00143 ); 00144 00159 typedef void 00160 (* gdsl_free_func_t) (gdsl_element_t E 00161 ); 00162 00172 typedef gdsl_element_t 00173 (* gdsl_copy_func_t) (const gdsl_element_t E 00174 ); 00175 00189 typedef int 00190 (* gdsl_map_func_t) (const gdsl_element_t E, 00191 gdsl_location_t LOCATION, 00192 void* USER_DATA 00193 ); 00194 00210 typedef long int 00211 (* gdsl_compare_func_t) (const gdsl_element_t E, 00212 void* VALUE 00213 ); 00214 00226 typedef void 00227 (* gdsl_write_func_t) (const gdsl_element_t E, 00228 FILE* OUTPUT_FILE, 00229 gdsl_location_t LOCATION, 00230 void* USER_DATA 00231 ); 00232 00233 00234 #ifndef WITHOUT_GDSL_TYPES 00235 00236 00237 #include <sys/types.h> 00238 00239 #ifndef HAVE_ULONG 00240 typedef unsigned long int ulong; 00241 #endif /* HAVE_ULONG */ 00242 00243 #ifndef HAVE_USHORT 00244 typedef unsigned short int ushort; 00245 #endif /* HAVE_USHORT */ 00246 00247 #ifndef __cplusplus 00248 00249 #ifdef TRUE 00250 #undef TRUE 00251 #endif 00252 00253 #ifdef FALSE 00254 #undef FALSE 00255 #endif 00256 00257 #ifdef bool 00258 #undef bool 00259 #endif 00260 00265 typedef enum 00266 { 00268 FALSE = 0, 00269 00271 TRUE = 1 00272 } bool; 00273 00274 #endif /* not __cplusplus */ 00275 00276 #endif /* not WITHOUT_GDSL_TYPES */ 00277 00278 00279 /* 00280 * @} 00281 */ 00282 00283 00284 #ifdef __cplusplus 00285 } 00286 #endif /* __cplusplus */ 00287 00288 00289 #endif /* _GDSL_TYPES_H_ */ 00290 00291