gdsl
1.8
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2018 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 00019 /* 00020 * GDSL - Generic Data Structures Library 00021 * $RCSfile: gdsl_types.h,v $ 00022 * $Revision: 1.26 $ 00023 * $Date: 2015/02/17 12:22:57 $ 00024 */ 00025 00026 00027 #ifndef _GDSL_TYPES_H_ 00028 #define _GDSL_TYPES_H_ 00029 00030 00031 #include <stdio.h> 00032 00033 00034 #ifdef __cplusplus 00035 extern "C" 00036 { 00037 #endif /* __cplusplus */ 00038 00049 typedef enum 00050 { 00052 GDSL_ERR_MEM_ALLOC = -1, 00053 00055 GDSL_MAP_STOP = 0, 00056 00058 GDSL_MAP_CONT = 1, 00059 00061 GDSL_INSERTED, 00062 00064 GDSL_FOUND 00065 00066 } gdsl_constant_t; 00067 00070 typedef enum 00071 { 00073 GDSL_LOCATION_UNDEF = 0, 00074 00076 /* (for _node, _list, list, queue) */ 00077 GDSL_LOCATION_HEAD = 1, 00078 00080 /* (for _bintree, _bstree) */ 00081 GDSL_LOCATION_ROOT = 1, 00082 00084 /* (for stack) */ 00085 GDSL_LOCATION_TOP = 1, 00086 00088 /* (for _node, _list, list, queue) */ 00089 GDSL_LOCATION_TAIL = 2, 00090 00092 /* (for _bintree, _bstree) */ 00093 GDSL_LOCATION_LEAF = 2, 00094 00096 /* (for stack) */ 00097 GDSL_LOCATION_BOTTOM = 2, 00098 00100 /* (for perm) */ 00101 GDSL_LOCATION_FIRST = 1, 00102 00104 /* (for perm) */ 00105 GDSL_LOCATION_LAST = 2, 00106 00108 /* (for 2darray) */ 00109 GDSL_LOCATION_FIRST_COL = 1, 00110 00112 /* (for 2darray) */ 00113 GDSL_LOCATION_LAST_COL = 2, 00114 00116 /* (for 2darray) */ 00117 GDSL_LOCATION_FIRST_ROW = 4, 00118 00120 /* (for 2darray) */ 00121 GDSL_LOCATION_LAST_ROW = 8 00122 00123 } gdsl_location_t; 00124 00131 typedef void* gdsl_element_t; 00132 00144 typedef gdsl_element_t 00145 (* gdsl_alloc_func_t) (void* USER_DATA 00146 ); 00147 00162 typedef void 00163 (* gdsl_free_func_t) (gdsl_element_t E 00164 ); 00165 00175 typedef gdsl_element_t 00176 (* gdsl_copy_func_t) (const gdsl_element_t E 00177 ); 00178 00192 typedef int 00193 (* gdsl_map_func_t) (const gdsl_element_t E, 00194 gdsl_location_t LOCATION, 00195 void* USER_DATA 00196 ); 00197 00213 typedef long int 00214 (* gdsl_compare_func_t) (const gdsl_element_t E, 00215 void* VALUE 00216 ); 00217 00229 typedef void 00230 (* gdsl_write_func_t) (const gdsl_element_t E, 00231 FILE* OUTPUT_FILE, 00232 gdsl_location_t LOCATION, 00233 void* USER_DATA 00234 ); 00235 00236 00237 #ifndef WITHOUT_GDSL_TYPES 00238 00239 00240 #include <sys/types.h> 00241 00242 #ifndef HAVE_ULONG 00243 typedef unsigned long int ulong; 00244 #endif /* HAVE_ULONG */ 00245 00246 #ifndef HAVE_USHORT 00247 typedef unsigned short int ushort; 00248 #endif /* HAVE_USHORT */ 00249 00250 #ifndef __cplusplus 00251 00252 #ifdef TRUE 00253 #undef TRUE 00254 #endif 00255 00256 #ifdef FALSE 00257 #undef FALSE 00258 #endif 00259 00260 #ifdef bool 00261 #undef bool 00262 #endif 00263 00268 typedef enum 00269 { 00271 FALSE = 0, 00272 00274 TRUE = 1 00275 } bool; 00276 00277 #endif /* not __cplusplus */ 00278 00279 #endif /* not WITHOUT_GDSL_TYPES */ 00280 00281 00287 #ifdef __cplusplus 00288 } 00289 #endif /* __cplusplus */ 00290 00291 00292 #endif /* _GDSL_TYPES_H_ */ 00293 00294