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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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