Differences From Artifact [d84745ea9f]:
- Executable file
mttroot/mtt/bin/trans/dia2abg.pl
— part of check-in
[d9925398f4]
at
2002-12-04 12:22:53
on branch origin/master
— dia2abg.pl now has option abg_file which default to $sys_abg.m
instead of stdout. Made appropriate changes in
abg2cmp_dia2txt and abg_dia2m.dia usage() now print usage without error message. (user: david-hoover@users.sourceforge.net, size: 18372) [annotate] [blame] [check-ins using] [more...]
To Artifact [4fe08566f1]:
- Executable file mttroot/mtt/bin/trans/dia2abg.pl — part of check-in [ddde0b4981] at 2002-12-04 13:24:16 on branch origin/master — Added code to distinguish Ports from Components. (user: david-hoover@users.sourceforge.net, size: 18922) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
282 283 284 285 286 287 288 | # Subsystems and Ports EOF } sub output_component { | | > > > > | | | | | | | | > | > > | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | # Subsystems and Ports EOF } sub output_component { my ($NM,$type,$cr,$arg,$rep,$stat,$connections,$subsys_or_port) = @_; $_=$NM; remove_brackets(); $NM = $_; my $pretty_name = ($subsys_or_port eq "ports") ? "Port" : "Component"; print OUT <<"EOF"; # $pretty_name $NM ${diagram_name}.${subsys_or_port}.${NM}.type = "$type"; ${diagram_name}.${subsys_or_port}.${NM}.cr = "$cr"; ${diagram_name}.${subsys_or_port}.${NM}.arg = "$arg"; ${diagram_name}.${subsys_or_port}.${NM}.repetitions = $rep; ${diagram_name}.${subsys_or_port}.${NM}.status = $stat; ${diagram_name}.${subsys_or_port}.${NM}.connections = [$connections]; EOF } # This sort function allows components to be sorted in same order as # label file, and alphabetically for components not in label file. sub by_label_file { my ($a_index,$b_index); $a_index = $component_label_data{id_to_name($a)}[0]; $b_index = $component_label_data{id_to_name($b)}[0]; $a_index = 1e9 unless defined($a_index); $b_index = 1e9 unless defined($b_index); return ($a_index <=> $b_index) || ($a_index cmp $b_index); } sub output_abg { my ($cr,$rep,$stat,$NM,$type,$arg,$bond_id,$start,$end,@clist,$connections, $strlength,$subsys_or_port); print_debug("WRITING OUTPUT TO STDIO...\n"); $rep = "1"; $stat = "-1"; output_abg_header(); foreach my $id (keys(%component_id_tag)) { ($subsys_or_port,$_) = id_to_name($id); remove_brackets(); $NM = $_; $type = id_to_type($id); $cr = "" unless defined($cr = $component_label_data{$NM}[1]); $arg = "" unless defined($arg = $component_label_data{$NM}[2]); @clist = (); while (($bond_id,$start) = each(%bond_id_start_id)) { push(@clist, -get_sign_of_power($bond_id) * $mtt_bond_id_index{$bond_id}) if $start eq $id; } while (($bond_id,$end) = each(%bond_id_end_id)) { push(@clist, get_sign_of_power($bond_id) * $mtt_bond_id_index{$bond_id}) if $end eq $id; } $connections = join(" ",@clist); output_component($NM,$type,$cr,$arg,$rep,$stat,$connections,$subsys_or_port); } print OUT "# Ordered list of subsystem names\n"; # order component id's so that entries found in _lbl.txt file are # in _lbl file order, and other entries follow. my (@id_list); @id_list = keys(%component_id_tag); |
︙ | ︙ | |||
547 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 | die " I found no text subnode of " . $node->getNodeName . "." unless $subnode->getNodeType == TEXT_NODE; } sub id_cleaner { s/#?([^#]*)#?/$1/; } sub id_to_type { my ( $id )= @_; my($type,$name); $_ = $component_id_tag{$id}; id_cleaner(); ($type, $name) = split(/:/); return $type; } sub id_to_name { my ( $id )= @_; my($type,$name); $_ = $component_id_tag{$id}; id_cleaner(); ($type, $name) = split(/:/); if(!defined($name)) { $name = $id }; | > > > > > > | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | die " I found no text subnode of " . $node->getNodeName . "." unless $subnode->getNodeType == TEXT_NODE; } sub id_cleaner { s/#?([^#]*)#?/$1/; } sub remove_brackets { s/^\[([^\]]*)\]$/$1/; } sub id_to_type { my ( $id )= @_; my($type,$name); $_ = $component_id_tag{$id}; id_cleaner(); ($type, $name) = split(/:/); return $type; } # If 1 LHS argument is used, it returns component name. If 2 are used, it return # "subsystem" or "port" depending on whether brackets are found in the name. sub id_to_name { my ( $id )= @_; my($type,$name); $_ = $component_id_tag{$id}; id_cleaner(); ($type, $name) = split(/:/); if(!defined($name)) { $name = $id }; return ( ($name =~ /^\[[^\]]*\]$/ ? "ports" : "subsystems" ),$name); } sub print_debug { print STDERR $_[0] if ($debug); } sub usage { |
︙ | ︙ |