packages.h
/*
* packages.h
*
* Copyright (C) 2003 Bastian Blank <waldi@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEBIAN_INSTALLER__PACKAGES_H
#define DEBIAN_INSTALLER__PACKAGES_H
#include <debian-installer/hash.h>
#include <debian-installer/parser.h>
#include <debian-installer/slist.h>
#include <stddef.h>
#include <string.h>
typedef struct di_packages di_packages;
typedef struct di_packages_allocator di_packages_allocator;
struct di_packages
{
di_hash_table *table;
di_slist list;
unsigned int resolver;
};
struct di_packages_allocator
{
di_mem_chunk *package_mem_chunk;
di_mem_chunk *package_dependency_mem_chunk;
di_mem_chunk *slist_node_mem_chunk;
};
#include <debian-installer/package.h>
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_parser_fields_function_read
di_packages_parser_read_name;
extern const di_parser_fieldinfo *di_packages_parser_fieldinfo[];
extern const di_parser_fieldinfo *di_packages_status_parser_fieldinfo[];
extern const di_parser_fieldinfo *di_packages_minimal_parser_fieldinfo[];
di_parser_info *di_packages_parser_info (void);
di_parser_info *di_packages_minimal_parser_info (void);
di_parser_info *di_packages_status_parser_info (void);
di_packages *di_packages_special_read_file (const char *file, di_packages_allocator *allocator, di_parser_info *(info) (void));
int di_packages_special_write_file (di_packages *packages, const char *file, di_parser_info *(info) (void));
static inline di_packages *di_packages_read_file (const char *file, di_packages_allocator *allocator)
{
return di_packages_special_read_file (file, allocator, di_packages_parser_info);
}
static inline di_packages *di_packages_minimal_read_file (const char *file, di_packages_allocator *allocator)
{
return di_packages_special_read_file (file, allocator, di_packages_minimal_parser_info);
}
static inline di_packages *di_packages_status_read_file (const char *file, di_packages_allocator *allocator)
{
return di_packages_special_read_file (file, allocator, di_packages_status_parser_info);
}
static inline int di_packages_write_file (di_packages *packages, const char *file)
{
return di_packages_special_write_file (packages, file, di_packages_parser_info);
}
static inline int di_packages_status_write_file (di_packages *packages, const char *file)
{
return di_packages_special_write_file (packages, file, di_packages_status_parser_info);
}
#endif
di_packages_special_read_file
di_packages * di_packages_special_read_file(const char *file, di_packages_allocator *allocator, di_parser_info *(info)(void))
di_packages_parser_fieldinfo
const di_parser_fieldinfo * di_packages_parser_fieldinfo[]
Definition packages_parser.c:48
di_packages_minimal_parser_fieldinfo
const di_parser_fieldinfo * di_packages_minimal_parser_fieldinfo[]
Definition packages_parser.c:101
di_packages_minimal_parser_info
di_parser_info * di_packages_minimal_parser_info(void)
Definition packages_parser.c:137
di_packages_write_file
static int di_packages_write_file(di_packages *packages, const char *file)
Definition packages.h:151
di_packages_status_read_file
static di_packages * di_packages_status_read_file(const char *file, di_packages_allocator *allocator)
Definition packages.h:138
di_packages_special_write_file
int di_packages_special_write_file(di_packages *packages, const char *file, di_parser_info *(info)(void))
di_packages_read_file
static di_packages * di_packages_read_file(const char *file, di_packages_allocator *allocator)
Definition packages.h:116
di_packages_minimal_read_file
static di_packages * di_packages_minimal_read_file(const char *file, di_packages_allocator *allocator)
Definition packages.h:127
di_packages_status_parser_fieldinfo
const di_parser_fieldinfo * di_packages_status_parser_fieldinfo[]
Definition packages_parser.c:76
di_packages_parser_info
di_parser_info * di_packages_parser_info(void)
Definition packages_parser.c:123
di_packages_status_parser_info
di_parser_info * di_packages_status_parser_info(void)
Definition packages_parser.c:151
di_packages_status_write_file
static int di_packages_status_write_file(di_packages *packages, const char *file)
Definition packages.h:164
di_packages_get_package
di_package * di_packages_get_package(di_packages *packages, const char *name, size_t n)
Definition packages.c:121
di_packages_allocator_alloc
di_packages_allocator * di_packages_allocator_alloc(void)
Definition packages.c:48
di_packages_free
void di_packages_free(di_packages *packages)
Definition packages.c:76
di_packages_get_package_new
di_package * di_packages_get_package_new(di_packages *packages, di_packages_allocator *allocator, char *name, size_t n)
Definition packages.c:148
di_packages_allocator_free
void di_packages_allocator_free(di_packages_allocator *packages)
Definition packages.c:87
di_packages_append_package
void di_packages_append_package(di_packages *packages, di_package *package, di_packages_allocator *allocator)
Definition packages.c:100
di_packages_alloc
di_packages * di_packages_alloc(void)
Definition packages.c:35
di_parser_fields_function_read
void di_parser_fields_function_read(void **data, const di_parser_fieldinfo *fip, di_rstring *field_modifier, di_rstring *value, void *user_data)
Definition parser.h:49
di_hash_table
Hash table.
Definition hash.c:42
di_mem_chunk
a mem chunk
Definition mem_chunk.c:47
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
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
Packages file.
Definition packages.h:42
di_packages::list
di_slist list
Definition packages.h:44
di_packages::resolver
unsigned int resolver
Definition packages.h:45
di_packages::table
di_hash_table * table
Definition packages.h:43
di_parser_fieldinfo
Info about a parser field.
Definition parser.h:105
di_parser_info
Parse info.
Definition parser.h:94
di_slist
Single-linked list.
Definition slist.h:37