1 |
786 |
skrzyp |
#ifndef __CDL_HXX
|
2 |
|
|
# define __CDL_HXX
|
3 |
|
|
//{{{ Banner
|
4 |
|
|
|
5 |
|
|
//============================================================================
|
6 |
|
|
//
|
7 |
|
|
// cdl.hxx
|
8 |
|
|
//
|
9 |
|
|
// This header file declares the classes related to software
|
10 |
|
|
// configuration.
|
11 |
|
|
//
|
12 |
|
|
//============================================================================
|
13 |
|
|
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####
|
14 |
|
|
// -------------------------------------------
|
15 |
|
|
// This file is part of the eCos host tools.
|
16 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
17 |
|
|
//
|
18 |
|
|
// This program is free software; you can redistribute it and/or modify
|
19 |
|
|
// it under the terms of the GNU General Public License as published by
|
20 |
|
|
// the Free Software Foundation; either version 2 or (at your option) any
|
21 |
|
|
// later version.
|
22 |
|
|
//
|
23 |
|
|
// This program is distributed in the hope that it will be useful, but
|
24 |
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
26 |
|
|
// General Public License for more details.
|
27 |
|
|
//
|
28 |
|
|
// You should have received a copy of the GNU General Public License
|
29 |
|
|
// along with this program; if not, write to the
|
30 |
|
|
// Free Software Foundation, Inc., 51 Franklin Street,
|
31 |
|
|
// Fifth Floor, Boston, MA 02110-1301, USA.
|
32 |
|
|
// -------------------------------------------
|
33 |
|
|
// ####ECOSHOSTGPLCOPYRIGHTEND####
|
34 |
|
|
//============================================================================
|
35 |
|
|
//#####DESCRIPTIONBEGIN####
|
36 |
|
|
//
|
37 |
|
|
// Author(s): bartv
|
38 |
|
|
// Contact(s): bartv
|
39 |
|
|
// Date: 1998/02/09
|
40 |
|
|
// Version: 0.02
|
41 |
|
|
// Requires: cdlcore.hxx
|
42 |
|
|
// Usage: #include
|
43 |
|
|
//
|
44 |
|
|
//####DESCRIPTIONEND####
|
45 |
|
|
//============================================================================
|
46 |
|
|
|
47 |
|
|
//}}}
|
48 |
|
|
//{{{ nested #include's
|
49 |
|
|
|
50 |
|
|
// ----------------------------------------------------------------------------
|
51 |
|
|
// Software CDL depends on the core but adds no new system requirements.
|
52 |
|
|
|
53 |
|
|
#ifndef __CDLCORE_HXX
|
54 |
|
|
# include
|
55 |
|
|
#endif
|
56 |
|
|
|
57 |
|
|
//}}}
|
58 |
|
|
|
59 |
|
|
//{{{ Forward declarations of the body classes
|
60 |
|
|
|
61 |
|
|
// ----------------------------------------------------------------------------
|
62 |
|
|
// This section provides forward declarations of the main classes used
|
63 |
|
|
// for software configuration.
|
64 |
|
|
|
65 |
|
|
class CdlConfigurationBody;
|
66 |
|
|
class CdlPackageBody;
|
67 |
|
|
class CdlComponentBody;
|
68 |
|
|
class CdlOptionBody;
|
69 |
|
|
class CdlPackagesDatabaseBody;
|
70 |
|
|
|
71 |
|
|
typedef CdlConfigurationBody* CdlConfiguration;
|
72 |
|
|
typedef CdlPackageBody* CdlPackage;
|
73 |
|
|
typedef CdlComponentBody* CdlComponent;
|
74 |
|
|
typedef CdlOptionBody* CdlOption;
|
75 |
|
|
typedef CdlPackagesDatabaseBody* CdlPackagesDatabase;
|
76 |
|
|
|
77 |
|
|
typedef const CdlConfigurationBody* CdlConstConfiguration;
|
78 |
|
|
typedef const CdlPackageBody* CdlConstPackage;
|
79 |
|
|
typedef const CdlComponentBody* CdlConstComponent;
|
80 |
|
|
typedef const CdlOptionBody* CdlConstOption;
|
81 |
|
|
typedef const CdlPackagesDatabaseBody* CdlConstPackagesDatabase;
|
82 |
|
|
|
83 |
|
|
//}}}
|
84 |
|
|
//{{{ CdlPackagesDatabase class
|
85 |
|
|
|
86 |
|
|
// ----------------------------------------------------------------------------
|
87 |
|
|
// An eCos component repository can get to be quite complicated. There will
|
88 |
|
|
// be a number of core packages supplied by Red Hat. There may also be some
|
89 |
|
|
// number of third party and unsupported packages. Each package may come in
|
90 |
|
|
// several different versions. Keeping track of everything that has been
|
91 |
|
|
// installed should involve a separate administration tool, and there should
|
92 |
|
|
// be some sort of database of all this information.
|
93 |
|
|
//
|
94 |
|
|
// At the time of writing there is no such administration tool and there is
|
95 |
|
|
// no database with details of the various packages. Instead there is a
|
96 |
|
|
// static file "packages" at the top level of the component repository,
|
97 |
|
|
// containing some of the desired information.
|
98 |
|
|
//
|
99 |
|
|
// For now a temporary CdlPackagesDatabase class is provided.
|
100 |
|
|
// Essentially this provides C++ access to the packages file. In the
|
101 |
|
|
// long term this class will be replaced completely by a full and more
|
102 |
|
|
// rational implementation.
|
103 |
|
|
//
|
104 |
|
|
// The packages database class also, temporarily, provides information about
|
105 |
|
|
// targets and templates. This will change in future. A target will be specified
|
106 |
|
|
// by a save file, the output from Hardy. A template will also be specified by
|
107 |
|
|
// a save file, a partial software configuration.
|
108 |
|
|
|
109 |
|
|
class CdlPackagesDatabaseBody {
|
110 |
|
|
|
111 |
|
|
friend class CdlTest;
|
112 |
|
|
friend class CdlDbParser;
|
113 |
|
|
|
114 |
|
|
public:
|
115 |
|
|
|
116 |
|
|
static CdlPackagesDatabase make(std::string = "", CdlDiagnosticFnPtr /* error */ = 0,
|
117 |
|
|
CdlDiagnosticFnPtr /* warn */ = 0);
|
118 |
|
|
bool update(void);
|
119 |
|
|
~CdlPackagesDatabaseBody();
|
120 |
|
|
|
121 |
|
|
std::string get_component_repository() const;
|
122 |
|
|
|
123 |
|
|
const std::vector& get_packages(void) const;
|
124 |
|
|
bool is_known_package(std::string) const;
|
125 |
|
|
const std::string& get_package_description(std::string) const;
|
126 |
|
|
const std::vector& get_package_aliases(std::string) const;
|
127 |
|
|
const std::vector& get_package_versions(std::string) const;
|
128 |
|
|
const std::string& get_package_directory(std::string) const;
|
129 |
|
|
const std::string& get_package_repository(std::string, std::string /* version */ = "") const;
|
130 |
|
|
const std::string& get_package_script(std::string) const;
|
131 |
|
|
bool is_hardware_package(std::string) const;
|
132 |
|
|
|
133 |
|
|
const std::vector& get_targets(void) const;
|
134 |
|
|
bool is_known_target(std::string) const;
|
135 |
|
|
const std::string& get_target_description(std::string) const;
|
136 |
|
|
const std::vector& get_target_aliases(std::string) const;
|
137 |
|
|
const std::vector& get_target_packages(std::string) const;
|
138 |
|
|
const std::vector& get_target_enables(std::string) const;
|
139 |
|
|
const std::vector& get_target_disables(std::string) const;
|
140 |
|
|
const std::vector >& get_target_set_values(std::string) const;
|
141 |
|
|
|
142 |
|
|
const std::vector& get_templates(void) const;
|
143 |
|
|
bool is_known_template(std::string) const;
|
144 |
|
|
std::string get_template_filename(std::string, std::string = "") const;
|
145 |
|
|
const std::vector& get_template_versions(std::string) const;
|
146 |
|
|
const std::string get_template_description(std::string, std::string = "");
|
147 |
|
|
const std::vector& get_template_packages(std::string, std::string = "");
|
148 |
|
|
static void extract_template_details(std::string /* filename */, std::string& /* description */,
|
149 |
|
|
std::vector& /* packages */);
|
150 |
|
|
|
151 |
|
|
// What are the valid compiler flag variables (ARCHFLAGS, ERRFLAGS, ...)?
|
152 |
|
|
// For now the library provides a static vector of these things, but
|
153 |
|
|
// this area is likely to change in future
|
154 |
|
|
static const std::vector& get_valid_cflags();
|
155 |
|
|
|
156 |
|
|
// Control verbosity when reading in a database
|
157 |
|
|
static void set_verbose(bool);
|
158 |
|
|
|
159 |
|
|
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
|
160 |
|
|
CYGDBG_DECLARE_MEMLEAK_COUNTER();
|
161 |
|
|
|
162 |
|
|
private:
|
163 |
|
|
// The only valid constructor gets invoked from the make() member function.
|
164 |
|
|
// The argument should be a pathname for the component repository. The
|
165 |
|
|
// constructor is responsible for reading in the whole packages file.
|
166 |
|
|
CdlPackagesDatabaseBody(std::string, CdlDiagnosticFnPtr, CdlDiagnosticFnPtr);
|
167 |
|
|
|
168 |
|
|
std::string component_repository;
|
169 |
|
|
std::vector package_names;
|
170 |
|
|
struct package_data {
|
171 |
|
|
public:
|
172 |
|
|
std::string description;
|
173 |
|
|
std::vector aliases;
|
174 |
|
|
std::vector versions;
|
175 |
|
|
std::map repositories; /* one entry per version */
|
176 |
|
|
std::string directory;
|
177 |
|
|
std::string script;
|
178 |
|
|
bool hardware;
|
179 |
|
|
};
|
180 |
|
|
std::map packages;
|
181 |
|
|
|
182 |
|
|
std::vector target_names;
|
183 |
|
|
struct target_data {
|
184 |
|
|
public:
|
185 |
|
|
std::string description;
|
186 |
|
|
std::vector aliases;
|
187 |
|
|
std::vector packages;
|
188 |
|
|
std::vector enable;
|
189 |
|
|
std::vector disable;
|
190 |
|
|
std::vector > set_values;
|
191 |
|
|
};
|
192 |
|
|
std::map targets;
|
193 |
|
|
|
194 |
|
|
std::vector template_names;
|
195 |
|
|
struct template_version_data {
|
196 |
|
|
public:
|
197 |
|
|
std::string description;
|
198 |
|
|
std::vector packages;
|
199 |
|
|
};
|
200 |
|
|
struct template_data {
|
201 |
|
|
public:
|
202 |
|
|
std::vector versions;
|
203 |
|
|
std::map files;
|
204 |
|
|
std::map version_details;
|
205 |
|
|
};
|
206 |
|
|
std::map templates;
|
207 |
|
|
|
208 |
|
|
enum {
|
209 |
|
|
CdlPackagesDatabaseBody_Invalid = 0,
|
210 |
|
|
CdlPackagesDatabaseBody_Magic = 0x50896acb
|
211 |
|
|
} cdlpackagesdatabasebody_cookie;
|
212 |
|
|
|
213 |
|
|
// This allows test cases to overwrite the name of the file
|
214 |
|
|
// containing the database information.
|
215 |
|
|
static const char* database_name;
|
216 |
|
|
|
217 |
|
|
// Control whether or not minor problems with the database should be
|
218 |
|
|
// reported.
|
219 |
|
|
static bool verbose_mode;
|
220 |
|
|
|
221 |
|
|
// The default constructor, copy constructor and assignment operator are illegal.
|
222 |
|
|
CdlPackagesDatabaseBody();
|
223 |
|
|
CdlPackagesDatabaseBody(const CdlPackagesDatabaseBody&);
|
224 |
|
|
CdlPackagesDatabaseBody& operator=(const CdlPackagesDatabaseBody&);
|
225 |
|
|
|
226 |
|
|
};
|
227 |
|
|
|
228 |
|
|
//}}}
|
229 |
|
|
//{{{ CdlConfiguration class
|
230 |
|
|
|
231 |
|
|
// ----------------------------------------------------------------------------
|
232 |
|
|
// The CdlConfiguration class is the toplevel used for mainpulating
|
233 |
|
|
// software configurations. It consists of a number of loaded packages,
|
234 |
|
|
// each of which consists of some hierarchy of components and options,
|
235 |
|
|
// plus dialogs, wizards, and interfaces from the core.
|
236 |
|
|
//
|
237 |
|
|
// Typically an application will deal with only one configuration at a
|
238 |
|
|
// time. There will be exceptions. The most obvious example would be
|
239 |
|
|
// some sort of diff utility, but there may well be times when a user
|
240 |
|
|
// wants to edit multiple configurations. One example would be a board
|
241 |
|
|
// containing two separate processors, e.g. a conventional one coupled
|
242 |
|
|
// with a separate DSP, and eCos is supposed to run on both: the two
|
243 |
|
|
// chips will need to interact, and hence there may well be
|
244 |
|
|
// configurability dependencies between them.
|
245 |
|
|
//
|
246 |
|
|
// A configuration object does not exist in isolation. It must be tied
|
247 |
|
|
// to an eCos component repository via a database objects. It must
|
248 |
|
|
// also be supplied with a suitable Tcl interpreter.
|
249 |
|
|
|
250 |
|
|
class CdlConfigurationBody : public virtual CdlToplevelBody
|
251 |
|
|
{
|
252 |
|
|
friend class CdlTest;
|
253 |
|
|
|
254 |
|
|
public:
|
255 |
|
|
|
256 |
|
|
// ----------------------------------------------------------------------------
|
257 |
|
|
// Create a new configuration.
|
258 |
|
|
// Currently this requires a name, a database and a master interpreter.
|
259 |
|
|
// The name is not used very much, but does appear in savefiles.
|
260 |
|
|
// The packages database and the interpreter must be created before
|
261 |
|
|
// any configuration object.
|
262 |
|
|
static CdlConfiguration make(std::string /* name */, CdlPackagesDatabase, CdlInterpreter);
|
263 |
|
|
CdlPackagesDatabase get_database() const;
|
264 |
|
|
|
265 |
|
|
// Loading and unloading packages. This can happen in a number
|
266 |
|
|
// of different ways:
|
267 |
|
|
//
|
268 |
|
|
// 1) explicitly adding or removing a single package
|
269 |
|
|
// 2) changing the version of a package, which means unloading
|
270 |
|
|
// the old version and reloading the new one. Generally
|
271 |
|
|
// user settings should be preserved where possible.
|
272 |
|
|
// 3) loading in a full or minimal savefile. The library
|
273 |
|
|
// does not actually distinguish between the two when
|
274 |
|
|
// loading, only when saving.
|
275 |
|
|
// 4) adding a full or minimal savefile.
|
276 |
|
|
// 5) setting a template for the first time. This is much the
|
277 |
|
|
// same as adding a minimal savefile. However the library
|
278 |
|
|
// keeps track of the "current" template and only one
|
279 |
|
|
// can be loaded at a time. The library does not keep
|
280 |
|
|
// track of which savefile(s) have been added.
|
281 |
|
|
// 6) changing a template. This means unloading the packages
|
282 |
|
|
// that were loaded for the old template, then loading in
|
283 |
|
|
// the new one.
|
284 |
|
|
// 7) unsetting the template. This just involves an unload.
|
285 |
|
|
// 8) setting the hardware. Currently the database defines
|
286 |
|
|
// each supported target, listing the packages that should
|
287 |
|
|
// be loaded and possibly some option details. This is
|
288 |
|
|
// subject to change in future.
|
289 |
|
|
// 9) changing the hardware. This is much the same as changing
|
290 |
|
|
// the template.
|
291 |
|
|
// 10) unsetting the hardware.
|
292 |
|
|
//
|
293 |
|
|
// The unload operations are comparatively safe, although
|
294 |
|
|
// they can result in new conflicts and the user may well want
|
295 |
|
|
// to cancel the operation after discovering how many new
|
296 |
|
|
// problems there would be. The load operations are a bit more
|
297 |
|
|
// dangerous since they depend on external data and hence can
|
298 |
|
|
// fail for a variety of reasons: missing files, corrupt files,
|
299 |
|
|
// clashes with existing data, ... Changing e.g. a template
|
300 |
|
|
// is especially dangerous because of the number of things
|
301 |
|
|
// that can go wrong. All of these operations need to happen
|
302 |
|
|
// in a transaction which the user can cancel. There are two
|
303 |
|
|
// versions of all the relevant routines, one which operates
|
304 |
|
|
// in an existing transaction and one which creates a new
|
305 |
|
|
// one.
|
306 |
|
|
//
|
307 |
|
|
// Any operation that involves loading CDL data takes two
|
308 |
|
|
// CdlDiagnosticFnPtr arguments, one for errors and one for
|
309 |
|
|
// warnings. These should report the message to the user by
|
310 |
|
|
// some suitable means. The error fnptr may throw a
|
311 |
|
|
// CdlParseException to abort the current load immediately,
|
312 |
|
|
// otherwise the load operation will be aborted at the end
|
313 |
|
|
// if any errors were detected. New conflicts are not
|
314 |
|
|
// handled by these diagnostic functions, instead they
|
315 |
|
|
// are handled by the normal transaction methods.
|
316 |
|
|
|
317 |
|
|
// A version argument of "" implies the most recent version.
|
318 |
|
|
void load_package(std::string /* name */, std::string /* version */,
|
319 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
320 |
|
|
void load_package(CdlTransaction, std::string /* name */, std::string /* version */,
|
321 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
322 |
|
|
|
323 |
|
|
void unload_package(std::string /* name */, bool /* limbo */ = true);
|
324 |
|
|
void unload_package(CdlPackage, bool /* limbo */ = true);
|
325 |
|
|
void unload_package(CdlTransaction, std::string /* name */, bool /* limbo */ = true);
|
326 |
|
|
void unload_package(CdlTransaction, CdlPackage, bool /* limbo */ = true);
|
327 |
|
|
|
328 |
|
|
void change_package_version(std::string /*name*/, std::string /*version*/,
|
329 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
330 |
|
|
void change_package_version(CdlPackage, std::string /*version*/, CdlDiagnosticFnPtr /* error */,
|
331 |
|
|
CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
332 |
|
|
|
333 |
|
|
void change_package_version(CdlTransaction, std::string /*name*/, std::string /*version*/,
|
334 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
335 |
|
|
void change_package_version(CdlTransaction, CdlPackage, std::string /*version*/, CdlDiagnosticFnPtr /* error */,
|
336 |
|
|
CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
337 |
|
|
|
338 |
|
|
// Loading a savefile is different in that it creates a new
|
339 |
|
|
// toplevel. Since transactions can only be created if the
|
340 |
|
|
// toplevel already exists, it is not possible to have a
|
341 |
|
|
// per-transaction load() operation. It is possible to have
|
342 |
|
|
// a per-transaction add() operation.
|
343 |
|
|
static CdlConfiguration load(std::string /* filename */, CdlPackagesDatabase, CdlInterpreter,
|
344 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
|
345 |
|
|
|
346 |
|
|
void add(std::string /* filename */,
|
347 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
|
348 |
|
|
void add(CdlTransaction, std::string /* filename */,
|
349 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
|
350 |
|
|
|
351 |
|
|
// As with packages, a version of "" implies the most recent.
|
352 |
|
|
void set_template(std::string, std::string /* version */,
|
353 |
|
|
CdlDiagnosticFnPtr, CdlDiagnosticFnPtr /* warn */,bool /* limbo */ = true);
|
354 |
|
|
void set_template_file(std::string,
|
355 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
356 |
|
|
void set_template(CdlTransaction, std::string, std::string /* version */,
|
357 |
|
|
CdlDiagnosticFnPtr, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
358 |
|
|
void set_template_file(CdlTransaction, std::string,
|
359 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
360 |
|
|
void unload_template(bool /* limbo */ = true);
|
361 |
|
|
void unload_template(CdlTransaction, bool /* limbo */ = true);
|
362 |
|
|
std::string get_template() const;
|
363 |
|
|
void set_template_name(std::string); // Intended for library use only
|
364 |
|
|
|
365 |
|
|
void set_hardware(std::string,
|
366 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
367 |
|
|
void set_hardware(CdlTransaction, std::string,
|
368 |
|
|
CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
|
369 |
|
|
void unload_hardware(bool /* limbo */ = true);
|
370 |
|
|
void unload_hardware(CdlTransaction, bool /* limbo */ = true);
|
371 |
|
|
std::string get_hardware() const;
|
372 |
|
|
void set_hardware_name(std::string); // Intended for library use only
|
373 |
|
|
|
374 |
|
|
// ----------------------------------------------------------------------------
|
375 |
|
|
// Save a configuration to a file
|
376 |
|
|
void save(std::string, bool /* minimal */ = false);
|
377 |
|
|
void initialize_savefile_support();
|
378 |
|
|
std::string get_save_file() const;
|
379 |
|
|
|
380 |
|
|
// ----------------------------------------------------------------------------
|
381 |
|
|
// Get rid of a configuration.
|
382 |
|
|
~CdlConfigurationBody();
|
383 |
|
|
|
384 |
|
|
virtual std::string get_class_name() const;
|
385 |
|
|
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
|
386 |
|
|
CYGDBG_DECLARE_MEMLEAK_COUNTER();
|
387 |
|
|
|
388 |
|
|
private:
|
389 |
|
|
|
390 |
|
|
// The only legal constructor, invoked from make() and load()
|
391 |
|
|
CdlConfigurationBody(std::string, CdlPackagesDatabase, CdlInterpreter);
|
392 |
|
|
|
393 |
|
|
// The internal implementation of the persistence support
|
394 |
|
|
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
|
395 |
|
|
static int savefile_configuration_command(CdlInterpreter, int, const char*[]);
|
396 |
|
|
static int savefile_description_command(CdlInterpreter, int, const char*[]);
|
397 |
|
|
static int savefile_hardware_command(CdlInterpreter, int, const char*[]);
|
398 |
|
|
static int savefile_template_command(CdlInterpreter, int, const char*[]);
|
399 |
|
|
static int savefile_package_command(CdlInterpreter, int, const char*[]);
|
400 |
|
|
|
401 |
|
|
std::string current_hardware;
|
402 |
|
|
std::string current_template;
|
403 |
|
|
std::string description;
|
404 |
|
|
CdlPackagesDatabase database;
|
405 |
|
|
std::string save_file;
|
406 |
|
|
enum {
|
407 |
|
|
CdlConfigurationBody_Invalid = 0,
|
408 |
|
|
CdlConfigurationBody_Magic = 0x5c409a3d
|
409 |
|
|
} cdlconfigurationbody_cookie;
|
410 |
|
|
|
411 |
|
|
// The constructor can only be invoked via the make() and load()
|
412 |
|
|
// members. Other constructors and the assignment operator are
|
413 |
|
|
// illegal.
|
414 |
|
|
CdlConfigurationBody();
|
415 |
|
|
CdlConfigurationBody(const CdlConfigurationBody&);
|
416 |
|
|
CdlConfigurationBody& operator=(const CdlConfigurationBody&);
|
417 |
|
|
|
418 |
|
|
};
|
419 |
|
|
|
420 |
|
|
//}}}
|
421 |
|
|
//{{{ CdlPackage class
|
422 |
|
|
|
423 |
|
|
// ----------------------------------------------------------------------------
|
424 |
|
|
// Packages inherit from most of the base classes.
|
425 |
|
|
|
426 |
|
|
class CdlPackageBody : public virtual CdlNodeBody,
|
427 |
|
|
public virtual CdlContainerBody,
|
428 |
|
|
public virtual CdlUserVisibleBody,
|
429 |
|
|
public virtual CdlValuableBody,
|
430 |
|
|
public virtual CdlParentableBody,
|
431 |
|
|
public virtual CdlBuildableBody,
|
432 |
|
|
public virtual CdlDefinableBody,
|
433 |
|
|
public virtual CdlLoadableBody,
|
434 |
|
|
public virtual CdlBuildLoadableBody,
|
435 |
|
|
public virtual CdlDefineLoadableBody
|
436 |
|
|
{
|
437 |
|
|
friend class CdlTest;
|
438 |
|
|
|
439 |
|
|
// Packages should not be created by application code, but
|
440 |
|
|
// the CdlConfiguration class must be able to do so inside
|
441 |
|
|
// load_package();
|
442 |
|
|
friend class CdlConfigurationBody;
|
443 |
|
|
|
444 |
|
|
public:
|
445 |
|
|
|
446 |
|
|
~CdlPackageBody();
|
447 |
|
|
|
448 |
|
|
static int parse_package(CdlInterpreter, int, const char*[]);
|
449 |
|
|
static int parse_hardware(CdlInterpreter, int, const char*[]);
|
450 |
|
|
static int parse_install_proc(CdlInterpreter, int, const char*[]);
|
451 |
|
|
static int parse_license_proc(CdlInterpreter, int, const char*[]);
|
452 |
|
|
|
453 |
|
|
// Override the CdlDefineLoadable member. Hardware packages always
|
454 |
|
|
// send their configuration options to hardware.h
|
455 |
|
|
virtual std::string get_config_header() const;
|
456 |
|
|
|
457 |
|
|
bool is_hardware_package() const;
|
458 |
|
|
bool has_install_proc() const;
|
459 |
|
|
const cdl_tcl_code& get_install_proc() const;
|
460 |
|
|
bool has_license_proc() const;
|
461 |
|
|
const cdl_tcl_code& get_license_proc() const;
|
462 |
|
|
|
463 |
|
|
// Propagation support. Because of multiple virtual inheritance
|
464 |
|
|
// it is necessary to invoke the container and valuable
|
465 |
|
|
// update members.
|
466 |
|
|
virtual void update(CdlTransaction, CdlUpdate);
|
467 |
|
|
|
468 |
|
|
// Persistence support.
|
469 |
|
|
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
|
470 |
|
|
static void initialize_savefile_support(CdlToplevel);
|
471 |
|
|
static int savefile_package_command(CdlInterpreter, int, const char*[]);
|
472 |
|
|
|
473 |
|
|
// Was this package loaded because of a template or hardware setting?
|
474 |
|
|
bool belongs_to_template() const;
|
475 |
|
|
bool belongs_to_hardware() const;
|
476 |
|
|
|
477 |
|
|
virtual std::string get_class_name() const;
|
478 |
|
|
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
|
479 |
|
|
CYGDBG_DECLARE_MEMLEAK_COUNTER();
|
480 |
|
|
|
481 |
|
|
private:
|
482 |
|
|
|
483 |
|
|
// The only valid constructor requires a number of fields
|
484 |
|
|
CdlPackageBody(std::string /* name */, CdlConfiguration, std::string /* repository */, std::string /* directory */);
|
485 |
|
|
|
486 |
|
|
// Other constructors are illegal
|
487 |
|
|
CdlPackageBody();
|
488 |
|
|
CdlPackageBody(const CdlPackageBody&);
|
489 |
|
|
CdlPackageBody& operator=(const CdlPackageBody&);
|
490 |
|
|
|
491 |
|
|
bool loaded_for_template;
|
492 |
|
|
bool loaded_for_hardware;
|
493 |
|
|
|
494 |
|
|
enum {
|
495 |
|
|
CdlPackageBody_Invalid = 0,
|
496 |
|
|
CdlPackageBody_Magic = 0x1d7c0d43
|
497 |
|
|
} cdlpackagebody_cookie;
|
498 |
|
|
};
|
499 |
|
|
|
500 |
|
|
//}}}
|
501 |
|
|
//{{{ CdlComponent class
|
502 |
|
|
|
503 |
|
|
// ----------------------------------------------------------------------------
|
504 |
|
|
// Similarly components just inherit from the appropriate base classes.
|
505 |
|
|
|
506 |
|
|
class CdlComponentBody : public virtual CdlNodeBody,
|
507 |
|
|
public virtual CdlContainerBody,
|
508 |
|
|
public virtual CdlUserVisibleBody,
|
509 |
|
|
public virtual CdlValuableBody,
|
510 |
|
|
public virtual CdlParentableBody,
|
511 |
|
|
public virtual CdlBuildableBody,
|
512 |
|
|
public virtual CdlDefinableBody
|
513 |
|
|
{
|
514 |
|
|
friend class CdlTest;
|
515 |
|
|
|
516 |
|
|
public:
|
517 |
|
|
|
518 |
|
|
~CdlComponentBody();
|
519 |
|
|
static int parse_component(CdlInterpreter, int, const char*[]);
|
520 |
|
|
static int parse_script(CdlInterpreter, int, const char*[]);
|
521 |
|
|
|
522 |
|
|
// Propagation support. Because of multiple virtual inheritance
|
523 |
|
|
// it is necessary to invoke the container and valuable
|
524 |
|
|
// update members.
|
525 |
|
|
virtual void update(CdlTransaction, CdlUpdate);
|
526 |
|
|
|
527 |
|
|
// Persistence support.
|
528 |
|
|
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
|
529 |
|
|
static void initialize_savefile_support(CdlToplevel);
|
530 |
|
|
static int savefile_component_command(CdlInterpreter, int, const char*[]);
|
531 |
|
|
|
532 |
|
|
virtual std::string get_class_name() const;
|
533 |
|
|
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
|
534 |
|
|
CYGDBG_DECLARE_MEMLEAK_COUNTER();
|
535 |
|
|
|
536 |
|
|
private:
|
537 |
|
|
|
538 |
|
|
// The only valid constructor requires a name.
|
539 |
|
|
CdlComponentBody(std::string);
|
540 |
|
|
|
541 |
|
|
enum {
|
542 |
|
|
CdlComponentBody_Invalid = 0,
|
543 |
|
|
CdlComponentBody_Magic = 0x6359d9a7
|
544 |
|
|
} cdlcomponentbody_cookie;
|
545 |
|
|
|
546 |
|
|
// Other constructors are illegal
|
547 |
|
|
CdlComponentBody();
|
548 |
|
|
CdlComponentBody(const CdlComponentBody&);
|
549 |
|
|
CdlComponentBody& operator=(const CdlComponentBody&);
|
550 |
|
|
};
|
551 |
|
|
|
552 |
|
|
//}}}
|
553 |
|
|
//{{{ CdlOption class
|
554 |
|
|
|
555 |
|
|
// ----------------------------------------------------------------------------
|
556 |
|
|
// Again options just inherit their functionality from the base classes.
|
557 |
|
|
|
558 |
|
|
class CdlOptionBody : public virtual CdlNodeBody,
|
559 |
|
|
public virtual CdlUserVisibleBody,
|
560 |
|
|
public virtual CdlValuableBody,
|
561 |
|
|
public virtual CdlParentableBody,
|
562 |
|
|
public virtual CdlBuildableBody,
|
563 |
|
|
public virtual CdlDefinableBody
|
564 |
|
|
{
|
565 |
|
|
friend class CdlTest;
|
566 |
|
|
|
567 |
|
|
public:
|
568 |
|
|
~CdlOptionBody();
|
569 |
|
|
|
570 |
|
|
static int parse_option(CdlInterpreter, int, const char*[]);
|
571 |
|
|
|
572 |
|
|
// Persistence support.
|
573 |
|
|
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
|
574 |
|
|
static void initialize_savefile_support(CdlToplevel);
|
575 |
|
|
static int savefile_option_command(CdlInterpreter, int, const char*[]);
|
576 |
|
|
|
577 |
|
|
virtual std::string get_class_name() const;
|
578 |
|
|
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
|
579 |
|
|
CYGDBG_DECLARE_MEMLEAK_COUNTER();
|
580 |
|
|
|
581 |
|
|
private:
|
582 |
|
|
CdlOptionBody(std::string);
|
583 |
|
|
|
584 |
|
|
enum {
|
585 |
|
|
CdlOptionBody_Invalid = 0,
|
586 |
|
|
CdlOptionBody_Magic = 0x1c1162d1
|
587 |
|
|
} cdloptionbody_cookie;
|
588 |
|
|
|
589 |
|
|
CdlOptionBody();
|
590 |
|
|
CdlOptionBody(const CdlOptionBody&);
|
591 |
|
|
CdlOptionBody& operator=(const CdlOptionBody&);
|
592 |
|
|
};
|
593 |
|
|
|
594 |
|
|
//}}}
|
595 |
|
|
|
596 |
|
|
#endif /* !__CDL_HXX */
|
597 |
|
|
// EOF cdl.hxx
|