]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/libcdl/package.cxx
RedBoot Release TX53-v3 2012-02-08
[karo-tx-redboot.git] / tools / src / libcdl / package.cxx
1 //{{{  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         // Start with the UserVisible data, which will result in a suitable set
479         // of comments before the package definition itself.
480         this->CdlUserVisibleBody::save(interp, chan, indentation, minimal);
481
482         // Now output the line "cdl_package <name> {"
483         // The name is guaranteed to be a valid C preprocessor symbol, so it
484         // is not going to need any quoting.
485         std::string data = std::string(indentation, ' ') + "cdl_package " + get_name() + " {\n";
486         std::string indent_string = std::string(indentation + 4, ' ');
487
488         // The value associated with a package cannot be changed simply
489         // by editing the savefile. Add a comment to that effect.
490         if (!minimal) {
491             data += indent_string + "# Packages cannot be added or removed, nor can their version be changed,\n";
492             data += indent_string + "# simply by editing their value. Instead the appropriate configuration\n";
493             data += indent_string + "# should be used to perform these actions.\n\n";
494         }
495
496         // Output the command and the comment.
497         interp->write_data(chan, data);
498
499         // Deal with the value
500         this->CdlValuableBody::_save(interp, chan, indentation + 4, false, minimal);
501
502         // And with any unrecognised data
503         this->CdlNodeBody::save(interp, chan, indentation + 4, minimal);
504
505         // Close the cdl_package body. A blank line is added here.
506         data = "};\n\n";
507
508         interp->write_data(chan, data);
509     }
510
511     // Packages are containers, so dump the contents as well.
512     this->CdlContainerBody::save(interp, chan, indentation, minimal);
513
514     CYG_REPORT_RETURN();
515 }
516
517 int
518 CdlPackageBody::savefile_package_command(CdlInterpreter interp, int argc, const char* argv[])
519 {
520     CYG_REPORT_FUNCNAMETYPE("CdlPackage::savefile_package_command", "result %d");
521     CYG_PRECONDITION_CLASSC(interp);
522
523     int result = TCL_OK;
524     CdlToplevel toplevel = interp->get_toplevel();
525     CYG_ASSERT_CLASSC(toplevel);
526     CdlConfiguration config = dynamic_cast<CdlConfiguration>(toplevel);
527     CYG_ASSERT_CLASSC(config);
528
529     std::vector<CdlInterpreterCommandEntry> subcommands;
530     std::vector<CdlInterpreterCommandEntry>* toplevel_commands = 0;
531     CdlNode old_node = 0;
532
533     try {
534         if (3 != argc) {
535             CdlParse::report_error(interp, "", "Invalid cdl_package command in savefile, expecting two arguments.");
536         } else {
537             CdlNode current_node = config->lookup(argv[1]);
538             if (0 == current_node) {
539                 CdlParse::report_error(interp, "",
540                                        std::string("The savefile contains a cdl_package command for `") +
541                                        argv[1] + "' which has not been loaded.");
542             } else {
543                 config->get_savefile_subcommands("cdl_package", subcommands);
544                 toplevel_commands = interp->push_commands(subcommands);
545                 old_node = interp->push_node(current_node);
546
547                 std::string tcl_result;
548                 result = interp->eval(argv[2], tcl_result);
549
550                 interp->pop_commands(toplevel_commands);
551                 toplevel_commands = 0;
552                 interp->pop_node(old_node);
553                 old_node = 0;
554             }
555         }
556     } catch(...) {
557         if (0 != old_node) {
558             interp->pop_node(old_node);
559         }
560         if (0 != toplevel_commands) {
561             interp->pop_commands(toplevel_commands);
562         }
563         throw;
564     }
565
566     CYG_REPORT_RETVAL(result);
567     return result;
568 }
569
570 //}}}
571 //{{{  check_this()
572
573 // ----------------------------------------------------------------------------
574
575 bool
576 CdlPackageBody::check_this(cyg_assert_class_zeal zeal) const
577 {
578     if (CdlPackageBody_Magic != cdlpackagebody_cookie) {
579         return false;
580     }
581     CYGDBG_MEMLEAK_CHECKTHIS();
582
583     return CdlNodeBody::check_this(zeal)                &&
584            CdlContainerBody::check_this(zeal)           &&
585            CdlLoadableBody::check_this(zeal)            &&
586            CdlUserVisibleBody::check_this(zeal)         &&
587            CdlValuableBody::check_this(zeal)            &&
588            CdlParentableBody::check_this(zeal)          &&
589            CdlBuildableBody::check_this(zeal)           &&
590            CdlBuildLoadableBody::check_this(zeal)       &&
591            CdlDefinableBody::check_this(zeal)           &&
592            CdlDefineLoadableBody::check_this(zeal);
593 }
594
595 //}}}
596 //{{{  Misc
597
598 // ----------------------------------------------------------------------------
599
600 std::string
601 CdlPackageBody::get_class_name() const
602 {
603     CYG_REPORT_FUNCNAME("CdlPackage::get_class_name");
604     CYG_PRECONDITION_THISC();
605     CYG_REPORT_RETURN();
606     return "package";
607 }
608
609 // BLV: there is an argument for forcing hardware packages to
610 // send their configuration data to a single header file
611 // <pkgconf/hardware.h>, so that any code can #include a
612 // single file to get hold of the hardware details. This
613 // is suppressed for now while the details are sorted out.
614
615 std::string
616 CdlPackageBody::get_config_header() const
617 {
618     CYG_REPORT_FUNCNAME("CdlPackage::get_config_header");
619     CYG_REPORT_FUNCARG1XV(this);
620     CYG_PRECONDITION_CLASSC(this);
621
622     std::string result = "";
623 #if 0
624     if (has_property(CdlPropertyId_Hardware)) {
625         result = "hardware.h";
626     } else {
627         result = CdlDefineLoadableBody::get_config_header();
628     }
629 #else
630     result = CdlDefineLoadableBody::get_config_header();
631 #endif
632
633     CYG_REPORT_RETURN();
634     return result;
635 }
636
637 bool
638 CdlPackageBody::belongs_to_template() const
639 {
640     CYG_REPORT_FUNCNAMETYPE("CdlPackage::belongs_to_template", "result %d");
641     CYG_REPORT_FUNCARG1XV(this);
642     CYG_PRECONDITION_THISC();
643
644     bool result = loaded_for_template;
645
646     CYG_REPORT_RETVAL(result);
647     return result;
648 }
649
650 bool
651 CdlPackageBody::belongs_to_hardware() const
652 {
653     CYG_REPORT_FUNCNAMETYPE("CdlPackage::belongs_to_hardware", "result %d");
654     CYG_REPORT_FUNCARG1XV(this);
655     CYG_PRECONDITION_THISC();
656
657     bool result = loaded_for_hardware;
658
659     CYG_REPORT_RETVAL(result);
660     return result;
661 }
662
663 //}}}