64 #define INITIAL_SET_SIZE 10
180 e = va_arg(args,
void *);
186 e = va_arg(args,
void *);
231 if(
s1 != s2 &&
s1 != s3 ) {
290 bool non_empty_intersection;
292 non_empty_intersection =
false;
300 return non_empty_intersection;
307 if (
s1==s2)
return true;
318 if (
s1==s2)
return true;
351 s = va_arg(args,
set);
374 bool dont_iterate_twice)
396 if (dont_iterate_twice)
499 if (first) first =
false;
static hash_table seen
static function to store whether a module has been seen during the recursive generation of the daVinc...
char * alloc(int size)
ALLOC is an "iron-clad" version of malloc(3).
#define NIL
The empty list (nil in Lisp)
list gen_cons(const void *item, const list next)
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
void gen_free_area(void **p, int size)
free an area.
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
void hash_dont_warn_on_redefinition(void)
hash_equals_t hash_table_equals_function(hash_table h)
Because the hash table data structure is hidden in this source file hash.c and not exported via the n...
bool hash_warn_on_redefinition_p(void)
int hash_table_own_allocated_memory(hash_table htp)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
void hash_warn_on_redefinition(void)
these function set the variable should_i_warn_on_redefinition to the value true or false
hash_table hash_table_generic_make(hash_key_type key_type, size_t size, hash_equals_t private_equal_p, hash_rank_t private_rank)
this function makes a hash table of size size.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
hash_rank_t hash_table_rank_function(hash_table h)
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
void * hash_delget(hash_table htp, const void *key, void **pkey)
deletes key from the hash table.
int hash_table_entry_count(hash_table htp)
now we define observers in order to hide the hash_table type...
void hash_table_clear(hash_table htp)
Clears all entries of a hash table HTP.
#define message_assert(msg, ex)
char * i2a(int)
I2A (Integer TO Ascii) yields a string for a given Integer.
#define HASH_MAP(k, v, code, ht)
hash_key_type
Equality and rank functions are provided for strings, integers, pointers and Newgen chunks.
_uint(* hash_rank_t)(const void *, size_t)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
int(* hash_equals_t)(const void *, const void *)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
set_type
Note: hash_chunk is not included in set_type.
void string_buffer_append(string_buffer, const string)
append string s (if non empty) to string buffer sb, the duplication is done if needed according to th...
string string_buffer_to_string(const string_buffer)
return malloc'ed string from string buffer sb
void string_buffer_to_file(const string_buffer, FILE *)
put string buffer into file.
void string_buffer_free(string_buffer *)
free string buffer structure, also free string contents according to the dup field
string_buffer string_buffer_make(bool dup)
allocate a new string buffer
void string_buffer_cat(string_buffer, const string,...)
append a NULL terminated list of string to sb.
string(* gen_string_func_t)(const void *)
int(* gen_cmp_func_t)(const void *, const void *)
set set_intersection(set s1, const set s2, const set s3)
set set_add_element(set s1, const set s2, const void *e)
list set_to_sorted_list(const set s, gen_cmp_func_t cmp)
set set_generic_make(set_type typ, hash_equals_t private_equal_p, hash_rank_t private_rank)
Create an empty set of any type.
bool set_equal_p(const set s1, const set s2)
returns whether s1 == s2
set set_difference(set s1, const set s2, const set s3)
void gen_set_closure_iterate(void(*iterate)(void *, set), set initial, bool dont_iterate_twice)
string set_to_string(string name, const set s, gen_string_func_t item_name)
return allocated string for set s
bool set_intersection_p(const set s1, const set s2)
returns whether s1 n s2 <> 0 complexity of the intersection
void gen_set_closure(void(*iterate)(void *, set), set initial)
a set-based implementation of gen_closure that does not go twice in the same object.
set set_append_list(set s, const list l)
add list l items to set s, which is returned.
set set_clear(set s)
Assign the empty set to s s := {}.
bool set_belong_p(const set s, const void *e)
static string_buffer set_to_string_buffer(string name, const set s, gen_string_func_t item_name)
convert set s to a string_buffer used internally, but may be exported if needed.
bool set_inclusion_p(const set s1, const set s2)
return whether s1 \included s2
int set_size(const set s)
returns the number of items in s.
set set_delfree_element(set s1, const set s2, const void *e)
May be useful for string sets ...
hash_table set_private_get_hash_table(const set s)
return the internal hash table of set s
list set_to_list(const set s)
create a list from a set the set is not freed
void sets_free(set s,...)
Free several sets in one call.
set set_add_elements(set s1, const set s2, const void *e,...)
void set_fprint(FILE *out, string name, const set s, gen_string_func_t item_name)
print set s to file stream out.
set set_make(set_type typ)
Create an empty set of any type but hash_private.
set set_singleton(set_type type, const void *p)
create a singleton set of any type but hash_private
int set_own_allocated_memory(const set s)
set set_union(set s1, const set s2, const set s3)
set set_del_element(set s1, const set s2, const void *e)
set set_assign(set s1, const set s2)
Assign a set with the content of another set.
bool list_in_set_p(const list l, const set s)
bool set_empty_p(const set s)
tell whether set s is empty.
set set_assign_list(set s, const list l)
assigns a list contents to a set all duplicated elements are lost
set_type set_get_type(const set s)
return the type of set s
internally defined structure.
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.