Overview
| Comment: | Writes anonymous components (except junctions) to cmp.txt and then assigns names to them. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
a828e952873a1c6eca1dcec6d02f5208 |
| User & Date: | geraint@users.sourceforge.net on 2004-08-01 22:07:14.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2004-08-02
| ||
| 06:55:01 | Handles repetitions (cmp.txt, ibg.m and abg.m) check-in: 8882cbd39e user: geraint@users.sourceforge.net tags: origin/master, trunk | |
|
2004-08-01
| ||
| 22:07:14 | Writes anonymous components (except junctions) to cmp.txt and then assigns names to them. check-in: a828e95287 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
| 20:13:30 | ibg2abg transformation does not require lbl.txt (directly) check-in: b58a6177cf user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/dia2abg.pl
from [38d24fda44]
to [631b1db315].
| ︙ | |||
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | + | 'dia_input_file=s' => \$dia_input_file, 'dia_output_file=s' => \$dia_output_file, 'label_file=s' => \$label_file, 'component_list_file=s' => \$component_list_file, 'debug' => \$debug, 'create_component_list' => \$create_component_list, 'create_abg' => \$create_abg, 'create_ibg' => \$create_ibg, 'abg_file=s' => \$abg_file, 'ibg_file=s' => \$ibg_file, 'change_flow_causality=s' => \$change_flow_causality, 'change_effort_causality=s' => \$change_effort_causality, ); die usage() if $diagram_name eq ''; |
| ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | + + + |
my $dom = new XML::DOM::Parser;
my ($doc);
$doc = $dom->parsefile($dia_input_file);
$objects = get_objects_node($doc,"Bond Graph");
get_component_data($objects);
get_bond_data($objects);
create_component_list() if ($create_component_list);
name_anonymous_components();
if ($create_abg) {
open (OUT,">$abg_file") ||
die "Cannot open $abg_file for writing.\n";
# Don't update the label file unless we are creating component list and abg simultaneously...
if ($create_component_list) {
print STDERR "WARNING: Label file may be stale.\n"
|
| ︙ | |||
176 177 178 179 180 181 182 | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + - + + + + + - + |
}
exit 0;
#----------------------------SUBROUTINES-------------------------------------
sub create_component_list {
|
| ︙ | |||
407 408 409 410 411 412 413 | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | - + - + - - - - - - - - - - - - - - - |
$i++;
}
}
print OUT "\n";
}
sub output_ibg {
|
| ︙ | |||
476 477 478 479 480 481 482 | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | - - + + |
$head_label = $end_label;
$tail_label = $start_label;
} else {
$head_label = $start_label;
$tail_label = $end_label;
}
|
| ︙ | |||
555 556 557 558 559 560 561 562 563 564 565 566 567 568 | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | + + + + + + + + + + + + + + + + |
$strattr = get_first_subnode_by_nodename_attribute(0,$comp,"dia:attribute","name","string");
$str_elem = get_first_element_subnode($strattr);
$string = get_first_text_subnode($str_elem);
$component_id_tag{$id} = $string->getData;
}
die "There are no components!\n" unless keys(%component_id_tag) > 0;
}
sub name_anonymous_components {
my ($id, $component, $type, $name, $anon_id);
$anon_id = 0;
while (($id, $component) = each(%component_id_tag)) {
$_ = $component;
id_cleaner();
$component = $_;
($type, $name) = split (/:/, $component);
if (! $name) {
$component = "${component}:mtt${component}_${anon_id}";
$anon_id++;
}
$component_id_tag{$id} = $component;
}
}
# Dia stores its attributes in a strange way, not using typical xml attributes.
sub get_dia_attribute_value {
my ($type, $attribute_node )= @_;
my ($subnode);
$subnode = get_first_subnode_by_nodename_attribute(0,$attribute_node,$type);
|
| ︙ |