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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [libcdl/] [wizard.cxx] - Blame information for rev 403

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

Line No. Rev Author Line
1 26 unneback
//{{{  Banner                           
2
 
3
//============================================================================
4
//
5
//     wizard.cxx
6
//
7
//     Implementation of the CdlWizard 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.01
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
// <cdlcore.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 <cdlcore.hxx>
61
 
62
//}}}
63
 
64
//{{{  Statics                          
65
 
66
// ----------------------------------------------------------------------------
67
CYGDBG_DEFINE_MEMLEAK_COUNTER(CdlWizardBody);
68
 
69
//}}}
70
//{{{  Constructor                      
71
 
72
// ----------------------------------------------------------------------------
73
// Constructor. The real work is actually done in the parse routine.
74
CdlWizardBody::CdlWizardBody(std::string name_arg)
75
    : CdlNodeBody(name_arg),
76
      CdlParentableBody(),
77
      CdlUserVisibleBody()
78
{
79
    CYG_REPORT_FUNCNAME("CdlWizardBody:: constructor");
80
    CYG_REPORT_FUNCARG1XV(this);
81
 
82
    cdlwizardbody_cookie = CdlWizardBody_Magic;
83
    CYGDBG_MEMLEAK_CONSTRUCTOR();
84
 
85
    CYG_POSTCONDITION_THISC();
86
    CYG_REPORT_RETURN();
87
}
88
 
89
//}}}
90
//{{{  Destructor                       
91
 
92
// ----------------------------------------------------------------------------
93
// The real work is done in the base classes.
94
CdlWizardBody::~CdlWizardBody()
95
{
96
    CYG_REPORT_FUNCNAME("CdlWizardBody:: destructor");
97
    CYG_REPORT_FUNCARG1XV(this);
98
    CYG_PRECONDITION_THISC();
99
 
100
    cdlwizardbody_cookie = CdlWizardBody_Invalid;
101
    CYGDBG_MEMLEAK_DESTRUCTOR();
102
 
103
    CYG_REPORT_RETURN();
104
}
105
 
106
//}}}
107
//{{{  parse_wizard()                   
108
 
109
// ----------------------------------------------------------------------------
110
// Parsing a wizard definition.
111
 
112
int
113
CdlWizardBody::parse_wizard(CdlInterpreter interp, int argc, const char* argv[])
114
{
115
    CYG_REPORT_FUNCNAMETYPE("CdlWizard::parse_wizard", "result %d");
116
    CYG_REPORT_FUNCARG1("argc %d", argc);
117
    CYG_PRECONDITION_CLASSC(interp);
118
 
119
    int         result          = TCL_OK;
120
    std::string diag_argv0      = CdlParse::get_tcl_cmd_name(argv[0]);
121
 
122
    CdlLoadable  loadable       = interp->get_loadable();
123
    CdlContainer parent         = interp->get_container();
124
    CdlToplevel  toplevel       = interp->get_toplevel();
125
    CYG_ASSERT_CLASSC(loadable);        // There should always be a loadable during parsing
126
    CYG_ASSERT_CLASSC(parent);
127
    CYG_ASSERT_CLASSC(toplevel);
128
 
129
    // The new wizard should be created and added to the loadable
130
    // early on. If there is a parsing error it will get cleaned up
131
    // automatically as a consequence of the loadable destructor.
132
    // However it is necessary to validate the name first. Errors
133
    // should be reported via CdlParse::report_error(), which
134
    // may result in an exception.
135
    CdlWizard    new_wizard     = 0;
136
    try {
137
 
138
        // Currently there are no command-line options. This may change in future.
139
        if (3 != argc) {
140
            CdlParse::report_error(interp, "", std::string("Incorrect number of arguments to `") + diag_argv0 +
141
                                   "'\nExpecting name and properties list.");
142
        } else if (!Tcl_CommandComplete(CDL_TCL_CONST_CAST(char*, argv[2]))) {
143
            CdlParse::report_error(interp, "", std::string("Invalid property list for cdl_wizard `") + argv[1]+ "'.");
144
        } else if (0 != toplevel->lookup(argv[1])) {
145
            CdlParse::report_error(interp, "", std::string("Wizard `") + argv[1] +
146
                                   "' cannot be loaded.\nThe name is already in use.");
147
        } else {
148
            new_wizard = new CdlWizardBody(argv[1]);
149
            toplevel->add_node(loadable, parent, new_wizard);
150
 
151
            // At this stage new_wizard has been created and added to the hierarchy.
152
            // The main work now is to add the properties.
153
 
154
            // Push the wizard as the current base object early on.
155
            // This aids diagnostics.
156
            CdlNode old_node = 0;
157
 
158
            std::string tcl_result;
159
            std::vector<CdlInterpreterCommandEntry>  new_commands;
160
            std::vector<CdlInterpreterCommandEntry>* old_commands = 0;
161
            static CdlInterpreterCommandEntry commands[] =
162
            {
163
                CdlInterpreterCommandEntry("init_proc",          &parse_init_proc       ),
164
                CdlInterpreterCommandEntry("decoration_proc",    &parse_decoration_proc ),
165
                CdlInterpreterCommandEntry("screen",             &parse_screen          ),
166
                CdlInterpreterCommandEntry("confirm_proc",       &parse_confirm_proc    ),
167
                CdlInterpreterCommandEntry("cancel_proc",        &parse_cancel_proc     ),
168
                CdlInterpreterCommandEntry("",                   0                      ),
169
            };
170
            int i;
171
            for (i = 0; 0 != commands[i].command; i++) {
172
                new_commands.push_back(commands[i]);
173
            }
174
            CdlParentableBody::add_property_parsers(new_commands);
175
            CdlUserVisibleBody::add_property_parsers(new_commands);
176
            CdlNodeBody::add_property_parsers(new_commands);
177
 
178
            // Now evaluate the body. If an error occurs then typically
179
            // this will be reported via CdlParse::report_error(),
180
            // but any exceptions will have been intercepted and
181
            // turned into a Tcl error.
182
            old_node = interp->push_node(new_wizard);
183
            old_commands = interp->push_commands(new_commands);
184
            result = interp->eval(argv[2], tcl_result);
185
            interp->pop_node(old_node);
186
            interp->pop_commands(old_commands);
187
 
188
            if (TCL_OK == result) {
189
                // Even if there were errors, they were not fatal. There may
190
                // now be a number of properties for this option, and some
191
                // validation should take place. Start with the base classes.
192
                new_wizard->CdlNodeBody::check_properties(interp);
193
                new_wizard->CdlUserVisibleBody::check_properties(interp);
194
                new_wizard->CdlParentableBody::check_properties(interp);
195
 
196
                // The init_proc and decoration_proc properties are
197
                // optional. The confirm_proc and cancel_proc properties
198
                // are compulsory, and there should be at least one screen
199
                // definition.
200
                if (new_wizard->count_properties(CdlPropertyId_InitProc) > 1) {
201
                    CdlParse::report_error(interp, "", "A wizard should have only one `init_proc' property.");
202
                }
203
                if (new_wizard->count_properties(CdlPropertyId_DecorationProc) > 1) {
204
                    CdlParse::report_error(interp, "", "A wizard should have only one `decoration_proc' property.");
205
                }
206
                if (new_wizard->count_properties(CdlPropertyId_ConfirmProc) != 1) {
207
                    CdlParse::report_error(interp, "", "A wizard should have one `confirm_proc' property.");
208
                }
209
                if (new_wizard->count_properties(CdlPropertyId_CancelProc) != 1) {
210
                    CdlParse::report_error(interp, "", "A wizard should have one `cancel_proc' property.");
211
                }
212
                if (new_wizard->count_properties(CdlPropertyId_Screen) < 1) {
213
                    CdlParse::report_error(interp, "", "A wizard should have at least one `screen' property.");
214
                }
215
 
216
                // It is necessary to check that all the screen properties have unique numbers
217
                const std::vector<CdlProperty>& properties = new_wizard->get_properties();
218
                std::vector<CdlProperty>::const_iterator prop_i, prop_j;
219
                for (prop_i = properties.begin(); prop_i != properties.end(); prop_i++) {
220
                    if (CdlPropertyId_Screen != (*prop_i)->get_property_name()) {
221
                        continue;
222
                    }
223
                    CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(*prop_i);
224
                    CYG_ASSERT_CLASSC(tclprop);
225
                    cdl_int num1 = tclprop->get_number();
226
 
227
                    for (prop_j = ++prop_i; prop_j != properties.end(); prop_j++) {
228
                        if (CdlPropertyId_Screen != (*prop_j)->get_property_name()) {
229
                            continue;
230
                        }
231
                        CdlProperty_TclCode tclprop2 = dynamic_cast<CdlProperty_TclCode>(*prop_j);
232
                        CYG_ASSERT_CLASSC(tclprop2);
233
                        cdl_int num2 = tclprop2->get_number();
234
 
235
                        if (num1 == num2) {
236
                            std::string tmp = "";
237
                            Cdl::integer_to_string(num1, tmp);
238
                            CdlParse::report_error(interp, "", "Duplicate definition of screen `" + tmp + "'.");
239
                            break;
240
                        }
241
                    }
242
               }
243
 
244
                // There is no restriction on what screen numbers can be
245
                // defined (screens may appear and disappear during
246
                // development). It would be nice to validate that the
247
                // Tcl fragments never switch to an invalid screen, but
248
                // there is no easy way to do that.
249
            }
250
        }
251
 
252
    } catch(...) {
253
        if (0 != new_wizard) {
254
            delete new_wizard;
255
        }
256
        throw;
257
    }
258
 
259
    CYG_REPORT_RETVAL(result);
260
    return result;
261
}
262
 
263
// ----------------------------------------------------------------------------
264
// Syntax: cancel_proc <tclcode>
265
 
266
int
267
CdlWizardBody::parse_cancel_proc(CdlInterpreter interp, int argc, const char* argv[])
268
{
269
    CYG_REPORT_FUNCNAMETYPE("parse_cancel_proc", "result %d");
270
 
271
    int result = CdlParse::parse_tclcode_property(interp, argc, argv, CdlPropertyId_CancelProc, 0, 0);
272
 
273
    CYG_REPORT_RETVAL(result);
274
    return result;
275
}
276
 
277
// ----------------------------------------------------------------------------
278
// Syntax: confirm_proc <tclcode>
279
 
280
int
281
CdlWizardBody::parse_confirm_proc(CdlInterpreter interp, int argc, const char* argv[])
282
{
283
    CYG_REPORT_FUNCNAMETYPE("parse_confirm_proc", "result %d");
284
 
285
    int result = CdlParse::parse_tclcode_property(interp, argc, argv, CdlPropertyId_ConfirmProc, 0, 0);
286
 
287
    CYG_REPORT_RETVAL(result);
288
    return result;
289
}
290
 
291
// ----------------------------------------------------------------------------
292
// syntax: decoration_proc <tclcode>
293
 
294
int
295
CdlWizardBody::parse_decoration_proc(CdlInterpreter interp, int argc, const char* argv[])
296
{
297
    CYG_REPORT_FUNCNAMETYPE("parse_decoration_proc", "result %d");
298
 
299
    int result = CdlParse::parse_tclcode_property(interp, argc, argv, CdlPropertyId_DecorationProc, 0, 0);
300
 
301
    CYG_REPORT_RETVAL(result);
302
    return result;
303
}
304
 
305
// ----------------------------------------------------------------------------
306
// Syntax: init_proc <tclcode>
307
 
308
int
309
CdlWizardBody::parse_init_proc(CdlInterpreter interp, int argc, const char* argv[])
310
{
311
    CYG_REPORT_FUNCNAMETYPE("parse_init_proc", "result %d");
312
 
313
    int result = CdlParse::parse_tclcode_property(interp, argc, argv, CdlPropertyId_InitProc, 0, 0);
314
 
315
    CYG_REPORT_RETVAL(result);
316
    return result;
317
}
318
 
319
// ----------------------------------------------------------------------------
320
// The screen property is a little bit special and cannot be handled by the
321
// generic parsers. There are two arguments, a number and some Tcl code.
322
 
323
int
324
CdlWizardBody::parse_screen(CdlInterpreter interp, int argc, const char* argv[])
325
{
326
    CYG_REPORT_FUNCNAME("CdlParse::parse_screen");
327
    CYG_REPORT_FUNCARG1("argc %d", argc);
328
    CYG_PRECONDITION_CLASSC(interp);
329
 
330
    CdlProperty_TclCode new_property = 0;
331
    cdl_int number = 0;
332
 
333
    try {
334
        std::vector<std::pair<std::string,std::string> > options;
335
        int data_index      = CdlParse::parse_options(interp, std::string("property ") + argv[0], 0, argc, argv, 1, options);
336
        if ((data_index + 2) != argc) {
337
            CdlParse::report_property_parse_error(interp, argv[0], std::string("Invalid number of arguments.\n") +
338
                                         "    Expecting two arguments, a number and some Tcl code.");
339
        } else if (!Cdl::string_to_integer(argv[data_index], number)) {
340
            CdlParse::report_property_parse_error(interp, argv[0], std::string(argv[data_index]) + " is not a valid number.");
341
        } else if (!Tcl_CommandComplete(CDL_TCL_CONST_CAST(char*, argv[data_index + 1]))) {
342
            CdlParse::report_property_parse_error(interp, argv[0], "incomplete Tcl code fragment.");
343
        } else {
344
 
345
            CdlNode current_node = interp->get_node();
346
            CYG_ASSERTC(0 != current_node);
347
            new_property = CdlProperty_TclCodeBody::make(current_node, CdlPropertyId_Screen, number, argv[data_index + 1],
348
                                                         argc, argv, options);
349
        }
350
    } catch(...) {
351
        if (0 != new_property) {
352
            delete new_property;
353
        }
354
        throw;
355
    }
356
 
357
    return TCL_OK;
358
}
359
 
360
//}}}
361
//{{{  Persistence                      
362
 
363
// ----------------------------------------------------------------------------
364
// For now there is no information in a wizard that should end up in a
365
// save file, but it is still desirable to override the base class
366
// member function.
367
 
368
void
369
CdlWizardBody::save(CdlInterpreter interp, Tcl_Channel chan, int indentation, bool minimal)
370
{
371
    CYG_REPORT_FUNCNAME("CdlWizard::save");
372
    CYG_REPORT_FUNCARG5XV(this, interp, chan, indentation, minimal);
373
    CYG_PRECONDITION_THISC();
374
 
375
    CYG_UNUSED_PARAM(CdlInterpreter, interp);
376
    CYG_UNUSED_PARAM(Tcl_Channel, chan);
377
    CYG_UNUSED_PARAM(int, indentation);
378
    CYG_UNUSED_PARAM(bool, minimal);
379
 
380
    CYG_REPORT_RETURN();
381
}
382
 
383
//}}}
384
//{{{  Data access                      
385
 
386
// ----------------------------------------------------------------------------
387
bool
388
CdlWizardBody::has_init_proc() const
389
{
390
    CYG_REPORT_FUNCNAMETYPE("CdlWizard::has_init_proc", "result %d");
391
    CYG_REPORT_FUNCARG1XV(this);
392
    CYG_PRECONDITION_THISC();
393
 
394
    bool result = has_property(CdlPropertyId_InitProc);
395
    CYG_REPORT_RETVAL(result);
396
    return result;
397
}
398
 
399
bool
400
CdlWizardBody::has_decoration_proc() const
401
{
402
    CYG_REPORT_FUNCNAMETYPE("CdlWizard::has_decoration_proc", "result %d");
403
    CYG_REPORT_FUNCARG1XV(this);
404
    CYG_PRECONDITION_THISC();
405
 
406
    bool result = has_property(CdlPropertyId_DecorationProc);
407
    CYG_REPORT_RETVAL(result);
408
    return result;
409
}
410
 
411
bool
412
CdlWizardBody::has_screen(cdl_int screen) const
413
{
414
    CYG_REPORT_FUNCNAMETYPE("CdlWizard::has_screen", "result %d");
415
    CYG_REPORT_FUNCARG2XV(this, (int) screen);
416
    CYG_PRECONDITION_THISC();
417
 
418
    bool result = false;
419
    const std::vector<CdlProperty>& properties = get_properties();
420
    std::vector<CdlProperty>::const_iterator prop_i;
421
    for (prop_i = properties.begin(); prop_i != properties.end(); prop_i++) {
422
        if (CdlPropertyId_Screen != (*prop_i)->get_property_name()) {
423
            continue;
424
        }
425
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(*prop_i);
426
        CYG_ASSERT_CLASSC(tclprop);
427
        if (screen == tclprop->get_number()) {
428
            result = true;
429
            break;
430
        }
431
    }
432
    CYG_REPORT_RETVAL(result);
433
    return result;
434
}
435
 
436
const cdl_tcl_code&
437
CdlWizardBody::get_init_proc() const
438
{
439
    CYG_REPORT_FUNCNAME("CdlWizard::get_init_proc");
440
    CYG_REPORT_FUNCARG1XV(this);
441
    CYG_PRECONDITION_THISC();
442
 
443
    static cdl_tcl_code null_result = "";
444
    cdl_tcl_code& result = null_result;
445
    CdlProperty prop = get_property(CdlPropertyId_InitProc);
446
    if (0 != prop) {
447
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(prop);
448
        CYG_ASSERT_CLASSC(tclprop);
449
        result = tclprop->get_code();
450
    }
451
 
452
    CYG_REPORT_RETURN();
453
    return result;
454
}
455
 
456
const cdl_tcl_code&
457
CdlWizardBody::get_decoration_proc() const
458
{
459
    CYG_REPORT_FUNCNAME("CdlWizard::get_decoration_proc");
460
    CYG_REPORT_FUNCARG1XV(this);
461
    CYG_PRECONDITION_THISC();
462
 
463
    static cdl_tcl_code null_result = "";
464
    cdl_tcl_code& result = null_result;
465
    CdlProperty prop = get_property(CdlPropertyId_DecorationProc);
466
    if (0 != prop) {
467
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(prop);
468
        CYG_ASSERT_CLASSC(tclprop);
469
        result = tclprop->get_code();
470
    }
471
 
472
    CYG_REPORT_RETURN();
473
    return result;
474
}
475
 
476
const cdl_tcl_code&
477
CdlWizardBody::get_confirm_proc() const
478
{
479
    CYG_REPORT_FUNCNAME("CdlWizard::get_display_proc");
480
    CYG_REPORT_FUNCARG1XV(this);
481
    CYG_PRECONDITION_THISC();
482
 
483
    CdlProperty prop = get_property(CdlPropertyId_ConfirmProc);
484
    CYG_ASSERT_CLASSC(prop);
485
    CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(prop);
486
    CYG_ASSERT_CLASSC(tclprop);
487
 
488
    const cdl_tcl_code& result = tclprop->get_code();
489
 
490
    CYG_REPORT_RETURN();
491
    return result;
492
}
493
 
494
const cdl_tcl_code&
495
CdlWizardBody::get_cancel_proc() const
496
{
497
    CYG_REPORT_FUNCNAME("CdlWizard::get_display_proc");
498
    CYG_REPORT_FUNCARG1XV(this);
499
    CYG_PRECONDITION_THISC();
500
 
501
    CdlProperty prop = get_property(CdlPropertyId_CancelProc);
502
    CYG_ASSERT_CLASSC(prop);
503
    CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(prop);
504
    CYG_ASSERT_CLASSC(tclprop);
505
 
506
    const cdl_tcl_code& result = tclprop->get_code();
507
 
508
    CYG_REPORT_RETURN();
509
    return result;
510
}
511
 
512
cdl_int
513
CdlWizardBody::get_first_screen_number() const
514
{
515
    CYG_REPORT_FUNCNAMETYPE("CdlWizard::get_first_screen_number", "result %d");
516
    CYG_REPORT_FUNCARG1XV(this);
517
    CYG_PRECONDITION_THISC();
518
 
519
    // The result should really be initialized to MININT, but that is
520
    // slightly tricky given that we are dealing with cdl_int's rather
521
    // than plain int's. Instead a separate flag gives the same
522
    // effect.
523
    bool        result_set = false;
524
    cdl_int     result = -1;
525
 
526
    const std::vector<CdlProperty>& properties = get_properties();
527
    std::vector<CdlProperty>::const_iterator prop_i;
528
    for (prop_i = properties.begin(); prop_i != properties.end(); prop_i++) {
529
        if (CdlPropertyId_Screen != (*prop_i)->get_property_name()) {
530
            continue;
531
        }
532
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(*prop_i);
533
        cdl_int its_num = tclprop->get_number();
534
        if (!result_set || (its_num < result)) {
535
            result = its_num;
536
            result_set = true;
537
        }
538
    }
539
 
540
    CYG_REPORT_RETVAL((int) result);
541
    return result;
542
}
543
 
544
const cdl_tcl_code&
545
CdlWizardBody::get_first_screen() const
546
{
547
    CYG_REPORT_FUNCNAME("CdlWizard::get_first_screen");
548
    CYG_REPORT_FUNCARG1XV(this);
549
    CYG_PRECONDITION_THISC();
550
 
551
    // The result should really be initialized to MININT, but that is
552
    // slightly tricky given that we are dealing with cdl_int's rather
553
    // than plain int's. Instead a separate flag gives the same
554
    // effect.
555
    static cdl_tcl_code null_result     = "";
556
    bool                result_set      = false;
557
    cdl_tcl_code&       result          = null_result;
558
    cdl_int             result_num      = -1;
559
 
560
    const std::vector<CdlProperty>& properties = get_properties();
561
    std::vector<CdlProperty>::const_iterator prop_i;
562
    for (prop_i = properties.begin(); prop_i != properties.end(); prop_i++) {
563
        if (CdlPropertyId_Screen != (*prop_i)->get_property_name()) {
564
            continue;
565
        }
566
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(*prop_i);
567
        cdl_int its_num = tclprop->get_number();
568
        if (!result_set || (its_num < result_num)) {
569
            result     = tclprop->get_code();
570
            result_num = its_num;
571
            result_set = true;
572
        }
573
    }
574
 
575
    CYG_REPORT_RETURN();
576
    return result;
577
}
578
 
579
const cdl_tcl_code&
580
CdlWizardBody::get_screen(cdl_int screen) const
581
{
582
    CYG_REPORT_FUNCNAME("CdlWizard::get_screen");
583
    CYG_REPORT_FUNCARG2XV(this, (int)screen);
584
    CYG_PRECONDITION_THISC();
585
 
586
    static cdl_tcl_code null_result     = "";
587
    cdl_tcl_code&       result          = null_result;
588
 
589
    const std::vector<CdlProperty>& properties = get_properties();
590
    std::vector<CdlProperty>::const_iterator prop_i;
591
    for (prop_i = properties.begin(); prop_i != properties.end(); prop_i++) {
592
        if (CdlPropertyId_Screen != (*prop_i)->get_property_name()) {
593
            continue;
594
        }
595
        CdlProperty_TclCode tclprop = dynamic_cast<CdlProperty_TclCode>(*prop_i);
596
        if (tclprop->get_number() == screen) {
597
            result     = tclprop->get_code();
598
            break;
599
        }
600
    }
601
 
602
    CYG_REPORT_RETURN();
603
    return result;
604
}
605
 
606
//}}}
607
//{{{  check_this()                     
608
 
609
// ----------------------------------------------------------------------------
610
// check_this(). There is very little data associated with a wizard,
611
// most of the checks happen in the base classes.
612
bool
613
CdlWizardBody::check_this(cyg_assert_class_zeal zeal) const
614
{
615
    if (CdlWizardBody_Magic != cdlwizardbody_cookie) {
616
        return false;
617
    }
618
    CYGDBG_MEMLEAK_CHECKTHIS();
619
    return CdlUserVisibleBody::check_this(zeal);
620
}
621
 
622
//}}}
623
//{{{  misc                             
624
 
625
// ----------------------------------------------------------------------------
626
 
627
std::string
628
CdlWizardBody::get_class_name() const
629
{
630
    CYG_REPORT_FUNCNAME("CdlWizard::get_class_name");
631
    CYG_PRECONDITION_THISC();
632
    CYG_REPORT_RETURN();
633
    return "wizard";
634
}
635
 
636
//}}}

powered by: WebSVN 2.1.0

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