Overview
Comment: | Sorts by type:name within categories: ports, components, 0, 1 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
649ef6492ad2e4d391e1b75603ad3e20 |
User & Date: | geraint@users.sourceforge.net on 2004-08-05 09:07:51 |
Other Links: | branch diff | manifest | tags |
Context
2004-08-09
| ||
14:44:41 | Compatible with Octave 2.1.57 check-in: 2179807639 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
2004-08-05
| ||
09:07:51 | Sorts by type:name within categories: ports, components, 0, 1 check-in: 649ef6492a user: geraint@users.sourceforge.net tags: origin/master, trunk | |
01:42:49 | Sorts components alphabetically within categories: internal ports, components, 0, 1. check-in: 3e3724adcd user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/dia2abg.pl from [144666cf03] to [6be8b310ce].
︙ | ︙ | |||
99 100 101 102 103 104 105 | my $dia_input_file = ''; my $dia_output_file = ''; my $label_file = ''; my $component_list_file = ''; my $debug = 0; my $create_component_list = 0; my $create_abg = 0; | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | my $dia_input_file = ''; my $dia_output_file = ''; my $label_file = ''; my $component_list_file = ''; my $debug = 0; my $create_component_list = 0; my $create_abg = 0; my $create_ibg = 0; my $abg_file = ''; my $ibg_file = ''; my $change_flow_causality = ''; my $change_effort_causality = ''; GetOptions ('diagram_name=s' => \$diagram_name, 'dia_input_file=s' => \$dia_input_file, 'dia_output_file=s' => \$dia_output_file, |
︙ | ︙ | |||
332 333 334 335 336 337 338 | ${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 } | | | > > | > > | > > | | | > > | > > > > > > > > > > > > > > > > > > > > | | > > > > > > | | 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 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | ${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 } sub sort_components { my ($type1, $str1, $subsys_or_port1, $type2, $str2, $subsys_or_port2, $retval); $type1 = $component_id_type{$a}; $type2 = $component_id_type{$b}; $str1 = $component_id_tag{$a}; $str2 = $component_id_tag{$b}; ($subsys_or_port1, $_) = id_to_name($a); ($subsys_or_port2, $_) = id_to_name($b); print "${str1}: ${subsys_or_port1}\n"; print "${str2}: ${subsys_or_port2}\n"; # 1 junctions go last if (($type1 eq '1') and ($type2 ne '1')) { $retval = +1; } elsif (($type1 ne '1') and ($type2 eq '1')) { $retval = -1; # 0 junctions go before them } elsif (($type1 eq '0') and ($type2 ne '0')) { $retval = +1; } elsif (($type1 ne '0') and ($type2 eq '0')) { $retval = -1; # ports go first } elsif (($subsys_or_port1 ne 'ports') and ($subsys_or_port2 eq 'ports')) { $retval = +1; } elsif (($subsys_or_port1 eq 'ports') and ($subsys_or_port2 ne 'ports')) { $retval = -1; # sort by type:name } else { $retval = ($str1 cmp $str2); } return $retval; } 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"); $stat = "-1"; output_abg_header(); # order component id's alphabetically by (type:name) my (@id_list); @id_list = keys (%component_id_tag); @id_list = sort sort_components @id_list; foreach my $id (@id_list) { ($subsys_or_port,$_) = id_to_name($id); remove_brackets(); $NM = $_; $type = $component_id_type{$id}; $cr = "" unless defined($cr = $component_label_data{$NM}[1]); $arg = "" unless defined($arg = $component_label_data{$NM}[2]); |
︙ | ︙ | |||
379 380 381 382 383 384 385 | $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); } | < < < < < < | | | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | $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); } # calculate string length of longest component name (for octave): $strlength=0; foreach my $id (@id_list) { my $name = id_to_name($id); $strlength = length($name) if length($name) > $strlength; }; print OUT "# Ordered list of Port names\n"; my $i=1; foreach my $id (@id_list) { my ($subsys_or_port,$name) = id_to_name($id); |
︙ | ︙ |