opkg: 's/itsy/opkg/'
[oweals/opkg-lede.git] / libopkg / pkg_vec.h
1 /* pkg_vec.h - the opkg package management system
2
3    Steven M. Ayer
4    
5    Copyright (C) 2002 Compaq Computer Corporation
6
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2, or (at
10    your option) any later version.
11
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16 */
17
18 #ifndef PKG_VEC_H
19 #define PKG_VEC_H
20
21 typedef struct pkg pkg_t;
22 typedef struct abstract_pkg abstract_pkg_t;
23 typedef struct pkg_vec pkg_vec_t;
24 typedef struct abstract_pkg_vec abstract_pkg_vec_t;
25
26 #include "opkg_conf.h"
27
28 struct pkg_vec
29 {
30     pkg_t **pkgs;
31     int len;
32 };
33
34 struct abstract_pkg_vec
35 {
36     abstract_pkg_t **pkgs;
37     int len;
38 };
39
40
41 pkg_vec_t * pkg_vec_alloc(void);
42 void pkg_vec_free(pkg_vec_t *vec);
43 void marry_two_packages(pkg_t * newpkg, pkg_t * oldpkg);
44
45 void pkg_vec_add(pkg_vec_t *vec, pkg_t *pkg);
46 /* pkg_vec_insert_merge: might munge pkg.
47 *  returns the pkg that is in the pkg graph */
48 pkg_t *pkg_vec_insert_merge(pkg_vec_t *vec, pkg_t *pkg, int set_status, opkg_conf_t *conf);
49 /* this one never munges pkg */
50 void pkg_vec_insert(pkg_vec_t *vec, const pkg_t *pkg);
51 int pkg_vec_contains(pkg_vec_t *vec, pkg_t *apkg);
52
53 typedef int (*compare_fcn_t)(const void *, const void *);
54 void pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar);
55
56 int pkg_vec_clear_marks(pkg_vec_t *vec);
57 int pkg_vec_mark_if_matches(pkg_vec_t *vec, const char *pattern);
58
59 abstract_pkg_vec_t * abstract_pkg_vec_alloc(void);
60 void abstract_pkg_vec_free(abstract_pkg_vec_t *vec);
61 void abstract_pkg_vec_insert(abstract_pkg_vec_t *vec, abstract_pkg_t *pkg);
62 abstract_pkg_t * abstract_pkg_vec_get(abstract_pkg_vec_t *vec, int i);
63 int abstract_pkg_vec_contains(abstract_pkg_vec_t *vec, abstract_pkg_t *apkg);
64 void abstract_pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar);
65 #endif
66