OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [tools/] [src/] [libcdl/] [package.cxx] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
//{{{  Banner                           
2
 
3
//============================================================================
4
//
5
//     package.cxx
6
//
7
//     Implementation of the CdlPackage class
8
//
9
//============================================================================
10
//####COPYRIGHTBEGIN####
11
//                                                                          
12
// ----------------------------------------------------------------------------
13
// Copyright (C) 2002 Bart Veer
14
// Copyright (C) 1999, 2000 Red Hat, Inc.
15
//
16
// This file is part of the eCos host tools.
17
//
18
// This program is free software; you can redistribute it and/or modify it 
19
// under the terms of the GNU General Public License as published by the Free 
20
// Software Foundation; either version 2 of the License, or (at your option) 
21
// any later version.
22
// 
23
// This program is distributed in the hope that it will be useful, but WITHOUT 
24
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
25
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
26
// more details.
27
// 
28
// You should have received a copy of the GNU General Public License along with
29
// this program; if not, write to the Free Software Foundation, Inc., 
30
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
31
//
32
// ----------------------------------------------------------------------------
33
//                                                                          
34
//####COPYRIGHTEND####
35
//============================================================================
36
//#####DESCRIPTIONBEGIN####
37
//
38
// Author(s):   bartv
39
// Contact(s):  bartv
40
// Date:        1999/03/01
41
// Version:     0.02
42
//
43
//####DESCRIPTIONEND####
44
//============================================================================
45
 
46
//}}}
47
//{{{  #include's                       
48
 
49
// ----------------------------------------------------------------------------
50
#include "cdlconfig.h"
51
 
52
// Get the infrastructure types, assertions, tracing and similar
53
// facilities.
54
#include <cyg/infra/cyg_ass.h>
55
#include <cyg/infra/cyg_trac.h>
56
 
57
// <cdl.hxx> defines everything implemented in this module.
58
// It implicitly supplies <string>, <vector> and <map> because
59
// the class definitions rely on these headers.
60
#include <cdl.hxx>
61
 
62
//}}}
63
 
64
//{{{  Statics                          
65
 
66
// ----------------------------------------------------------------------------
67
CYGDBG_DEFINE_MEMLEAK_COUNTER(CdlPackageBody);
68
 
69
//}}}
70
//{{{  Constructor                      
71
 
72
// ----------------------------------------------------------------------------
73
// Constructor. The real work is actually done in the base classes
74
// and the parser.
75
CdlPackageBody::CdlPackageBody(std::string name_arg, CdlConfiguration toplevel, std::string dir)
76
    : CdlNodeBody(name_arg),
77
      CdlContainerBody(),
78
      CdlUserVisibleBody(),
79
      CdlValuableBody(CdlValueFlavor_BoolData),
80
      CdlParentableBody(),
81
      CdlBuildableBody(),
82
      CdlDefinableBody(),
83
      CdlLoadableBody(toplevel, dir),
84
      CdlBuildLoadableBody(),
85
      CdlDefineLoadableBody()
86
{
87
    CYG_REPORT_FUNCNAME("CdlPackageBody:: constructor");
88
    CYG_REPORT_FUNCARG1XV(this);
89
 
90
    loaded_for_template   = false;
91
    loaded_for_hardware   = false;
92
    cdlpackagebody_cookie = CdlPackageBody_Magic;
93
    CYGDBG_MEMLEAK_CONSTRUCTOR();
94
 
95
    CYG_POSTCONDITION_THISC();
96
    CYG_REPORT_RETURN();
97
}
98
 
99
//}}}
100
//{{{  Destructor                       
101
 
102
// ----------------------------------------------------------------------------
103
// Most of the work is done in the base classes.
104
 
105
CdlPackageBody::~CdlPackageBody()
106
{
107
    CYG_REPORT_FUNCNAME("CdlPackageBody:: destructor");
108
    CYG_REPORT_FUNCARG1XV(this);
109
    CYG_PRECONDITION_THISC();
110
 
111
    loaded_for_template   = false;
112
    loaded_for_hardware   = false;
113
    cdlpackagebody_cookie = CdlPackageBody_Invalid;
114
    CYGDBG_MEMLEAK_DESTRUCTOR();
115
 
116
    CYG_REPORT_RETURN();
117
}
118
 
119
//}}}
120
//{{{  parse_package()                  
121
 
122
// ----------------------------------------------------------------------------
123
// Parsing a package definition. This routine gets invoked directly from the
124
// Tcl interpreter, when the cdl_package command is encountered. The
125
// command takes two arguments, a name and a body of properties, and there
126
// should only be one cdl_package command per package.
127
//
128
// At the point that the cdl_package command is executed the CdlPackage
129
// object should already exist, and in fact it should be the current
130
// interpreter's loadable. Obviously the name should be checked. The
131
// main purpose of the cdl_package command is to fill in some extra
132
// information in the form of properties.
133
//
134
// A package is a buildable, valuable, uservisible, ... object so it
135
// inherits properties from all three. In practice some of the
136
// properties from the base classes are not actually legal, but that
137
// will be caught by the validation code. Additional properties
138
// relevant to a package are: parent, license_proc, install_proc, and
139
// wizard. It is harmless (but unnecessary) to allow components etc.
140
// to be defined inside a package definition.
141
 
142
int
143
CdlPackageBody::parse_package(CdlInterpreter interp, int argc, const char* argv[])
144
{
145
    CYG_REPORT_FUNCNAMETYPE("CdlPackageBody::parse_package", "result %d");
146
    CYG_REPORT_FUNCARG1("argc %d", argc);
147
    CYG_PRECONDITION_CLASSC(interp);
148
 
149
    std::string  diag_argv0      = CdlParse::get_tcl_cmd_name(argv[0]);
150
 
151
    CdlLoadable  loadable       = interp->get_loadable();
152
    CdlPackage   package        = dynamic_cast<CdlPackage>(loadable);
153
    CdlContainer parent         = package->get_parent();
154
    CdlToplevel  toplevel       = interp->get_toplevel();
155
    std::string filename        = interp->get_context();
156
 
157
    CYG_ASSERT_CLASSC(loadable);        // There should always be a loadable during parsing
158
    CYG_ASSERT_CLASSC(package);         // And packages are the only loadable for software CDL
159
    CYG_ASSERT_CLASSC(toplevel);
160
    CYG_ASSERTC(dynamic_cast<CdlToplevel>(parent) == toplevel);    // The package cannot have been reparented yet.
161
    CYG_ASSERTC("" != filename);
162
    CYG_UNUSED_PARAM(CdlContainer, parent);
163
    CYG_UNUSED_PARAM(CdlToplevel, toplevel);
164
 
165
    // There should be no current node, in fact the cdl_package command
166
    // can only exist at the toplevel of the original script courtesy
167
    // of commands being pushed and popped.
168
    CYG_ASSERTC(0 == interp->get_node());
169
 
170
    // Also, the package should be the current container.
171
    CYG_ASSERTC(package == dynamic_cast<CdlPackage>(interp->get_container()));
172
 
173
    // Declare these outside the scope of the try statement, to allow
174
    // goto calls for the error handling.
175
    const std::vector<CdlProperty>& properties = package->get_properties();
176
 
177
    CdlInterpreterBody::NodeSupport interp_node(interp, package);
178
    static CdlInterpreterCommandEntry commands[] =
179
    {
180
        CdlInterpreterCommandEntry("hardware",           &parse_hardware                    ),
181
        CdlInterpreterCommandEntry("license_proc",       &parse_license_proc                ),
182
        CdlInterpreterCommandEntry("install_proc",       &parse_install_proc                ),
183
        CdlInterpreterCommandEntry("cdl_component",      &CdlComponentBody::parse_component ),
184
        CdlInterpreterCommandEntry("cdl_option",         &CdlOptionBody::parse_option       ),
185
        CdlInterpreterCommandEntry("cdl_interface",      &CdlInterfaceBody::parse_interface ),
186
        CdlInterpreterCommandEntry("cdl_dialog",         &CdlDialogBody::parse_dialog       ),
187
        CdlInterpreterCommandEntry("cdl_wizard",         &CdlWizardBody::parse_wizard       ),
188
        CdlInterpreterCommandEntry("",                   0                                  )
189
    };
190
    std::vector<CdlInterpreterCommandEntry>  new_commands;
191
    int i;
192
 
193
    // All parsing errors may result in an exception, under the control of
194
    // application code. This exception must not pass through the Tcl interpreter.
195
    int result = TCL_OK;
196
    try {
197
 
198
        // Currently there are no options. This may change in future.
199
        if (3 != argc) {
200
            CdlParse::report_error(interp, "",
201
                                   std::string("Incorrect number of arguments to `") + diag_argv0 +
202
                                   "'\nExpecting name and properties list.");
203
        } else if (argv[1] != loadable->get_name()) {
204
            CdlParse::report_error(interp, "",
205
                                   std::string("Incorrect package name in CDL script.\n") +
206
                                   "This package is `" + loadable->get_name() + "'\n" +
207
                                   "The CDL script `" + filename + "' defines a package `" + argv[1] + "'.");
208
        } else if (0 != properties.size()) {
209
            CdlParse::report_error(interp, "",
210
                                   std::string("Duplicate cdl_package commands for package `") + argv[1] + "'.");
211
        } else if (!Tcl_CommandComplete(CDL_TCL_CONST_CAST(char*, argv[2]))) {
212
            CdlParse::report_error(interp, "",
213
                                   std::string("Invalid property list for cdl_package `") + argv[1] + "'.");
214
        } else {
215
 
216
            for (i = 0; 0 != commands[i].command; i++) {
217
                new_commands.push_back(commands[i]);
218
            }
219
 
220
            CdlBuildLoadableBody::add_property_parsers(new_commands);
221
            CdlBuildableBody::add_property_parsers(new_commands);
222
            CdlDefineLoadableBody::add_property_parsers(new_commands);
223
            CdlDefinableBody::add_property_parsers(new_commands);
224
            CdlParentableBody::add_property_parsers(new_commands);
225
            CdlValuableBody::add_property_parsers(new_commands);
226
            CdlUserVisibleBody::add_property_parsers(new_commands);
227
            CdlNodeBody::add_property_parsers(new_commands);
228
 
229
            // Now evaluate the body. If an error occurs then typically
230
            // this will be reported via CdlParse::report_error(),
231
            // but any exceptions will have been intercepted and
232
            // turned into a Tcl error.
233
            CdlInterpreterBody::CommandSupport interp_cmds(interp, new_commands);
234
            result = interp->eval(argv[2]);
235
            if (TCL_OK == result) {
236
 
237
                // Even if there were errors, they were not fatal. There may
238
                // now be a number of properties for this package, and some
239
                // validation should take place. Start with the base classes.
240
                package->CdlNodeBody::check_properties(interp);
241
                package->CdlUserVisibleBody::check_properties(interp);
242
                package->CdlValuableBody::check_properties(interp);
243
                package->CdlParentableBody::check_properties(interp);
244
                package->CdlBuildableBody::check_properties(interp);
245
                package->CdlBuildLoadableBody::check_properties(interp);
246
                package->CdlDefinableBody::check_properties(interp);
247
                package->CdlDefineLoadableBody::check_properties(interp);
248
 
249
                // Some of the properties in the base classes are not actually
250
                // appropriate. A package is valuable, but it can only be
251
                // modified by loading and unloading. Many of the value-related
252
                // properties do not make sense.
253
                if (package->count_properties(CdlPropertyId_Flavor) > 0) {
254
                    CdlParse::report_error(interp, "", "A package should not have a `flavor' property.");
255
                }
256
                if (package->count_properties(CdlPropertyId_EntryProc) > 0) {
257
                    CdlParse::report_error(interp, "", "A package should not have an `entry_proc' property.");
258
                }
259
                if (package->count_properties(CdlPropertyId_CheckProc) > 0) {
260
                    CdlParse::report_error(interp, "", "A package should not have a `check_proc' property.");
261
                }
262
                // BLV: this reasoning is faulty, it should be possible to
263
                // control the enabled aspect via an expression. That would
264
                // need option processing for the default_value property.
265
                if (package->count_properties(CdlPropertyId_DefaultValue) > 0) {
266
                    CdlParse::report_error(interp, "", "A package should not have a `default_value' property.");
267
                }
268
                if (package->count_properties(CdlPropertyId_LegalValues) > 0) {
269
                    CdlParse::report_error(interp, "", "A package should not have a `legal_values' property.");
270
                }
271
                if (package->count_properties(CdlPropertyId_Calculated) > 0) {
272
                    CdlParse::report_error(interp, "", "A package should not have a `calculated' property.");
273
                }
274
                if (package->count_properties(CdlPropertyId_Dialog) > 0) {
275
                    CdlParse::report_error(interp, "", "A package should not have a `dialog' property.");
276
                }
277
 
278
                // There should be at most one each of license_proc, install_proc, include_dir,
279
                // export_to, library, makefile, and wizard.
280
                if (package->count_properties(CdlPropertyId_LicenseProc) > 1) {
281
                    CdlParse::report_error(interp, "", "A package should have at most one `license_proc' property.");
282
                }
283
                if (package->count_properties(CdlPropertyId_InstallProc) > 1) {
284
                    CdlParse::report_error(interp, "", "A package should have at most one `install_proc' property.");
285
                }
286
            }
287
        }
288
 
289
    } catch (std::bad_alloc e) {
290
        // Errors at this stage should be reported via Tcl, not via C++
291
        interp->set_result(CdlParse::construct_diagnostic(interp, "internal error", "", "Out of memory"));
292
        result = TCL_ERROR;
293
    } catch (CdlParseException e) {
294
        interp->set_result(e.get_message());
295
        result = TCL_ERROR;
296
    } catch(...) {
297
        interp->set_result(CdlParse::construct_diagnostic(interp, "internal error", "", "Unexpected C++ exception"));
298
        result = TCL_ERROR;
299
    }
300
 
301
    CYG_REPORT_RETVAL(result);
302
    return result;
303
}
304
 
305
//}}}
306
//{{{  Package properties               
307
 
308
// ----------------------------------------------------------------------------
309
// Syntax: hardware
310
int
311
CdlPackageBody::parse_hardware(CdlInterpreter interp, int argc, const char* argv[])
312
{
313
    CYG_REPORT_FUNCNAMETYPE("parse_hardware", "result %d");
314
 
315
    int result = CdlParse::parse_minimal_property(interp, argc, argv, CdlPropertyId_Hardware, 0, 0);
316
 
317
    CYG_REPORT_RETVAL(result);
318
    return result;
319
}
320
 
321
// ----------------------------------------------------------------------------
322
// Syntax: install_proc <tclcode>
323
int
324
CdlPackageBody::parse_install_proc(CdlInterpreter interp, int argc, const char* argv[])
325
{
326
    CYG_REPORT_FUNCNAMETYPE("parse_install_proc", "result %d");
327
 
328
    int result = CdlParse::parse_tclcode_property(interp, argc, argv, CdlPropertyId_InstallProc, 0, 0);
329
 
330
    CYG_REPORT_RETVAL(result);
331
    return result;
332
}
333
 
334
 
335
// ----------------------------------------------------------------------------
336
// Syntax: license_proc <tclcode>
337
 
338
int
339
CdlPackageBody::parse_license_proc(CdlInterpreter interp, int argc, const char* argv[])
340
{
341
    CYG_REPORT_FUNCNAMETYPE("parse_license_proc", "result %d");
342
 
343
    int result = CdlParse::parse_tclcode_property(interp, argc, argv, CdlPropertyId_LicenseProc, 0, 0);
344
 
345
    CYG_REPORT_RETVAL(result);
346
    return result;
347
}
348
 
349
// ----------------------------------------------------------------------------
350
 
351
bool
352
CdlPackageBody::is_hardware_package() const
353
{
354
    CYG_REPORT_FUNCNAMETYPE("CdlPackage::is_hardware_package", "result %d");
355
    CYG_REPORT_FUNCARG1XV(this);
356
    CYG_PRECONDITION_THISC();
357
 
358
    bool result = false;
359
    if (has_property(CdlPropertyId_Hardware)) {
360
        result = true;
361
    }
362
 
363
    CYG_REPORT_RETVAL(result);
364
    return result;
365
}
366
 
367
bool
368
CdlPackageBody::has_install_proc() const
369
{
370
    CYG_REPORT_FUNCNAMETYPE("CdlPackage::has_install_proc", "result 5d");
371
    CYG_REPORT_FUNCARG1XV(this);
372
    CYG_PRECONDITION_THISC();
373
 
374
    bool result = false;
375
    if (has_property(CdlPropertyId_InstallProc)) {
376
        result = true;
377
    }
378
 
379
    CYG_REPORT_RETVAL(result);
380
    return result;
381
}
382
 
383
const cdl_tcl_code&
384
CdlPackageBody::get_install_proc() const
385
{
386
    CYG_REPORT_FUNCNAME("CdlPackage::get_install_proc");
387
    CYG_REPORT_FUNCARG1XV(this);
388
    CYG_PRECONDITION_THISC();
389
 
390
    static cdl_tcl_code null_result = "";
391
    cdl_tcl_code& result = null_result;
392
    CdlProperty prop = get_property(CdlPropertyId_InstallProc);
393
    if (0 != prop) {
394
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(prop);
395
        result = tclprop->get_code();
396
    }
397
 
398
    CYG_REPORT_RETURN();
399
    return result;
400
}
401
 
402
bool
403
CdlPackageBody::has_license_proc() const
404
{
405
    CYG_REPORT_FUNCNAMETYPE("CdlPackage::has_install_proc", "result 5d");
406
    CYG_REPORT_FUNCARG1XV(this);
407
    CYG_PRECONDITION_THISC();
408
 
409
    bool result = false;
410
    if (has_property(CdlPropertyId_LicenseProc)) {
411
        result = true;
412
    }
413
 
414
    CYG_REPORT_RETVAL(result);
415
    return result;
416
}
417
 
418
const cdl_tcl_code&
419
CdlPackageBody::get_license_proc() const
420
{
421
    CYG_REPORT_FUNCNAME("CdlPackage::get_install_proc");
422
    CYG_REPORT_FUNCARG1XV(this);
423
    CYG_PRECONDITION_THISC();
424
 
425
    static cdl_tcl_code null_result = "";
426
    cdl_tcl_code& result = null_result;
427
    CdlProperty prop = get_property(CdlPropertyId_LicenseProc);
428
    if (0 != prop) {
429
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(prop);
430
        result = tclprop->get_code();
431
    }
432
 
433
    CYG_REPORT_RETURN();
434
    return result;
435
}
436
 
437
//}}}
438
//{{{  Propagation support              
439
 
440
// ----------------------------------------------------------------------------
441
void
442
CdlPackageBody::update(CdlTransaction transaction, CdlUpdate update)
443
{
444
    CYG_REPORT_FUNCNAME("CdlPackage::update");
445
 
446
    this->CdlValuableBody::update(transaction, update);
447
    this->CdlContainerBody::update(transaction, update);
448
 
449
    CYG_REPORT_RETURN();
450
}
451
 
452
//}}}
453
//{{{  Persistence support              
454
 
455
// ----------------------------------------------------------------------------
456
 
457
void
458
CdlPackageBody::initialize_savefile_support(CdlToplevel toplevel)
459
{
460
    CYG_REPORT_FUNCNAME("CdlPackage::initialize_savefile_support");
461
 
462
    toplevel->add_savefile_command("cdl_package", 0, &savefile_package_command);
463
    CdlValuableBody::initialize_savefile_support(toplevel, "cdl_package");
464
}
465
 
466
void
467
CdlPackageBody::save(CdlInterpreter interp, Tcl_Channel chan, int indentation, bool minimal)
468
{
469
    CYG_REPORT_FUNCNAME("CdlPackage::save");
470
    CYG_REPORT_FUNCARG5XV(this, interp, chan, indentation, minimal);
471
    CYG_PRECONDITION_THISC();
472
    CYG_PRECONDITION_CLASSC(interp);
473
 
474
    // For a minimal save there is sufficient data in the savefile header
475
    // to allow the package to be loaded. It is still necessary to output
476
    // a cdl_package command if there were additional savefile strings.
477
    if (!minimal || this->has_additional_savefile_information()) {
478
 
479
        // Start with the UserVisible data, which will result in a suitable set
480
        // of comments before the package definition itself.
481
        this->CdlUserVisibleBody::save(interp, chan, indentation, minimal);
482
 
483
        // Now output the line "cdl_package <name> {"
484
        // The name is guaranteed to be a valid C preprocessor symbol, so it
485
        // is not going to need any quoting.
486
        std::string data = std::string(indentation, ' ') + "cdl_package " + get_name() + " {\n";
487
        std::string indent_string = std::string(indentation + 4, ' ');
488
 
489
        // The value associated with a package cannot be changed simply
490
        // by editing the savefile. Add a comment to that effect.
491
        if (!minimal) {
492
            data += indent_string + "# Packages cannot be added or removed, nor can their version be changed,\n";
493
            data += indent_string + "# simply by editing their value. Instead the appropriate configuration\n";
494
            data += indent_string + "# should be used to perform these actions.\n\n";
495
        }
496
 
497
        // Output the command and the comment.
498
        interp->write_data(chan, data);
499
 
500
        // Deal with the value
501
        this->CdlValuableBody::save(interp, chan, indentation + 4, false, minimal);
502
 
503
        // And with any unrecognised data
504
        this->CdlNodeBody::save(interp, chan, indentation + 4, minimal);
505
 
506
        // Close the cdl_package body. A blank line is added here.
507
        data = "};\n\n";
508
 
509
        interp->write_data(chan, data);
510
    }
511
 
512
    // Packages are containers, so dump the contents as well.
513
    this->CdlContainerBody::save(interp, chan, indentation, minimal);
514
 
515
    CYG_REPORT_RETURN();
516
}
517
 
518
int
519
CdlPackageBody::savefile_package_command(CdlInterpreter interp, int argc, const char* argv[])
520
{
521
    CYG_REPORT_FUNCNAMETYPE("CdlPackage::savefile_package_command", "result %d");
522
    CYG_PRECONDITION_CLASSC(interp);
523
 
524
    int result = TCL_OK;
525
    CdlToplevel toplevel = interp->get_toplevel();
526
    CYG_ASSERT_CLASSC(toplevel);
527
    CdlConfiguration config = dynamic_cast<CdlConfiguration>(toplevel);
528
    CYG_ASSERT_CLASSC(config);
529
 
530
    std::vector<CdlInterpreterCommandEntry> subcommands;
531
    std::vector<CdlInterpreterCommandEntry>* toplevel_commands = 0;
532
    CdlNode old_node = 0;
533
 
534
    try {
535
 
536
        if (3 != argc) {
537
            CdlParse::report_error(interp, "", "Invalid cdl_package command in savefile, expecting two arguments.");
538
        } else {
539
 
540
            CdlNode current_node = config->lookup(argv[1]);
541
            if (0 == current_node) {
542
                CdlParse::report_error(interp, "",
543
                                       std::string("The savefile contains a cdl_package command for `") +
544
                                       argv[1] + "' which has not been loaded.");
545
            } else {
546
                config->get_savefile_subcommands("cdl_package", subcommands);
547
                toplevel_commands = interp->push_commands(subcommands);
548
                old_node = interp->push_node(current_node);
549
 
550
                std::string tcl_result;
551
                result = interp->eval(argv[2], tcl_result);
552
 
553
                interp->pop_commands(toplevel_commands);
554
                toplevel_commands = 0;
555
                interp->pop_node(old_node);
556
                old_node = 0;
557
            }
558
        }
559
    } catch(...) {
560
        if (0 != old_node) {
561
            interp->pop_node(old_node);
562
        }
563
        if (0 != toplevel_commands) {
564
            interp->pop_commands(toplevel_commands);
565
        }
566
        throw;
567
    }
568
 
569
    CYG_REPORT_RETVAL(result);
570
    return result;
571
}
572
 
573
//}}}
574
//{{{  check_this()                     
575
 
576
// ----------------------------------------------------------------------------
577
 
578
bool
579
CdlPackageBody::check_this(cyg_assert_class_zeal zeal) const
580
{
581
    if (CdlPackageBody_Magic != cdlpackagebody_cookie) {
582
        return false;
583
    }
584
    CYGDBG_MEMLEAK_CHECKTHIS();
585
 
586
    return CdlNodeBody::check_this(zeal)                &&
587
           CdlContainerBody::check_this(zeal)           &&
588
           CdlLoadableBody::check_this(zeal)            &&
589
           CdlUserVisibleBody::check_this(zeal)         &&
590
           CdlValuableBody::check_this(zeal)            &&
591
           CdlParentableBody::check_this(zeal)          &&
592
           CdlBuildableBody::check_this(zeal)           &&
593
           CdlBuildLoadableBody::check_this(zeal)       &&
594
           CdlDefinableBody::check_this(zeal)           &&
595
           CdlDefineLoadableBody::check_this(zeal);
596
}
597
 
598
//}}}
599
//{{{  Misc                             
600
 
601
// ----------------------------------------------------------------------------
602
 
603
std::string
604
CdlPackageBody::get_class_name() const
605
{
606
    CYG_REPORT_FUNCNAME("CdlPackage::get_class_name");
607
    CYG_PRECONDITION_THISC();
608
    CYG_REPORT_RETURN();
609
    return "package";
610
}
611
 
612
// BLV: there is an argument for forcing hardware packages to
613
// send their configuration data to a single header file
614
// <pkgconf/hardware.h>, so that any code can #include a
615
// single file to get hold of the hardware details. This
616
// is suppressed for now while the details are sorted out.
617
 
618
std::string
619
CdlPackageBody::get_config_header() const
620
{
621
    CYG_REPORT_FUNCNAME("CdlPackage::get_config_header");
622
    CYG_REPORT_FUNCARG1XV(this);
623
    CYG_PRECONDITION_CLASSC(this);
624
 
625
    std::string result = "";
626
#if 0    
627
    if (has_property(CdlPropertyId_Hardware)) {
628
        result = "hardware.h";
629
    } else {
630
        result = CdlDefineLoadableBody::get_config_header();
631
    }
632
#else
633
    result = CdlDefineLoadableBody::get_config_header();
634
#endif  
635
 
636
    CYG_REPORT_RETURN();
637
    return result;
638
}
639
 
640
bool
641
CdlPackageBody::belongs_to_template() const
642
{
643
    CYG_REPORT_FUNCNAMETYPE("CdlPackage::belongs_to_template", "result %d");
644
    CYG_REPORT_FUNCARG1XV(this);
645
    CYG_PRECONDITION_THISC();
646
 
647
    bool result = loaded_for_template;
648
 
649
    CYG_REPORT_RETVAL(result);
650
    return result;
651
}
652
 
653
bool
654
CdlPackageBody::belongs_to_hardware() const
655
{
656
    CYG_REPORT_FUNCNAMETYPE("CdlPackage::belongs_to_hardware", "result %d");
657
    CYG_REPORT_FUNCARG1XV(this);
658
    CYG_PRECONDITION_THISC();
659
 
660
    bool result = loaded_for_hardware;
661
 
662
    CYG_REPORT_RETVAL(result);
663
    return result;
664
}
665
 
666
//}}}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.