#ifndef __CDL_HXX
# define __CDL_HXX
-//{{{ Banner
+//{{{ Banner
//============================================================================
//
//
//============================================================================
//####COPYRIGHTBEGIN####
-//
+//
// ----------------------------------------------------------------------------
// Copyright (C) 2002 Bart Veer
// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
//
// This file is part of the eCos host tools.
//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 2 of the License, or (at your option)
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 of the License, or (at your option)
// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
-//
+//
// You should have received a copy of the GNU General Public License along with
-// this program; if not, write to the Free Software Foundation, Inc.,
+// this program; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// ----------------------------------------------------------------------------
-//
+//
//####COPYRIGHTEND####
//============================================================================
//#####DESCRIPTIONBEGIN####
//============================================================================
//}}}
-//{{{ nested #include's
+//{{{ nested #include's
// ----------------------------------------------------------------------------
// Software CDL depends on the core but adds no new system requirements.
//}}}
-//{{{ Forward declarations of the body classes
+//{{{ Forward declarations of the body classes
// ----------------------------------------------------------------------------
// This section provides forward declarations of the main classes used
typedef const CdlPackagesDatabaseBody* CdlConstPackagesDatabase;
//}}}
-//{{{ CdlPackagesDatabase class
+//{{{ CdlPackagesDatabase class
// ----------------------------------------------------------------------------
// An eCos component repository can get to be quite complicated. There will
friend class CdlTest;
friend class CdlDbParser;
-
+
public:
static CdlPackagesDatabase make(std::string = "", CdlDiagnosticFnPtr /* error */ = 0,
- CdlDiagnosticFnPtr /* warn */ = 0);
+ CdlDiagnosticFnPtr /* warn */ = 0);
bool update(void);
~CdlPackagesDatabaseBody();
std::string get_component_repository() const;
-
+
const std::vector<std::string>& get_packages(void) const;
bool is_known_package(std::string) const;
const std::string& get_package_description(std::string) const;
const std::vector<std::string>& get_target_enables(std::string) const;
const std::vector<std::string>& get_target_disables(std::string) const;
const std::vector<std::pair<std::string,std::string> >& get_target_set_values(std::string) const;
-
+
const std::vector<std::string>& get_templates(void) const;
bool is_known_template(std::string) const;
std::string get_template_filename(std::string, std::string = "") const;
const std::string get_template_description(std::string, std::string = "");
const std::vector<std::string>& get_template_packages(std::string, std::string = "");
static void extract_template_details(std::string /* filename */, std::string& /* description */,
- std::vector<std::string>& /* packages */);
-
+ std::vector<std::string>& /* packages */);
+
// What are the valid compiler flag variables (ARCHFLAGS, ERRFLAGS, ...)?
// For now the library provides a static vector of these things, but
// this area is likely to change in future
// Control verbosity when reading in a database
static void set_verbose(bool);
-
+
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
CYGDBG_DECLARE_MEMLEAK_COUNTER();
-
+
private:
// The only valid constructor gets invoked from the make() member function.
// The argument should be a pathname for the component repository. The
std::vector<std::string> package_names;
struct package_data {
public:
- std::string description;
- std::vector<std::string> aliases;
- std::vector<std::string> versions;
- std::string directory;
- std::string script;
- bool hardware;
+ std::string description;
+ std::vector<std::string> aliases;
+ std::vector<std::string> versions;
+ std::string directory;
+ std::string script;
+ bool hardware;
};
std::map<std::string,struct package_data> packages;
-
+
std::vector<std::string> target_names;
struct target_data {
public:
- std::string description;
- std::vector<std::string> aliases;
- std::vector<std::string> packages;
- std::vector<std::string> enable;
- std::vector<std::string> disable;
- std::vector<std::pair<std::string, std::string> > set_values;
+ std::string description;
+ std::vector<std::string> aliases;
+ std::vector<std::string> packages;
+ std::vector<std::string> enable;
+ std::vector<std::string> disable;
+ std::vector<std::pair<std::string, std::string> > set_values;
};
std::map<std::string, struct target_data> targets;
-
+
std::vector<std::string> template_names;
struct template_version_data {
public:
- std::string description;
- std::vector<std::string> packages;
+ std::string description;
+ std::vector<std::string> packages;
};
struct template_data {
public:
- std::vector<std::string> versions;
- std::map<std::string, struct template_version_data> version_details;
+ std::vector<std::string> versions;
+ std::map<std::string, struct template_version_data> version_details;
};
std::map<std::string, struct template_data> templates;
-
+
enum {
- CdlPackagesDatabaseBody_Invalid = 0,
- CdlPackagesDatabaseBody_Magic = 0x50896acb
+ CdlPackagesDatabaseBody_Invalid = 0,
+ CdlPackagesDatabaseBody_Magic = 0x50896acb
} cdlpackagesdatabasebody_cookie;
// This allows test cases to overwrite the name of the file
// containing the database information.
- static char* database_name;
+ static const char *database_name;
// Control whether or not minor problems with the database should be
// reported.
static bool verbose_mode;
-
+
// The default constructor, copy constructor and assignment operator are illegal.
CdlPackagesDatabaseBody();
CdlPackagesDatabaseBody(const CdlPackagesDatabaseBody&);
CdlPackagesDatabaseBody& operator=(const CdlPackagesDatabaseBody&);
-
+
};
//}}}
-//{{{ CdlConfiguration class
+//{{{ CdlConfiguration class
// ----------------------------------------------------------------------------
// The CdlConfiguration class is the toplevel used for mainpulating
friend class CdlTest;
public:
-
+
// ----------------------------------------------------------------------------
// Create a new configuration.
// Currently this requires a name, a database and a master interpreter.
// A version argument of "" implies the most recent version.
void load_package(std::string /* name */, std::string /* version */,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void load_package(CdlTransaction, std::string /* name */, std::string /* version */,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void unload_package(std::string /* name */, bool /* limbo */ = true);
void unload_package(CdlPackage, bool /* limbo */ = true);
void unload_package(CdlTransaction, std::string /* name */, bool /* limbo */ = true);
void unload_package(CdlTransaction, CdlPackage, bool /* limbo */ = true);
-
+
void change_package_version(std::string /*name*/, std::string /*version*/,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void change_package_version(CdlPackage, std::string /*version*/, CdlDiagnosticFnPtr /* error */,
- CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void change_package_version(CdlTransaction, std::string /*name*/, std::string /*version*/,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void change_package_version(CdlTransaction, CdlPackage, std::string /*version*/, CdlDiagnosticFnPtr /* error */,
- CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
// Loading a savefile is different in that it creates a new
// toplevel. Since transactions can only be created if the
// per-transaction load() operation. It is possible to have
// a per-transaction add() operation.
static CdlConfiguration load(std::string /* filename */, CdlPackagesDatabase, CdlInterpreter,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
void add(std::string /* filename */,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
void add(CdlTransaction, std::string /* filename */,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */);
// As with packages, a version of "" implies the most recent.
void set_template(std::string, std::string /* version */,
- CdlDiagnosticFnPtr, CdlDiagnosticFnPtr /* warn */,bool /* limbo */ = true);
+ CdlDiagnosticFnPtr, CdlDiagnosticFnPtr /* warn */,bool /* limbo */ = true);
void set_template_file(std::string,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void set_template(CdlTransaction, std::string, std::string /* version */,
- CdlDiagnosticFnPtr, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void set_template_file(CdlTransaction, std::string,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void unload_template(bool /* limbo */ = true);
void unload_template(CdlTransaction, bool /* limbo */ = true);
std::string get_template() const;
void set_template_name(std::string); // Intended for library use only
void set_hardware(std::string,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void set_hardware(CdlTransaction, std::string,
- CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
+ CdlDiagnosticFnPtr /* error */, CdlDiagnosticFnPtr /* warn */, bool /* limbo */ = true);
void unload_hardware(bool /* limbo */ = true);
void unload_hardware(CdlTransaction, bool /* limbo */ = true);
std::string get_hardware() const;
void set_hardware_name(std::string); // Intended for library use only
-
+
// ----------------------------------------------------------------------------
// Save a configuration to a file
void save(std::string, bool /* minimal */ = false);
virtual std::string get_class_name() const;
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
CYGDBG_DECLARE_MEMLEAK_COUNTER();
-
+
private:
// The only legal constructor, invoked from make() and load()
static int savefile_hardware_command(CdlInterpreter, int, const char*[]);
static int savefile_template_command(CdlInterpreter, int, const char*[]);
static int savefile_package_command(CdlInterpreter, int, const char*[]);
-
+
std::string current_hardware;
std::string current_template;
std::string description;
CdlPackagesDatabase database;
std::string save_file;
enum {
- CdlConfigurationBody_Invalid = 0,
- CdlConfigurationBody_Magic = 0x5c409a3d
+ CdlConfigurationBody_Invalid = 0,
+ CdlConfigurationBody_Magic = 0x5c409a3d
} cdlconfigurationbody_cookie;
// The constructor can only be invoked via the make() and load()
CdlConfigurationBody();
CdlConfigurationBody(const CdlConfigurationBody&);
CdlConfigurationBody& operator=(const CdlConfigurationBody&);
-
+
};
//}}}
-//{{{ CdlPackage class
+//{{{ CdlPackage class
// ----------------------------------------------------------------------------
// Packages inherit from most of the base classes.
class CdlPackageBody : public virtual CdlNodeBody,
- public virtual CdlContainerBody,
- public virtual CdlUserVisibleBody,
- public virtual CdlValuableBody,
- public virtual CdlParentableBody,
- public virtual CdlBuildableBody,
- public virtual CdlDefinableBody,
- public virtual CdlLoadableBody,
- public virtual CdlBuildLoadableBody,
- public virtual CdlDefineLoadableBody
-{
+ public virtual CdlContainerBody,
+ public virtual CdlUserVisibleBody,
+ public virtual CdlValuableBody,
+ public virtual CdlParentableBody,
+ public virtual CdlBuildableBody,
+ public virtual CdlDefinableBody,
+ public virtual CdlLoadableBody,
+ public virtual CdlBuildLoadableBody,
+ public virtual CdlDefineLoadableBody
+{
friend class CdlTest;
// Packages should not be created by application code, but
// the CdlConfiguration class must be able to do so inside
// load_package();
friend class CdlConfigurationBody;
-
+
public:
~CdlPackageBody();
-
+
static int parse_package(CdlInterpreter, int, const char*[]);
static int parse_hardware(CdlInterpreter, int, const char*[]);
static int parse_install_proc(CdlInterpreter, int, const char*[]);
// Override the CdlDefineLoadable member. Hardware packages always
// send their configuration options to hardware.h
virtual std::string get_config_header() const;
-
+
bool is_hardware_package() const;
bool has_install_proc() const;
const cdl_tcl_code& get_install_proc() const;
// it is necessary to invoke the container and valuable
// update members.
virtual void update(CdlTransaction, CdlUpdate);
-
+
// Persistence support.
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
static void initialize_savefile_support(CdlToplevel);
// Was this package loaded because of a template or hardware setting?
bool belongs_to_template() const;
bool belongs_to_hardware() const;
-
+
virtual std::string get_class_name() const;
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
CYGDBG_DECLARE_MEMLEAK_COUNTER();
-
+
private:
// The only valid constructor requires a number of fields
bool loaded_for_template;
bool loaded_for_hardware;
-
+
enum {
- CdlPackageBody_Invalid = 0,
- CdlPackageBody_Magic = 0x1d7c0d43
+ CdlPackageBody_Invalid = 0,
+ CdlPackageBody_Magic = 0x1d7c0d43
} cdlpackagebody_cookie;
};
//}}}
-//{{{ CdlComponent class
+//{{{ CdlComponent class
// ----------------------------------------------------------------------------
// Similarly components just inherit from the appropriate base classes.
class CdlComponentBody : public virtual CdlNodeBody,
- public virtual CdlContainerBody,
- public virtual CdlUserVisibleBody,
- public virtual CdlValuableBody,
- public virtual CdlParentableBody,
- public virtual CdlBuildableBody,
- public virtual CdlDefinableBody
+ public virtual CdlContainerBody,
+ public virtual CdlUserVisibleBody,
+ public virtual CdlValuableBody,
+ public virtual CdlParentableBody,
+ public virtual CdlBuildableBody,
+ public virtual CdlDefinableBody
{
friend class CdlTest;
// it is necessary to invoke the container and valuable
// update members.
virtual void update(CdlTransaction, CdlUpdate);
-
+
// Persistence support.
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
static void initialize_savefile_support(CdlToplevel);
static int savefile_component_command(CdlInterpreter, int, const char*[]);
-
+
virtual std::string get_class_name() const;
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
CYGDBG_DECLARE_MEMLEAK_COUNTER();
-
+
private:
// The only valid constructor requires a name.
CdlComponentBody(std::string);
-
+
enum {
- CdlComponentBody_Invalid = 0,
- CdlComponentBody_Magic = 0x6359d9a7
+ CdlComponentBody_Invalid = 0,
+ CdlComponentBody_Magic = 0x6359d9a7
} cdlcomponentbody_cookie;
-
+
// Other constructors are illegal
CdlComponentBody();
CdlComponentBody(const CdlComponentBody&);
};
//}}}
-//{{{ CdlOption class
+//{{{ CdlOption class
// ----------------------------------------------------------------------------
// Again options just inherit their functionality from the base classes.
class CdlOptionBody : public virtual CdlNodeBody,
- public virtual CdlUserVisibleBody,
- public virtual CdlValuableBody,
- public virtual CdlParentableBody,
- public virtual CdlBuildableBody,
- public virtual CdlDefinableBody
+ public virtual CdlUserVisibleBody,
+ public virtual CdlValuableBody,
+ public virtual CdlParentableBody,
+ public virtual CdlBuildableBody,
+ public virtual CdlDefinableBody
{
friend class CdlTest;
-
+
public:
~CdlOptionBody();
-
+
static int parse_option(CdlInterpreter, int, const char*[]);
-
+
// Persistence support.
virtual void save(CdlInterpreter, Tcl_Channel, int, bool);
static void initialize_savefile_support(CdlToplevel);
static int savefile_option_command(CdlInterpreter, int, const char*[]);
-
+
virtual std::string get_class_name() const;
bool check_this(cyg_assert_class_zeal = cyg_quick) const;
CYGDBG_DECLARE_MEMLEAK_COUNTER();
CdlOptionBody(std::string);
enum {
- CdlOptionBody_Invalid = 0,
- CdlOptionBody_Magic = 0x1c1162d1
+ CdlOptionBody_Invalid = 0,
+ CdlOptionBody_Magic = 0x1c1162d1
} cdloptionbody_cookie;
-
+
CdlOptionBody();
CdlOptionBody(const CdlOptionBody&);
CdlOptionBody& operator=(const CdlOptionBody&);