File Coverage

blib/lib/CORBA/HTML/DeclVisitor.pm
Criterion Covered Total %
statement 6 577 1.0
branch 0 212 0.0
condition 0 12 0.0
subroutine 2 41 4.8
pod 0 35 0.0
total 8 877 0.9


line stmt bran cond sub pod time code
1            
2             #
3             # Interface Definition Language (OMG IDL CORBA v3.0)
4             #
5            
6             package CORBA::HTML::DeclVisitor;
7            
8 1     1   17 use strict;
  1         2  
  1         45  
9 1     1   6 use warnings;
  1         2  
  1         7783  
10            
11             our $VERSION = '2.60';
12            
13             sub new {
14 0     0 0   my $proto = shift;
15 0   0       my $class = ref($proto) || $proto;
16 0           my $self = {};
17 0           bless $self, $class;
18 0           $self->{parent} = shift;
19 0           return $self;
20             }
21            
22             sub _get_defn {
23 0     0     my $self = shift;
24 0           my ($defn) = @_;
25 0 0         if (ref $defn) {
26 0           return $defn;
27             }
28             else {
29 0           return $self->{parent}->{symbtab}->Lookup($defn);
30             }
31             }
32            
33             sub _get_name {
34 0     0     my $self = shift;
35 0           my ($node) = @_;
36 0 0         unless (ref $node) {
37 0           $node = $self->{parent}->{symbtab}->Lookup($node);
38             }
39 0           return $node->visit($self->{parent}->{html_name}, $self->{parent}->{scope});
40             }
41            
42             sub _xp {
43 0     0     my $self = shift;
44 0           my ($node, $FH) = @_;
45 0 0         if (exists $node->{declspec}) {
46 0           print $FH "__declspec(",$node->{declspec},")\n";
47 0           print $FH " ";
48             }
49 0 0         if (exists $node->{props}) {
50 0           print $FH "[";
51 0           my $first = 1;
52 0           while (my ($key, $value) = each (%{$node->{props}})) {
  0            
53 0 0         print $FH ", " unless ($first);
54 0           print $FH $key;
55 0 0         print $FH " (",$value,")" if (defined $value);
56 0           $first = 0;
57             }
58 0           print $FH "]\n";
59 0           print $FH " ";
60             }
61             }
62            
63             sub _xp_props {
64 0     0     my $self = shift;
65 0           my ($node, $FH) = @_;
66 0 0         if (exists $node->{props}) {
67 0           print $FH "[";
68 0           my $first = 1;
69 0           while (my ($key, $value) = each (%{$node->{props}})) {
  0            
70 0 0         print $FH ", " unless ($first);
71 0           print $FH $key;
72 0 0         print $FH " (",$value,")" if (defined $value);
73 0           $first = 0;
74             }
75 0           print $FH "] ";
76             }
77             }
78            
79             #
80             # 3.6 Module Declaration
81             #
82            
83             sub visitModules {
84 0     0 0   my $self = shift;
85 0           my ($node, $FH) = @_;
86 0           print $FH "\n";
87 0           print $FH "
  ";
 
88 0           $self->_xp($node, $FH);
89 0           print $FH "module ",$node->{idf},"\n";
90 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
91             if (exists $node->{typeid});
92 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
93             if (exists $node->{typeprefix});
94 0           print $FH "\n";
95             }
96            
97             #
98             # 3.8 Interface Declaration
99             #
100            
101             sub visitRegularInterface {
102 0     0 0   my $self = shift;
103 0           my ($node, $FH) = @_;
104 0           print $FH "\n";
105 0           print $FH "
  ";
 
106 0           $self->_xp($node, $FH);
107 0           print $FH "interface ",$node->{idf},"";
108 0 0 0       if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) {
109 0           print $FH " : ";
110 0           my $first = 1;
111 0           foreach (@{$node->{inheritance}->{list_interface}}) {
  0            
112 0 0         print $FH ", " unless ($first);
113 0           print $FH $self->_get_name($_);
114 0           $first = 0;
115             }
116             }
117 0           print $FH ";\n";
118 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
119             if (exists $node->{typeid});
120 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
121             if (exists $node->{typeprefix});
122 0           print $FH "\n";
123             }
124            
125             sub visitAbstractInterface {
126 0     0 0   my $self = shift;
127 0           my ($node, $FH) = @_;
128 0           print $FH "\n";
129 0           print $FH "
  ";
 
130 0           $self->_xp($node, $FH);
131 0           print $FH "abstract interface ",$node->{idf},"";
132 0 0 0       if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) {
133 0           print $FH " : ";
134 0           my $first = 1;
135 0           foreach (@{$node->{inheritance}->{list_interface}}) {
  0            
136 0 0         print $FH ", " unless ($first);
137 0           print $FH $self->_get_name($_);
138 0           $first = 0;
139             }
140             }
141 0           print $FH ";\n";
142 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
143             if (exists $node->{typeid});
144 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
145             if (exists $node->{typeprefix});
146 0           print $FH "\n";
147             }
148            
149             sub visitLocalInterface {
150 0     0 0   my $self = shift;
151 0           my ($node, $FH) = @_;
152 0           print $FH "\n";
153 0           print $FH "
  ";
 
154 0           $self->_xp($node, $FH);
155 0           print $FH "local interface ",$node->{idf},"";
156 0 0 0       if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) {
157 0           print $FH " : ";
158 0           my $first = 1;
159 0           foreach (@{$node->{inheritance}->{list_interface}}) {
  0            
160 0 0         print $FH ", " unless ($first);
161 0           print $FH $self->_get_name($_);
162 0           $first = 0;
163             }
164             }
165 0           print $FH ";\n";
166 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
167             if (exists $node->{typeid});
168 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
169             if (exists $node->{typeprefix});
170 0           print $FH "\n";
171             }
172            
173             #
174             # 3.9 Value Declaration
175             #
176             # 3.9.1 Regular Value Type
177             #
178            
179             sub visitRegularValue {
180 0     0 0   my $self = shift;
181 0           my ($node, $FH) = @_;
182 0           print $FH "\n";
183 0           print $FH "
  ";
 
184 0           $self->_xp($node, $FH);
185 0 0         print $FH "custom "
186             if (exists $node->{modifier});
187 0           print $FH "value ",$node->{idf},"";
188 0 0         if (exists $node->{inheritance}) {
189 0           my $inheritance = $node->{inheritance};
190 0           print $FH " : ";
191 0 0         if (exists $inheritance->{list_value}) {
192 0 0         print $FH "truncatable " if (exists $inheritance->{modifier});
193 0           my $first = 1;
194 0           foreach (@{$inheritance->{list_value}}) {
  0            
195 0 0         print $FH ", " if (! $first);
196 0           print $FH $self->_get_name($_);
197 0           $first = 0;
198             }
199 0           print $FH " ";
200             }
201 0 0         if (exists $inheritance->{list_interface}) {
202 0           print $FH "support ";
203 0           my $first = 1;
204 0           foreach (@{$inheritance->{list_interface}}) {
  0            
205 0 0         print $FH ", " if (! $first);
206 0           print $FH $self->_get_name($_);
207 0           $first = 0;
208             }
209             }
210             }
211 0           print $FH ";\n";
212 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
213             if (exists $node->{typeid});
214 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
215             if (exists $node->{typeprefix});
216 0           print $FH "\n";
217             }
218            
219             sub visitStateMember {
220 0     0 0   my $self = shift;
221 0           my ($node, $FH) = @_;
222 0           print $FH "
  ";
 
223 0           $self->_xp($node, $FH);
224 0           print $FH $node->{modifier}," ";
225 0           print $FH $self->_get_name($node->{type});
226 0           print $FH " ",$node->{idf},"";
227 0 0         if (exists $node->{array_size}) {
228 0           foreach (@{$node->{array_size}}) {
  0            
229 0           print $FH "[";
230 0           $_->visit($self, $FH); # expression
231 0           print $FH "]";
232             }
233             }
234 0           print $FH ";\n";
235 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
236             if (exists $node->{typeid});
237 0           print $FH "\n";
238             }
239            
240             sub visitInitializer {
241 0     0 0   my $self = shift;
242 0           my ($node, $FH) = @_;
243 0           print $FH "
  ";
 
244 0           $self->_xp($node, $FH);
245 0           print $FH "factory ",$node->{idf}," (";
246 0           my $first = 1;
247 0           foreach (@{$node->{list_param}}) { # parameter
  0            
248 0 0         print $FH "," unless ($first);
249 0           print $FH "\n";
250 0           print $FH " ";
251 0           $self->_xp_props($_, $FH);
252 0           print $FH $_->{attr}," ",$self->_get_name($_->{type})," ",$_->{idf};
253 0           $first = 0;
254             }
255 0           print $FH "\n";
256 0           print $FH " )";
257 0 0         if (exists $node->{list_raise}) {
258 0           print $FH " raises(";
259 0           my $first = 1;
260 0           foreach (@{$node->{list_raise}}) { # exception
  0            
261 0 0         print $FH ", " unless ($first);
262 0           print $FH $self->_get_name($_);
263 0           $first = 0;
264             }
265 0           print $FH ")";
266             }
267 0           print $FH ";\n";
268 0           print $FH "\n";
269             }
270            
271             # 3.9.2 Boxed Value Type
272             #
273            
274             sub visitBoxedValue {
275 0     0 0   my $self = shift;
276 0           my ($node, $FH) = @_;
277 0           print $FH "
  ";
 
278 0           $self->_xp($node, $FH);
279 0           print $FH "valuetype ";
280 0           print $FH "",$node->{idf}," ";
281 0           print $FH $self->_get_name($node->{type});
282 0           print $FH ";\n";
283 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
284             if (exists $node->{typeid});
285 0 0         print $FH " typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
286             if (exists $node->{typeprefix});
287 0           print $FH "\n";
288             }
289            
290             # 3.9.3 Abstract Value Type
291             #
292            
293             sub visitAbstractValue {
294 0     0 0   my $self = shift;
295 0           my ($node, $FH) = @_;
296 0           print $FH "\n";
297 0           print $FH "
  ";
 
298 0           $self->_xp($node, $FH);
299 0           print $FH "abstract valuetype ",$node->{idf},"";
300 0 0         if (exists $node->{inheritance}) {
301 0           my $inheritance = $node->{inheritance};
302 0           print $FH " : ";
303 0 0         if (exists $inheritance->{list_value}) {
304 0 0         print $FH "truncatable " if (exists $inheritance->{modifier});
305 0           my $first = 1;
306 0           foreach (@{$inheritance->{list_value}}) {
  0            
307 0 0         print $FH ", " if (! $first);
308 0           print $FH $self->_get_name($_);
309 0           $first = 0;
310             }
311 0           print $FH " ";
312             }
313 0 0         if (exists $inheritance->{list_interface}) {
314 0           print $FH "support ";
315 0           my $first = 1;
316 0           foreach (@{$inheritance->{list_interface}}) {
  0            
317 0 0         print $FH ", " if (! $first);
318 0           print $FH $self->_get_name($_);
319 0           $first = 0;
320             }
321             }
322             }
323 0           print $FH ";\n";
324 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
325             if (exists $node->{typeid});
326 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
327             if (exists $node->{typeprefix});
328 0           print $FH "\n";
329             }
330            
331             #
332             # 3.10 Constant Declaration
333             #
334            
335             sub visitConstant {
336 0     0 0   my $self = shift;
337 0           my ($node, $FH) = @_;
338 0           print $FH "
  ";
 
339 0           $self->_xp($node, $FH);
340 0           print $FH "constant ";
341 0           print $FH $self->_get_name($node->{type});
342 0           print $FH " ",$node->{idf}," = ";
343 0           $node->{value}->visit($self, $FH); # expression
344 0           print $FH ";\n";
345 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
346             if (exists $node->{typeid});
347 0           print $FH "\n";
348             }
349            
350             sub visitExpression {
351 0     0 0   my $self = shift;
352 0           my ($node, $FH) = @_;
353 0           print $FH $self->_get_name($node);
354             }
355            
356             #
357             # 3.11 Type Declaration
358             #
359            
360             sub visitTypeDeclarator {
361 0     0 0   my $self = shift;
362 0           my ($node, $FH) = @_;
363 0           print $FH "
  ";
 
364 0           $self->_xp($node, $FH);
365 0           print $FH "typedef ";
366 0           print $FH $self->_get_name($node->{type});
367 0           print $FH " ",$node->{idf},"";
368 0 0         if (exists $node->{array_size}) {
369 0           foreach (@{$node->{array_size}}) {
  0            
370 0           print $FH "[";
371 0           $_->visit($self, $FH); # expression
372 0           print $FH "]";
373             }
374             }
375 0           print $FH ";\n";
376 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
377             if (exists $node->{typeid});
378 0           print $FH "\n";
379             }
380            
381             sub visitNativeType {
382 0     0 0   my $self = shift;
383 0           my ($node, $FH) = @_;
384 0           print $FH "
  ";
 
385 0           $self->_xp($node, $FH);
386 0           print $FH "native ";
387 0           print $FH " ",$node->{idf},"";
388 0 0         print $FH " (",$node->{native},")" if (exists $node->{native}); # XPIDL
389 0           print $FH ";\n";
390 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
391             if (exists $node->{typeid});
392 0           print $FH "\n";
393             }
394            
395             #
396             # 3.11.2 Constructed Types
397             #
398             # 3.11.2.1 Structures
399             #
400            
401             sub visitStructType {
402 0     0 0   my $self = shift;
403 0           my ($node, $FH) = @_;
404 0           print $FH "
  ";
 
405 0           $self->_xp($node, $FH);
406 0           print $FH "struct ",$node->{html_name}," {\n";
407 0           foreach (@{$node->{list_expr}}) {
  0            
408 0           $_->visit($self, $FH); # members
409             }
410 0           print $FH " };\n";
411 0           print $FH "\n";
412             }
413            
414             sub visitMembers {
415 0     0 0   my $self = shift;
416 0           my ($node, $FH) = @_;
417 0           print $FH " ";
418 0           $self->_xp_props($node, $FH);
419 0           print $FH " ",$self->_get_name($node->{type});
420 0           my $first = 1;
421 0           foreach (@{$node->{list_member}}) {
  0            
422 0 0         if ($first) {
423 0           $first = 0;
424             }
425             else {
426 0           print $FH ",";
427             }
428 0           $self->_get_defn($_)->visit($self, $FH); # member
429             }
430 0           print $FH ";\n";
431             }
432            
433             sub visitMember {
434 0     0 0   my $self = shift;
435 0           my ($node, $FH) = @_;
436 0           print $FH " ",$node->{idf};
437 0 0         if (exists $node->{array_size}) {
438 0           foreach (@{$node->{array_size}}) {
  0            
439 0           print $FH "[";
440 0           $_->visit($self, $FH); # expression
441 0           print $FH "]";
442             }
443             }
444             }
445            
446             # 3.11.2.2 Discriminated Unions
447             #
448            
449             sub visitUnionType {
450 0     0 0   my $self = shift;
451 0           my ($node, $FH) = @_;
452 0           print $FH "
  ";
 
453 0           $self->_xp($node, $FH);
454 0           print $FH "union ",$node->{html_name}," switch(";
455 0           print $FH $self->_get_name($node->{type});
456 0           print $FH ") {\n";
457 0           foreach (@{$node->{list_expr}}) {
  0            
458 0           $_->visit($self, $FH); # case
459             }
460 0           print $FH " };\n";
461 0           print $FH "\n";
462             }
463            
464             sub visitCase {
465 0     0 0   my $self = shift;
466 0           my ($node, $FH) = @_;
467 0           foreach (@{$node->{list_label}}) {
  0            
468 0 0         if ($_->isa('Default')) {
469 0           print $FH " default:\n";
470             }
471             else {
472 0           print $FH " case ";
473 0           $_->visit($self, $FH); # expression
474 0           print $FH ":\n";
475             }
476             }
477 0           $node->{element}->visit($self, $FH);
478             }
479            
480             sub visitElement {
481 0     0 0   my $self = shift;
482 0           my ($node, $FH) = @_;
483 0           print $FH " ",$self->_get_name($node->{type});
484 0           $self->_get_defn($node->{value})->visit($self, $FH); # member
485 0           print $FH ";\n";
486             }
487            
488             # 3.11.2.4 Enumerations
489             #
490            
491             sub visitEnumType {
492 0     0 0   my $self = shift;
493 0           my ($node, $FH) = @_;
494 0           print $FH "
  ";
 
495 0           $self->_xp($node, $FH);
496 0           print $FH "enum ",$node->{html_name}," {\n";
497 0           my $first = 1;
498 0           foreach (@{$node->{list_expr}}) { # enum
  0            
499 0 0         print $FH ",\n" unless ($first);
500 0           print $FH " ",$_->{idf};
501 0           $first = 0;
502             }
503 0           print $FH "\n";
504 0           print $FH " };\n";
505 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
506             if (exists $node->{typeid});
507 0           print $FH "\n";
508             }
509            
510             #
511             # 3.12 Exception Declaration
512             #
513            
514             sub visitException {
515 0     0 0   my $self = shift;
516 0           my ($node, $FH) = @_;
517 0           print $FH "
  ";
 
518 0           $self->_xp($node, $FH);
519 0           print $FH "exception ",$node->{idf}," {\n";
520 0           foreach (@{$node->{list_expr}}) {
  0            
521 0           $_->visit($self, $FH); # members
522             }
523 0           print $FH " };\n";
524 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
525             if (exists $node->{typeid});
526 0           print $FH "\n";
527             }
528            
529             #
530             # 3.13 Operation Declaration
531             #
532            
533             sub visitOperation {
534 0     0 0   my $self = shift;
535 0           my ($node, $FH) = @_;
536 0           print $FH "
  ";
 
537 0           $self->_xp($node, $FH);
538 0 0         print $FH "oneway " if (exists $node->{modifier});
539 0           print $FH $self->_get_name($node->{type});
540 0           print $FH " ",$node->{idf}," (";
541 0           my $first = 1;
542 0           foreach (@{$node->{list_param}}) { # parameter
  0            
543 0 0         print $FH "," unless ($first);
544 0           print $FH "\n";
545 0           print $FH " ";
546 0 0         if ($_->isa('Ellipsis')) {
547 0           print $FH "...";
548             }
549             else {
550 0           $self->_xp_props($_, $FH);
551 0           print $FH $_->{attr}," ",$self->_get_name($_->{type})," ",$_->{idf};
552             }
553 0           $first = 0;
554             }
555 0           print $FH "\n";
556 0           print $FH " )";
557 0 0         if (exists $node->{list_raise}) {
558 0           print $FH " raises(";
559 0           my $first = 1;
560 0           foreach (@{$node->{list_raise}}) { # exception
  0            
561 0 0         print $FH ", " unless ($first);
562 0           print $FH $self->_get_name($_);
563 0           $first = 0;
564             }
565 0           print $FH ")";
566             }
567 0           print $FH ";\n";
568 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
569             if (exists $node->{typeid});
570 0           print $FH "\n";
571             }
572            
573             #
574             # 3.14 Attribute Declaration
575             #
576            
577             sub visitAttribute {
578 0     0 0   my $self = shift;
579 0           my ($node, $FH) = @_;
580 0           print $FH "
  ";
 
581 0           $self->_xp($node, $FH);
582 0 0         print $FH "readonly " if (exists $node->{modifier});
583 0           print $FH "attribute ";
584 0           print $FH $self->_get_name($node->{type});
585 0           print $FH " ",$node->{idf},";";
586 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
587             if (exists $node->{typeid});
588 0           print $FH "\n";
589             }
590            
591             #
592             # 3.16 Event Declaration
593             #
594            
595             sub visitRegularEvent {
596 0     0 0   my $self = shift;
597 0           my ($node, $FH) = @_;
598 0           print $FH "\n";
599 0           print $FH "
  ";
 
600 0 0         print $FH "custom "
601             if (exists $node->{modifier});
602 0           print $FH "eventtype ",$node->{idf},"";
603 0 0         if (exists $node->{inheritance}) {
604 0           my $inheritance = $node->{inheritance};
605 0           print $FH " : ";
606 0 0         if (exists $inheritance->{list_value}) {
607 0 0         print $FH "truncatable " if (exists $inheritance->{modifier});
608 0           my $first = 1;
609 0           foreach (@{$inheritance->{list_value}}) {
  0            
610 0 0         print $FH ", " if (! $first);
611 0           print $FH $self->_get_name($_);
612 0           $first = 0;
613             }
614             }
615 0 0         if (exists $inheritance->{list_interface}) {
616 0           print $FH "support ";
617 0           my $first = 1;
618 0           foreach (@{$inheritance->{list_interface}}) {
  0            
619 0 0         print $FH ", " if (! $first);
620 0           print $FH $self->_get_name($_);
621 0           $first = 0;
622             }
623             }
624             }
625 0           print $FH ";\n";
626 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
627             if (exists $node->{typeid});
628 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
629             if (exists $node->{typeprefix});
630 0           print $FH "\n";
631             }
632            
633             sub visitAbstractEvent {
634 0     0 0   my $self = shift;
635 0           my ($node, $FH) = @_;
636 0           print $FH "\n";
637 0           print $FH "
  abstract eventtype ",$node->{idf},"";
 
638 0 0         if (exists $node->{inheritance}) {
639 0           my $inheritance = $node->{inheritance};
640 0           print $FH " : ";
641 0 0         if (exists $inheritance->{list_value}) {
642 0 0         print $FH "truncatable " if (exists $inheritance->{modifier});
643 0           my $first = 1;
644 0           foreach (@{$inheritance->{list_value}}) {
  0            
645 0 0         print $FH ", " if (! $first);
646 0           print $FH $self->_get_name($_);
647 0           $first = 0;
648             }
649             }
650 0 0         if (exists $inheritance->{list_interface}) {
651 0           print $FH "support ";
652 0           my $first = 1;
653 0           foreach (@{$inheritance->{list_interface}}) {
  0            
654 0 0         print $FH ", " if (! $first);
655 0           print $FH $self->_get_name($_);
656 0           $first = 0;
657             }
658             }
659             }
660 0           print $FH ";\n";
661 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
662             if (exists $node->{typeid});
663 0 0         print $FH "typeprefix ",$node->{idf}," \"",$node->{typeprefix},"\";\n"
664             if (exists $node->{typeprefix});
665 0           print $FH "\n";
666             }
667            
668             #
669             # 3.17 Component Declaration
670             #
671            
672             sub visitComponent {
673 0     0 0   my $self = shift;
674 0           my ($node, $FH) = @_;
675 0           print $FH "";
676 0           print $FH "
  component ",$node->{idf},"";
 
677 0 0         if (exists $node->{inheritance}) {
678 0           print $FH " : ",$self->_get_name($node->{inheritance});
679             }
680 0 0         if (exists $node->{list_support}) {
681 0           print $FH " support ";
682 0           my $first = 1;
683 0           foreach (@{$node->{list_support}}) {
  0            
684 0 0         print $FH ", " if (! $first);
685 0           print $FH $self->_get_name($_);
686 0           $first = 0;
687             }
688             }
689 0           print $FH ";\n";
690 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
691             if (exists $node->{typeid});
692 0           print $FH "\n";
693             }
694            
695             sub visitProvides {
696 0     0 0   my $self = shift;
697 0           my ($node, $FH) = @_;
698 0           print $FH "
  ";
 
699 0           print $FH "provides ";
700 0           print $FH $self->_get_name($node->{type});
701 0           print $FH " ",$node->{idf},";\n";
702 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
703             if (exists $node->{typeid});
704 0           print $FH "\n";
705             }
706            
707             sub visitUses {
708 0     0 0   my $self = shift;
709 0           my ($node, $FH) = @_;
710 0           print $FH "
  ";
 
711 0           print $FH "provides ";
712 0 0         print $FH "multiple " if (exists $node->{modifier});
713 0           print $FH $self->_get_name($node->{type});
714 0           print $FH " ",$node->{idf},";\n";
715 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
716             if (exists $node->{typeid});
717 0           print $FH "\n";
718             }
719            
720             sub visitPublishes {
721 0     0 0   my $self = shift;
722 0           my ($node, $FH) = @_;
723 0           print $FH "
  ";
 
724 0           print $FH "publishes ";
725 0           print $FH $self->_get_name($node->{type});
726 0           print $FH " ",$node->{idf},";\n";
727 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
728             if (exists $node->{typeid});
729 0           print $FH "\n";
730             }
731            
732             sub visitEmits {
733 0     0 0   my $self = shift;
734 0           my ($node, $FH) = @_;
735 0           print $FH "
  ";
 
736 0           print $FH "emits ";
737 0           print $FH $self->_get_name($node->{type});
738 0           print $FH " ",$node->{idf},";\n";
739 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
740             if (exists $node->{typeid});
741 0           print $FH "\n";
742             }
743            
744             sub visitConsumes {
745 0     0 0   my $self = shift;
746 0           my ($node, $FH) = @_;
747 0           print $FH "
  ";
 
748 0           print $FH "consumes ";
749 0           print $FH $self->_get_name($node->{type});
750 0           print $FH " ",$node->{idf},";\n";
751 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
752             if (exists $node->{typeid});
753 0           print $FH "\n";
754             }
755            
756             #
757             # 3.18 Home Declaration
758             #
759            
760             sub visitHome {
761 0     0 0   my $self = shift;
762 0           my ($node, $FH) = @_;
763 0           print $FH "";
764 0           print $FH "
  home ",$node->{idf},"";
 
765 0 0         if (exists $node->{inheritance}) {
766 0           print $FH " : ",$self->_get_name($node->{inheritance});
767             }
768 0 0         if (exists $node->{list_support}) {
769 0           print $FH " support ";
770 0           my $first = 1;
771 0           foreach (@{$node->{list_support}}) {
  0            
772 0 0         print $FH ", " if (! $first);
773 0           print $FH $self->_get_name($_);
774 0           $first = 0;
775             }
776             }
777 0           print $FH " manages ",$self->_get_name($node->{manage});
778 0 0         if (exists $node->{primarykey}) {
779 0           print $FH " primarykey ",$self->_get_name($node->{primarykey});
780             }
781 0           print $FH ";\n";
782 0 0         print $FH "typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
783             if (exists $node->{typeid});
784 0           print $FH "\n";
785             }
786            
787             sub visitFactory {
788 0     0 0   my $self = shift;
789 0           my ($node, $FH) = @_;
790 0           print $FH "
  factory ",$node->{idf}," (";
 
791 0           my $first = 1;
792 0           foreach (@{$node->{list_param}}) { # parameter
  0            
793 0 0         print $FH "," unless ($first);
794 0           print $FH "\n";
795 0           print $FH " ",$_->{attr}," ",$self->_get_name($_->{type})," ",$_->{idf};
796 0           $first = 0;
797             }
798 0           print $FH "\n";
799 0           print $FH " )";
800 0 0         if (exists $node->{list_raise}) {
801 0           print $FH " raises(";
802 0           my $first = 1;
803 0           foreach (@{$node->{list_raise}}) { # exception
  0            
804 0 0         print $FH ", " unless ($first);
805 0           print $FH $self->_get_name($_);
806 0           $first = 0;
807             }
808 0           print $FH ")";
809             }
810 0           print $FH ";\n";
811 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
812             if (exists $node->{typeid});
813 0           print $FH "\n";
814             }
815            
816             sub visitFinder {
817 0     0 0   my $self = shift;
818 0           my ($node, $FH) = @_;
819 0           print $FH "
  finder ",$node->{idf}," (";
 
820 0           my $first = 1;
821 0           foreach (@{$node->{list_param}}) { # parameter
  0            
822 0 0         print $FH "," unless ($first);
823 0           print $FH "\n";
824 0           print $FH " ",$_->{attr}," ",$self->_get_name($_->{type})," ",$_->{idf};
825 0           $first = 0;
826             }
827 0           print $FH "\n";
828 0           print $FH " )";
829 0 0         if (exists $node->{list_raise}) {
830 0           print $FH " raises(";
831 0           my $first = 1;
832 0           foreach (@{$node->{list_raise}}) { # exception
  0            
833 0 0         print $FH ", " unless ($first);
834 0           print $FH $self->_get_name($_);
835 0           $first = 0;
836             }
837 0           print $FH ")";
838             }
839 0           print $FH ";\n";
840 0 0         print $FH " typeid ",$node->{idf}," \"",$node->{typeid},"\";\n"
841             if (exists $node->{typeid});
842 0           print $FH "\n";
843             }
844            
845             1;
846