00001 /*===-- runtime/crt_itable.h ----------------------------------------------=== 00002 * 00003 * This file is distributed under the MIT license. See LICENSE.txt for details. 00004 * 00005 * Copyright (C) 2009, Stephen Wilson 00006 * 00007 *===----------------------------------------------------------------------===*/ 00008 00009 /* 00010 * The following table is used to manage the creation of domain instances. 00011 */ 00012 00013 #ifndef COMMA_RUNTIME_CRT_ITABEL_HDR_GUARD 00014 #define COMMA_RUNTIME_CRT_ITABEL_HDR_GUARD 00015 00016 #include "comma/runtime/crt_types.h" 00017 00018 #include <stdbool.h> 00019 00020 struct itable { 00021 /* 00022 * Number of entries in this table. 00023 */ 00024 unsigned num_entries; 00025 00026 /* 00027 * Exponent on 2 yielding the size of the bucket. 00028 */ 00029 unsigned bucket_size; 00030 00031 /* 00032 * An array of instances with bucket_size elements. 00033 */ 00034 domain_instance_t *bucket; 00035 }; 00036 00037 struct itable *alloc_itable(); 00038 00039 bool itable_lookup(struct itable *htab, 00040 domain_info_t info, 00041 domain_instance_t *key, 00042 domain_instance_t *instance); 00043 00044 #endif