Differences From Artifact [632bc129d5]:
- Executable file
mttroot/mtt/bin/trans/dia2abg.pl
— part of check-in
[8bb63d003f]
at
2004-07-31 02:00:26
on branch origin/master
— Started modifying to write ibg.m
- only writes component connection data so far.Found a bug in abg.m generation (not fixed)
- anonymous components are not written to cmp.txt (user: geraint@users.sourceforge.net, size: 23450) [annotate] [blame] [check-ins using] [more...]
To Artifact [193803410a]:
- Executable file mttroot/mtt/bin/trans/dia2abg.pl — part of check-in [16dc8250f3] at 2004-07-31 22:51:55 on branch origin/master — Writes causality information to ibg.m. (user: geraint@users.sourceforge.net, size: 24941) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
85 86 87 88 89 90 91 | #----------------------------MAIN PROGRAM------------------------------------ use strict; use Getopt::Long; use XML::DOM; my (%component_id_tag, %bond_id_start_id, %bond_id_end_id, %component_label_data, $objects, %mtt_bond_id_index, | | > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #----------------------------MAIN PROGRAM------------------------------------ use strict; use Getopt::Long; use XML::DOM; my (%component_id_tag, %bond_id_start_id, %bond_id_end_id, %component_label_data, $objects, %mtt_bond_id_index, %bond_id_arrow_on_start, %bond_id_flow_causality, %bond_id_effort_causality, %bond_id_start_label,%bond_id_end_label); # Parse user options: my $diagram_name = ''; my $dia_input_file = ''; my $dia_output_file = ''; my $label_file = ''; my $component_list_file = ''; |
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 | sub output_ibg { my (%components,$key,$component,$type,$name, %reverse_mtt_bond_id_index,$mtt_bond_id,$dia_bond_id, @bonds, $bond_id,$start,$end,$id, $head,$head_component,$head_type,$head_name, $tail,$tail_component,$tail_type,$tail_name, $anon_id); # copy component_id_tag and assign names to anonymous components %components = %component_id_tag; $anon_id = 0; while (($id, $component) = each(%components)) { | > > > | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | sub output_ibg { my (%components,$key,$component,$type,$name, %reverse_mtt_bond_id_index,$mtt_bond_id,$dia_bond_id, @bonds, $bond_id,$start,$end,$id, $head,$head_component,$head_type,$head_name, $tail,$tail_component,$tail_type,$tail_name, $start_label,$end_label, $head_label,$tail_label, $effort_causality,$flow_causality, $anon_id); # copy component_id_tag and assign names to anonymous components %components = %component_id_tag; $anon_id = 0; while (($id, $component) = each(%components)) { |
︙ | ︙ | |||
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | if ($bond_id_arrow_on_start{$dia_bond_id}) { $head = $end; $tail = $start; } else { $head = $start; $tail = $end; } $head_component = $components{$head}; $tail_component = $components{$tail}; print OUT " ## bond $mtt_bond_id \n" . " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "head.component = \"${head_component}\";\n" . " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "tail.component = \"${tail_component}\";\n"; print OUT " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | if ($bond_id_arrow_on_start{$dia_bond_id}) { $head = $end; $tail = $start; } else { $head = $start; $tail = $end; } $start_label = $bond_id_start_label{$dia_bond_id}; $end_label = $bond_id_end_label {$dia_bond_id}; $start_label =~ s/\#//g; $end_label =~ s/\#//g; if ($bond_id_arrow_on_start{$dia_bond_id}) { $head_label = $end_label; $tail_label = $start_label; } else { $head_label = $start_label; $tail_label = $end_label; } $head_component = $components{$head}; $tail_component = $components{$tail}; $effort_causality = $bond_id_effort_causality{$dia_bond_id}; $flow_causality = $bond_id_flow_causality {$dia_bond_id}; for ($effort_causality) { if (/-1/) { $effort_causality = "tail";} if (/0/) { $effort_causality = "none";} if (/1/) { $effort_causality = "head";} } for ($flow_causality) { if (/-1/) { $flow_causality = "tail";} if (/0/) { $flow_causality = "none";} if (/1/) { $flow_causality = "head";} } print OUT " ## bond $mtt_bond_id \n" . " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "head.component = \"${head_component}\";\n" . " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "tail.component = \"${tail_component}\";\n"; print OUT " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "head.ports = \"$head_label\";\n" . " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "tail.ports = \"$tail_label\";\n"; print OUT " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "causality.effort = \"$effort_causality\";\n" . " ${diagram_name}.bonds.bond${mtt_bond_id_index{$dia_bond_id}}." . "causality.flow = \"$flow_causality\";\n\n"; } output_ibg_footer(); } sub output_bond_causality { my ($mtt_bond_id,$dia_bond_id,$mtt_flow_causality,$mtt_effort_causality, |
︙ | ︙ | |||
548 549 550 551 552 553 554 555 556 557 558 559 560 561 | $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "effort_causality"); change_causality($id_index, $attribute, $change_effort_causality); $bond_id_effort_causality{$id} = defined($attribute) ? get_dia_attribute_value("dia:enum",$attribute)-1 : 1; $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "flow_causality"); change_causality($id_index, $attribute, $change_flow_causality); $bond_id_flow_causality{$id} = defined($attribute) ? get_dia_attribute_value("dia:enum",$attribute)-1 : 1; } sub change_causality() { my ($id_index, $attribute_node, $causality_change_string)=@_; my ($mtt_id, $arrow_oriented_causality); foreach my $id_causality (split(/;/,$causality_change_string)) { | > > > > > > > > > | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "effort_causality"); change_causality($id_index, $attribute, $change_effort_causality); $bond_id_effort_causality{$id} = defined($attribute) ? get_dia_attribute_value("dia:enum",$attribute)-1 : 1; $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "flow_causality"); change_causality($id_index, $attribute, $change_flow_causality); $bond_id_flow_causality{$id} = defined($attribute) ? get_dia_attribute_value("dia:enum",$attribute)-1 : 1; # $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "start_label"); # $bond_id_start_label{$id} = defined($attribute) ? get_dia_attribute_value("dia:string") : "[]"; $bond_id_start_label{$id} = "[]"; # FIXME! # $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "end_label"); # $bond_id_end_label{$id} = defined($attribute) ? get_dia_attribute_value("dia:string") : "[]"; $bond_id_end_label{$id} = "[]"; # FIXME! } sub change_causality() { my ($id_index, $attribute_node, $causality_change_string)=@_; my ($mtt_id, $arrow_oriented_causality); foreach my $id_causality (split(/;/,$causality_change_string)) { |
︙ | ︙ |