packages.h

00001 /*
00002  * packages.h
00003  *
00004  * Copyright (C) 2003 Bastian Blank <waldi@debian.org>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * $Id: packages.h 29603 2005-07-31 16:10:46Z cjwatson $
00021  */
00022 
00023 #ifndef DEBIAN_INSTALLER__PACKAGES_H
00024 #define DEBIAN_INSTALLER__PACKAGES_H
00025 
00026 #include <debian-installer/hash.h>
00027 #include <debian-installer/parser.h>
00028 #include <debian-installer/slist.h>
00029 
00030 #include <stddef.h>
00031 #include <string.h>
00032 
00033 typedef struct di_packages di_packages;
00034 typedef struct di_packages_allocator di_packages_allocator;
00035 
00044 struct di_packages
00045 {
00046   di_hash_table *table;                                 
00047   di_slist list;                                        
00048   unsigned int resolver;                                
00049 };
00050 
00055 struct di_packages_allocator
00056 {
00057   di_mem_chunk *package_mem_chunk;                      
00058   di_mem_chunk *package_dependency_mem_chunk;           
00059   di_mem_chunk *slist_node_mem_chunk;                   
00060 };
00061 
00062 #include <debian-installer/package.h>
00063 
00064 di_packages *di_packages_alloc (void);
00065 void di_packages_free (di_packages *packages);
00066 
00067 di_packages_allocator *di_packages_allocator_alloc (void);
00068 void di_packages_allocator_free (di_packages_allocator *packages);
00069 
00070 void di_packages_append_package (di_packages *packages, di_package *package, di_packages_allocator *allocator);
00071 di_package *di_packages_get_package (di_packages *packages, const char *name, size_t n);
00072 di_package *di_packages_get_package_new (di_packages *packages, di_packages_allocator *allocator, char *name, size_t n);
00073 
00074 di_slist *di_packages_resolve_dependencies (di_packages *packages, di_slist *list, di_packages_allocator *allocator);
00075 di_slist *di_packages_resolve_dependencies_array (di_packages *packages, di_package **array, di_packages_allocator *allocator);
00076 void di_packages_resolve_dependencies_mark (di_packages *packages);
00077 
00080 di_parser_fields_function_read
00081   di_packages_parser_read_name;
00082 
00088 extern const di_parser_fieldinfo *di_packages_parser_fieldinfo[];
00089 extern const di_parser_fieldinfo *di_packages_status_parser_fieldinfo[];
00090 extern const di_parser_fieldinfo *di_packages_minimal_parser_fieldinfo[];
00091 
00092 di_parser_info *di_packages_parser_info (void);
00093 di_parser_info *di_packages_minimal_parser_info (void);
00094 di_parser_info *di_packages_status_parser_info (void);
00095 
00101 di_packages *di_packages_special_read_file (const char *file, di_packages_allocator *allocator, di_parser_info *(info) (void));
00102 
00111 int di_packages_special_write_file (di_packages *packages, const char *file, di_parser_info *(info) (void));
00112 
00119 static inline di_packages *di_packages_read_file (const char *file, di_packages_allocator *allocator)
00120 {
00121   return di_packages_special_read_file (file, allocator, di_packages_parser_info);
00122 }
00123 
00130 static inline di_packages *di_packages_minimal_read_file (const char *file, di_packages_allocator *allocator)
00131 {
00132   return di_packages_special_read_file (file, allocator, di_packages_minimal_parser_info);
00133 }
00134 
00141 static inline di_packages *di_packages_status_read_file (const char *file, di_packages_allocator *allocator)
00142 {
00143   return di_packages_special_read_file (file, allocator, di_packages_status_parser_info);
00144 }
00145 
00154 static inline int di_packages_write_file (di_packages *packages, const char *file)
00155 {
00156   return di_packages_special_write_file (packages, file, di_packages_parser_info);
00157 }
00158 
00167 static inline int di_packages_status_write_file (di_packages *packages, const char *file)
00168 {
00169   return di_packages_special_write_file (packages, file, di_packages_status_parser_info);
00170 }
00171 
00173 #endif

Generated on Sat Sep 29 08:45:16 2007 for libdebian-installer by  doxygen 1.5.1