| 1 |
/*
|
| 2 |
Magpie - reference librarian for Debian systems
|
| 3 |
Copyright (C) 2000 Bear Giles <bgiles@coyotesong.com>
|
| 4 |
|
| 5 |
This program is free software; you may redistribute it and/or
|
| 6 |
modify it under the terms of the GNU General Public License
|
| 7 |
as published by the Free Software Foundation; either version 2
|
| 8 |
of the license, or (at your option) any later version.
|
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful,
|
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
GNU General Public License for more details.
|
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License
|
| 16 |
along with this program; if not, write to the Free Software
|
| 17 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
| 18 |
|
| 19 |
$Id: magpie.h,v 1.1 2003/08/01 00:11:18 djpig-guest Exp $
|
| 20 |
*/
|
| 21 |
#ifndef MAGPIE_H
|
| 22 |
#define MAGPIE_H
|
| 23 |
|
| 24 |
extern const char *sections[];
|
| 25 |
extern const char *categories[];
|
| 26 |
extern const char *priorities[];
|
| 27 |
extern const char *architectures[];
|
| 28 |
|
| 29 |
#define CNT_SECTIONS 11
|
| 30 |
#define CNT_CATEGORIES 37
|
| 31 |
#define CNT_PRIORITIES 5
|
| 32 |
#define CNT_ARCHITECTURES 14
|
| 33 |
|
| 34 |
#define MAX_DESCCNT 300
|
| 35 |
|
| 36 |
/*+
|
| 37 |
This structure describes a list of packages.
|
| 38 |
+*/
|
| 39 |
struct package_list {
|
| 40 |
char *name;
|
| 41 |
char *restriction;
|
| 42 |
struct package_list *next; /* and... */
|
| 43 |
struct package_list *down; /* or... */
|
| 44 |
};
|
| 45 |
|
| 46 |
/*+
|
| 47 |
This structure describes a single package.
|
| 48 |
+*/
|
| 49 |
struct package_info {
|
| 50 |
char *name;
|
| 51 |
char *version;
|
| 52 |
int priority;
|
| 53 |
int section;
|
| 54 |
int category;
|
| 55 |
int essential;
|
| 56 |
char *filename;
|
| 57 |
char *maintainer;
|
| 58 |
char *md5sum;
|
| 59 |
char *summary;
|
| 60 |
int architecture;
|
| 61 |
long size;
|
| 62 |
long installed_size;
|
| 63 |
char *status[3];
|
| 64 |
char *config_version;
|
| 65 |
char *origin;
|
| 66 |
char *bugs;
|
| 67 |
|
| 68 |
int desccnt;
|
| 69 |
char *description[MAX_DESCCNT];
|
| 70 |
|
| 71 |
int cfcnt;
|
| 72 |
char *conffiles[MAX_DESCCNT];
|
| 73 |
|
| 74 |
struct package_list *source;
|
| 75 |
struct package_list *depends;
|
| 76 |
struct package_list *predepends;
|
| 77 |
struct package_list *recommends;
|
| 78 |
struct package_list *suggests;
|
| 79 |
struct package_list *conflicts;
|
| 80 |
struct package_list *replaces;
|
| 81 |
struct package_list *provides;
|
| 82 |
struct package_list *enhances;
|
| 83 |
|
| 84 |
struct package_list *r_depends;
|
| 85 |
struct package_list *r_recommends;
|
| 86 |
struct package_list *r_suggests;
|
| 87 |
|
| 88 |
int installed;
|
| 89 |
int unpacked;
|
| 90 |
|
| 91 |
int dupfile;
|
| 92 |
|
| 93 |
char *installed_version;
|
| 94 |
|
| 95 |
char *tag;
|
| 96 |
int selected;
|
| 97 |
int flag; /* description vs conffiles flag */
|
| 98 |
};
|
| 99 |
|
| 100 |
#define MAGPIE_VERSION ((0 << 16) | (1 << 8) | (0))
|
| 101 |
|
| 102 |
#define MAGPIE_ALL_PACKAGES 0
|
| 103 |
#define MAGPIE_INSTALLED_PACKAGES 1
|
| 104 |
|
| 105 |
/*+
|
| 106 |
This package describes a magpie module.
|
| 107 |
+*/
|
| 108 |
struct magpie_module {
|
| 109 |
int version;
|
| 110 |
int status;
|
| 111 |
const char *description;
|
| 112 |
int (*database) (void);
|
| 113 |
int (*init) (void);
|
| 114 |
int (*cleanup) (void);
|
| 115 |
int (*annotated_index) (FILE *, int);
|
| 116 |
int (*unannotated_index) (FILE *, int);
|
| 117 |
int (*miscellaneous) (FILE *);
|
| 118 |
} magpie_module;
|
| 119 |
|
| 120 |
|
| 121 |
/*+
|
| 122 |
We use a simple array to access the structures allocated by the
|
| 123 |
parser. This allows us to easily sort the contents.
|
| 124 |
+*/
|
| 125 |
extern struct package_info *cache[];
|
| 126 |
extern int cachecnt;
|
| 127 |
|
| 128 |
/*+
|
| 129 |
arrays containing the number of packages in each category. This
|
| 130 |
allows us to avoid creating empty files.
|
| 131 |
+*/
|
| 132 |
extern int matrixcnt_s[CNT_SECTIONS];
|
| 133 |
extern int matrixcnt_sc[CNT_SECTIONS][CNT_CATEGORIES];
|
| 134 |
extern int matrixcnt_scp[CNT_SECTIONS][CNT_CATEGORIES][CNT_PRIORITIES];
|
| 135 |
extern int matrixcnt_sp[CNT_SECTIONS][CNT_PRIORITIES];
|
| 136 |
extern int matrixcnt_p[CNT_PRIORITIES];
|
| 137 |
|
| 138 |
extern struct package_info *mp_lookup (const char *name);
|
| 139 |
|
| 140 |
extern int gzip (const char *);
|
| 141 |
|
| 142 |
|
| 143 |
extern void mp_text (FILE *fp, const char *s);
|
| 144 |
|
| 145 |
extern void mp_doc_open (FILE *fp, const char *fmt,...);
|
| 146 |
extern void mp_doc_close (FILE *fp);
|
| 147 |
|
| 148 |
extern void mp_abstract (FILE *fp, const char *fmt,...);
|
| 149 |
|
| 150 |
extern void mp_name (FILE *fp, const char *name);
|
| 151 |
extern void mp_url (FILE *fp, const char *fmt1, const char *fmt2,...);
|
| 152 |
|
| 153 |
extern void mp_title (FILE *fp, int level, const char *fmt,...);
|
| 154 |
extern void mp_title_open (FILE *fp, int level, const char *fmt,...);
|
| 155 |
extern void mp_title_close (FILE *fp, int level);
|
| 156 |
|
| 157 |
extern void mp_list_open (FILE *fp);
|
| 158 |
extern void mp_list_close (FILE *fp);
|
| 159 |
|
| 160 |
extern void mp_item_open (FILE *fp);
|
| 161 |
extern void mp_item_close (FILE *fp);
|
| 162 |
|
| 163 |
extern void mp_literal_open (FILE *fp);
|
| 164 |
extern void mp_literal_close (FILE *fp);
|
| 165 |
|
| 166 |
extern void mp_nbsp (FILE *fp);
|
| 167 |
extern void mp_break (FILE *fp);
|
| 168 |
|
| 169 |
extern void mp_tt (FILE *fp, const char *str);
|
| 170 |
|
| 171 |
extern void mp_tag (FILE *fp, const char *fmt,...);
|
| 172 |
|
| 173 |
extern void mp_item (FILE *fp, const struct package_list *d);
|
| 174 |
|
| 175 |
extern void mp_package (FILE *fp, struct package_info *p, int mode, int type);
|
| 176 |
|
| 177 |
extern void mp_histogram (FILE *fp, const int data[], int nelms);
|
| 178 |
|
| 179 |
#endif
|