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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [libcdl/] [package.cxx] - Blame information for rev 831

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

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

powered by: WebSVN 2.1.0

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