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 00064 typedef enum 00065 { 00067 GDSL_ERR_MEM_ALLOC = -1, 00068 00070 GDSL_MAP_STOP = 0, 00071 00073 GDSL_MAP_CONT = 1, 00074 00076 GDSL_INSERTED, 00077 00079 GDSL_FOUND 00080 00081 } gdsl_constant_t; 00082 00085 typedef enum 00086 { 00088 GDSL_LOCATION_UNDEF = 0, 00089 00091 /* (for _node, _list, list, queue) */ 00092 GDSL_LOCATION_HEAD = 1, 00093 00095 /* (for _bintree, _bstree) */ 00096 GDSL_LOCATION_ROOT = 1, 00097 00099 /* (for stack) */ 00100 GDSL_LOCATION_TOP = 1, 00101 00103 /* (for _node, _list, list, queue) */ 00104 GDSL_LOCATION_TAIL = 2, 00105 00107 /* (for _bintree, _bstree) */ 00108 GDSL_LOCATION_LEAF = 2, 00109 00111 /* (for stack) */ 00112 GDSL_LOCATION_BOTTOM = 2, 00113 00115 /* (for perm) */ 00116 GDSL_LOCATION_FIRST = 1, 00117 00119 /* (for perm) */ 00120 GDSL_LOCATION_LAST = 2, 00121 00123 /* (for 2darray) */ 00124 GDSL_LOCATION_FIRST_COL = 1, 00125 00127 /* (for 2darray) */ 00128 GDSL_LOCATION_LAST_COL = 2, 00129 00131 /* (for 2darray) */ 00132 GDSL_LOCATION_FIRST_ROW = 4, 00133 00135 /* (for 2darray) */ 00136 GDSL_LOCATION_LAST_ROW = 8 00137 00138 } gdsl_location_t; 00139 00146 typedef void* gdsl_element_t; 00147 00159 typedef gdsl_element_t 00160 (* gdsl_alloc_func_t) (void* USER_DATA 00161 ); 00162 00177 typedef void 00178 (* gdsl_free_func_t) (gdsl_element_t E 00179 ); 00180 00190 typedef gdsl_element_t 00191 (* gdsl_copy_func_t) (const gdsl_element_t E 00192 ); 00193 00207 typedef int 00208 (* gdsl_map_func_t) (const gdsl_element_t E, 00209 gdsl_location_t LOCATION, 00210 void* USER_DATA 00211 ); 00212 00228 typedef long int 00229 (* gdsl_compare_func_t) (const gdsl_element_t E, 00230 void* VALUE 00231 ); 00232 00244 typedef void 00245 (* gdsl_write_func_t) (const gdsl_element_t E, 00246 FILE* OUTPUT_FILE, 00247 gdsl_location_t LOCATION, 00248 void* USER_DATA 00249 ); 00250 00251 00252 #ifndef WITHOUT_GDSL_TYPES 00253 00254 00255 #include <sys/types.h> 00256 00257 #ifndef HAVE_ULONG 00258 typedef unsigned long int ulong; 00259 #endif /* HAVE_ULONG */ 00260 00261 #ifndef HAVE_USHORT 00262 typedef unsigned short int ushort; 00263 #endif /* HAVE_USHORT */ 00264 00265 #ifndef __cplusplus 00266 00267 #ifdef TRUE 00268 #undef TRUE 00269 #endif 00270 00271 #ifdef FALSE 00272 #undef FALSE 00273 #endif 00274 00275 #ifdef bool 00276 #undef bool 00277 #endif 00278 00283 typedef enum 00284 { 00286 FALSE = 0, 00287 00289 TRUE = 1 00290 } bool; 00291 00292 #endif /* not __cplusplus */ 00293 00294 #endif /* not WITHOUT_GDSL_TYPES */ 00295 00296 00302 #ifdef __cplusplus 00303 } 00304 #endif /* __cplusplus */ 00305 00306 00307 #endif /* _GDSL_TYPES_H_ */ 00308 00309