00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 1998, 2003-2008 Peter Miller 00004 // 00005 // This program 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 // This program 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 this program. If not, see 00017 // <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #ifndef COMMON_ITAB_H 00021 #define COMMON_ITAB_H 00022 00023 #include <common/main.h> 00024 00030 typedef long itab_key_ty; 00031 00032 struct itab_row_ty 00033 { 00034 itab_key_ty key; 00035 void *data; 00036 itab_row_ty *overflow; 00037 }; 00038 00039 struct itab_ty 00040 { 00041 void (*reap)(void *); 00042 itab_row_ty **hash_table; 00043 itab_key_ty hash_modulus; 00044 itab_key_ty hash_mask; 00045 itab_key_ty load; 00046 }; 00047 00048 itab_ty *itab_alloc(void); 00049 void itab_free(itab_ty *); 00050 void *itab_query(itab_ty *, itab_key_ty); 00051 void itab_assign(itab_ty *, itab_key_ty, void *); 00052 void itab_delete(itab_ty *, itab_key_ty); 00053 void itab_walk(itab_ty *, void (*)(itab_ty *, itab_key_ty, void *, void *), 00054 void *); 00055 00057 #endif // COMMON_ITAB_H