]> cygwin.com Git - cygwin-apps/setup.git/blob - ini.h
2001-11-26 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
[cygwin-apps/setup.git] / ini.h
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16 #ifndef _INI_H_
17 #define _INI_H_
18
19
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 void ini_init (char *string, char *mirror);
25 #define YYSTYPE char *
26
27 #ifdef __cplusplus
28 }
29 #endif
30
31 #ifdef __cplusplus
32 /* For enums */
33 #include "choose.h"
34
35 /* When setup.ini is parsed, the information is stored according to
36 the declarations here. ini.cc (via inilex and iniparse)
37 initializes these structures. choose.cc sets the action and trust
38 fields. download.cc downloads any needed files for selected
39 packages (the chosen "install" field). install.cc installs
40 selected packages. */
41
42 /* the classes here store installation info *shrug* */
43
44 /* lowest number must be most trusted, highest least trusted */
45 typedef enum
46 {
47 TRUST_UNKNOWN,
48 TRUST_PREV,
49 TRUST_CURR,
50 TRUST_TEST,
51 NTRUST
52 }
53 trusts;
54
55 typedef enum
56 {
57 EXCLUDE_NONE = 0,
58 EXCLUDE_BY_SETUP,
59 EXCLUDE_NOT_FOUND
60 }
61 excludes;
62
63 #define is_download_action(pkg) \
64 ((pkg)->action == ACTION_PREV || \
65 (pkg)->action == ACTION_CURR || \
66 (pkg)->action == ACTION_TEST || \
67 (pkg)->action == ACTION_REDO || \
68 (pkg)->action == ACTION_SRC_ONLY)
69
70 #define is_upgrade_action(pkg) \
71 (((pkg)->action >= ACTION_CURR && \
72 (pkg)->action <= ACTION_TEST) || \
73 (pkg)->action == ACTION_REDO)
74
75 #define is_uninstall_action(pkg) \
76 (is_upgrade_action (pkg) || \
77 (pkg)->action == ACTION_PREV || \
78 (pkg)->action == ACTION_UNINSTALL)
79
80 #define is_full_action(pkg) \
81 (((pkg)->action >= ACTION_SAME_PREV && (pkg)->action <= ACTION_SAME_TEST) \
82 || (pkg)->action == ACTION_SKIP)
83
84 #define SRCACTION_NO 0
85 #define SRCACTION_YES 1
86 typedef struct _Info
87 {
88 char *version; /* version part of filename */
89 char *install; /* file name to install */
90 unsigned int install_size; /* in bytes */
91 int install_exists; /* install file exists on disk */
92 int derived; /* True if we "figured out" that this version should
93 go here but it was not in setup.ini */
94 char *source; /* sources for installed binaries */
95 unsigned int source_size; /* in bytes */
96 int source_exists; /* source file exists on disk */
97 _Info ():version (0), install (0), install_size (0), install_exists (0),
98 derived (0), source (0), source_size (0)
99 {
100 };
101 _Info (const char *_install, const char *_version,
102 int _install_size, const char *_source = NULL, int _source_size = 0);
103 }
104
105 Info; /* +1 for TRUST_UNKNOWN */
106
107 #if 0
108 class Package
109 {
110 public:
111 Package ():name (0), sdesc (0), ldesc (0), category (0), required (0),
112 srcpicked (0), installed (0)
113 {
114 };
115 char *name; /* package name, like "cygwin" */
116 char *sdesc; /* short description (replaces "name" if provided) */
117 char *ldesc; /* long description (multi-line) */
118 Category *category; /* the categories the package belongs to */
119 Dependency *required; /* the packages required for this package to work */
120 actions action; /* A range of states applicable to this package */
121 trusts trust; /* Selects among info[] below, a subset of action */
122 int srcpicked; /* True if source is required */
123
124 Info *installed; /* Info on installed package */
125 trusts installed_ix; /* Index into info array for currently installed package */
126 excludes exclude; /* true if this package should be excluded */
127
128 /* The reason for this weird layout is to allow for loops that scan either
129 the info array, based on trust value or the infoscan array based on a pointer,
130 looking for a particular version. */
131 Info info[1]; /* First element. Intentionally allocated prior
132 to infoscan */
133 Info infoscan[NTRUST - 1]; /* +1 for TRUST_UNKNOWN */
134 Info infoend[0]; /* end marker */
135 };
136
137 extern Package *package;
138 extern int npackages;
139
140
141 Package *new_package (char *name);
142 Package *getpkgbyname (const char *pkgname);
143 void new_requirement (Package * package, char *dependson);
144 Category *getpackagecategorybyname (Package * pkg, const char *categoryname);
145 void add_category (Package * package, Category * cat);
146 #endif
147
148
149
150
151 #endif
152
153 #endif /* _INI_H_ */
This page took 0.04353 seconds and 6 git commands to generate.