Di_packages

## Data Structures

struct | di_packages
| Packages file. More...
struct | di_packages_allocator
| Packages file - Allocator. More...
struct | di_packages_resolve_dependencies_check
struct | di_packages_resolve_dependencies_do_real_list_append_data

## Typedefs

typedef bool | di_packages_resolve_dependencies_check_package(di_packages_resolve_dependencies_check *r, di_package *package, di_package_dependency *d)
typedef di_package_dependency * | di_packages_resolve_dependencies_check_provide(di_package *package, di_package_dependency *best, di_package_dependency *d, void *data)
typedef void | di_packages_resolve_dependencies_do_package(di_package *package, void *data)

## Functions

di_packages * | di_packages_alloc (void)
void | di_packages_free (di_packages *packages)
di_packages_allocator * | di_packages_allocator_alloc (void)
void | di_packages_allocator_free (di_packages_allocator *packages)
void | di_packages_append_package (di_packages *packages, di_package *package, di_packages_allocator *allocator)
di_package * | di_packages_get_package (di_packages *packages, const char *name, size_t n)
di_package * | di_packages_get_package_new (di_packages *packages, di_packages_allocator *allocator, char *name, size_t n)
di_slist * | di_packages_resolve_dependencies (di_packages *packages, di_slist *list, di_packages_allocator *allocator)
di_slist * | di_packages_resolve_dependencies_array (di_packages *packages, di_package **array, di_packages_allocator *allocator)
void | di_packages_resolve_dependencies_mark (di_packages *packages)
di_packages_allocator * | internal_di_packages_allocator_alloc (void)
di_slist * | di_packages_resolve_dependencies_special (di_packages *packages, di_slist *list, di_packages_resolve_dependencies_check *s, di_packages_allocator *allocator)
di_slist * | di_packages_resolve_dependencies_array_special (di_packages *packages, di_package **array, di_packages_resolve_dependencies_check *s, di_packages_allocator *allocator)
void | di_packages_resolve_dependencies_mark_special (di_packages *packages, di_packages_resolve_dependencies_check *s)
void | di_packages_resolve_dependencies_marker (di_packages *packages)
bool | di_packages_resolve_dependencies_recurse (di_packages_resolve_dependencies_check *r, di_package *package, di_package *dependend_package)

## Variables

di_packages_resolve_dependencies_check_package | di_packages_resolve_dependencies_check_real
di_packages_resolve_dependencies_check_package | di_packages_resolve_dependencies_check_non_existant
di_packages_resolve_dependencies_check_package | di_packages_resolve_dependencies_check_non_existant_quiet
di_packages_resolve_dependencies_check_package | di_packages_resolve_dependencies_check_non_existant_permissive
di_packages_resolve_dependencies_check_provide | di_packages_resolve_dependencies_check_virtual
di_packages_resolve_dependencies_do_package | di_packages_resolve_dependencies_do_real_list_append
di_packages_resolve_dependencies_do_package | di_packages_resolve_dependencies_do_real_mark

## Detailed Description

## Function Documentation

## di_packages_alloc()

di_packages* di_packages_alloc | ( | void |  | ) |

Allocate di_packages

{
di_packages *ret;
ret = di_new0 (di_packages, 1);
ret->table = di_hash_table_new_full (di_rstring_hash, di_rstring_equal, NULL, internal_di_package_destroy_func);
return ret;
}
di_hash_table_new_full
di_hash_table * di_hash_table_new_full(di_hash_func hash_func, di_equal_func key_equal_func, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func)
Definition: hash.c:113
di_new0
#define di_new0(struct_type, n_structs)
Definition: mem.h:79
internal_di_package_destroy_func
di_destroy_notify internal_di_package_destroy_func
Definition: package_internal.h:80
di_packages
Packages file.
Definition: packages.h:42
di_packages::table
di_hash_table * table
Definition: packages.h:43

References di_hash_table_new_full(), di_new0, and table.

## di_packages_allocator_alloc()

di_packages_allocator* di_packages_allocator_alloc | ( | void |  | ) |

Allocate di_packages_allocator

{
di_packages_allocator *ret;
ret = internal_di_packages_allocator_alloc ();
ret->package_mem_chunk = di_mem_chunk_new (sizeof (di_package), 16384);
return ret;
}
di_mem_chunk_new
di_mem_chunk * di_mem_chunk_new(di_ksize_t atom_size, di_ksize_t area_size)
Definition: mem_chunk.c:87
internal_di_packages_allocator_alloc
di_packages_allocator * internal_di_packages_allocator_alloc(void)
Definition: packages.c:62
di_package
Package.
Definition: package.h:96
di_packages_allocator
Packages file - Allocator.
Definition: packages.h:53
di_packages_allocator::package_mem_chunk
di_mem_chunk * package_mem_chunk
Definition: packages.h:54

References di_mem_chunk_new(), internal_di_packages_allocator_alloc(), and di_packages_allocator::package_mem_chunk.

## di_packages_allocator_free()

void di_packages_allocator_free | ( | di_packages_allocator * | allocator | ) |

Free di_packages_allocator

{
di_mem_chunk_destroy (allocator->package_mem_chunk);
di_mem_chunk_destroy (allocator->package_dependency_mem_chunk);
di_mem_chunk_destroy (allocator->slist_node_mem_chunk);
di_free (allocator);
}
di_free
void di_free(void *mem)
Definition: mem.c:60
di_packages_allocator::slist_node_mem_chunk
di_mem_chunk * slist_node_mem_chunk
Definition: packages.h:56
di_packages_allocator::package_dependency_mem_chunk
di_mem_chunk * package_dependency_mem_chunk
Definition: packages.h:55

## di_packages_append_package()

void di_packages_append_package | ( | di_packages * | packages,
|  | di_package * | package,
|  | di_packages_allocator * | allocator
| ) |  |

append a package.

Parameters

  packages | a di_packages

{
di_package *tmp;
tmp = di_packages_get_package (packages, package->package, 0);
if (!tmp)
di_slist_append_chunk (&packages->list, package, allocator->slist_node_mem_chunk);
di_hash_table_insert (packages->table, &package->key, package);
}
di_hash_table_insert
void di_hash_table_insert(di_hash_table *hash_table, void *key, void *value)
Definition: hash.c:178
di_packages_get_package
di_package * di_packages_get_package(di_packages *packages, const char *name, size_t n)
Definition: packages.c:121
di_slist_append_chunk
void di_slist_append_chunk(di_slist *slist, void *data, di_mem_chunk *mem_chunk) __attribute__((nonnull(1
di_package::key
di_rstring key
Definition: package.h:100
di_package::package
char * package
Definition: package.h:99
di_packages::list
di_slist list
Definition: packages.h:44

References di_hash_table_insert(), di_packages_get_package(), di_slist_append_chunk(), di_package::key, list, di_package::package, di_packages_allocator::slist_node_mem_chunk, and table.

## di_packages_free()

void di_packages_free | ( | di_packages * | packages | ) |

Free di_packages

{
if (!packages)
return;
di_hash_table_destroy (packages->table);
di_free (packages);
}
di_hash_table_destroy
void di_hash_table_destroy(di_hash_table *hash_table)
Definition: hash.c:134

References di_free(), di_hash_table_destroy(), and table.

## di_packages_get_package()

di_package* di_packages_get_package | ( | di_packages * | packages,
|  | const char * | name,
|  | size_t | n
| ) |  |

get a named package.

Parameters

  packages | a di_packages
  name | the name of the package
  n | size of the name or 0

Returns
  the package or NULL

{
di_rstring key;
size_t size;
if (n)
size = n;
else
size = strlen (name);
/* i know that is bad, but i know it is not written by the lookup */
key.string = (char *) name;
key.size = size;
return di_hash_table_lookup (packages->table, &key);
}
di_hash_table_lookup
void * di_hash_table_lookup(di_hash_table *hash_table, const void *key)
Definition: hash.c:169
di_rstring
raw string
Definition: string.h:38
di_rstring::size
di_ksize_t size
Definition: string.h:40
di_rstring::string
char * string
Definition: string.h:39

References di_hash_table_lookup(), di_rstring::size, di_rstring::string, and table.

Referenced by di_packages_append_package(), and di_packages_get_package_new().

## di_packages_get_package_new()

di_package* di_packages_get_package_new | ( | di_packages * | packages,
|  | di_packages_allocator * | allocator,
|  | char * | name,
|  | size_t | n
| ) |  |

get a named package. creates a new one if non-existant.

Parameters

  packages | a di_packages
  name | the name of the package
  n | size of the name

Returns
  the package

{
di_package *ret = di_packages_get_package (packages, name, n);
if (!ret)
{
ret = di_package_alloc (allocator);
ret->key.string = di_stradup (name, n);
ret->key.size = n;
di_hash_table_insert (packages->table, &ret->key, ret);
}
return ret;
}
di_stradup
char * di_stradup(const char *s, size_t n)
Definition: string.c:45

References di_packages_get_package().

## internal_di_packages_allocator_alloc()

di_packages_allocator* internal_di_packages_allocator_alloc | ( | void |  | ) |

Partially allocate di_packages_allocator

{
di_packages_allocator *ret;
ret = di_new0 (di_packages_allocator, 1);
ret->package_dependency_mem_chunk = di_mem_chunk_new (sizeof (di_package_dependency), 4096);
ret->slist_node_mem_chunk = di_mem_chunk_new (sizeof (di_slist_node), 4096);
return ret;
}
di_package_dependency
Package dependency.
Definition: package.h:142
di_slist_node
Node of a single-linked list.
Definition: slist.h:46

References di_mem_chunk_new(), di_new0, di_packages_allocator::package_dependency_mem_chunk, and di_packages_allocator::slist_node_mem_chunk.

Referenced by di_packages_allocator_alloc().