Overview
Comment:Writes port data (bond labels) to ibg.m
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 6e4a80f8ae482e76efa6a3d167e1c3896581265124f83ac228e77caec7c9e31f
User & Date: geraint@users.sourceforge.net on 2004-08-01 18:39:50
Other Links: branch diff | manifest | tags
Context
2004-08-01
19:47:59
New file. check-in: 801c05c7c8 user: geraint@users.sourceforge.net tags: origin/master, trunk
18:39:50
Writes port data (bond labels) to ibg.m check-in: 6e4a80f8ae user: geraint@users.sourceforge.net tags: origin/master, trunk
2004-07-31
22:51:55
Writes causality information to ibg.m. check-in: 5ae9f2bbec user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/dia2abg.pl from [193803410a] to [38d24fda44].

426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
    %components = %component_id_tag;

    $anon_id = 0;
    while (($id, $component) = each(%components)) {
	$component =~ s/\#//g;
	($type, $name) = split (/:/, $component);
	if (! $name) {
	    $component = "${component}:mtt${type}_${anon_id}";
	}
	$anon_id++;
	$components{$id} = $component;
    }

    output_ibg_header();








|







426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
    %components = %component_id_tag;

    $anon_id = 0;
    while (($id, $component) = each(%components)) {
	$component =~ s/\#//g;
	($type, $name) = split (/:/, $component);
	if (! $name) {
	    $component = "${component}:mtt${component}_${anon_id}";
	}
	$anon_id++;
	$components{$id} = $component;
    }

    output_ibg_header();

456
457
458
459
460
461
462


463


464





465
466
467
468
469
470
471
	    $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;







>
>
|
>
>
|
>
>
>
>
>







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
	    $head = $start;
	    $tail = $end;
	}

	$start_label = $bond_id_start_label{$dia_bond_id};
	$end_label   = $bond_id_end_label  {$dia_bond_id};

	# treat label as a comment if not enclosed by [ ]
	if ($start_label !~  /\[.*\]/) {
	    $start_label = "[]";
	}
	if ($end_label !~ /\[.*\]/) {
	    $end_label = "[]";
	}

	# ignore label if it is not enclosed by []
#	$start_label =~ s/[^[]*\[\([^]]*\)\]/[$1]/;
#	$end_label   =~ s/[^[]*\[\([^]]*\)\]/[$1]/;

	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;
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
597
598
599
600
601
602
    my ($type, $attribute_node, $new_value )= @_;
    my ($subnode);
    $subnode = get_first_subnode_by_nodename_attribute(0,$attribute_node,$type);

    $subnode->setAttribute(val => $new_value);
#    return $subnode->getAttributeNode("val")->getValue;
}










sub get_arrow_info {
    my ( $object_node, $id, $id_index )= @_;
    my($attribute,$attributes);

    $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "arrow_on_start");
    $bond_id_arrow_on_start{$id} = defined($attribute) ? get_dia_attribute_value("dia:boolean",$attribute) : 0;

    $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)) {







>
>
>
>
>
>
>
>
>
















|
|
<

|
|
<
<







574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607

608
609
610


611
612
613
614
615
616
617
    my ($type, $attribute_node, $new_value )= @_;
    my ($subnode);
    $subnode = get_first_subnode_by_nodename_attribute(0,$attribute_node,$type);

    $subnode->setAttribute(val => $new_value);
#    return $subnode->getAttributeNode("val")->getValue;
}

sub get_dia_attribute_string {
    my ($attribute) = @_;
    my ($str_elem, $string);
    $str_elem = get_first_element_subnode($attribute);
    $string = get_first_text_subnode($str_elem)->getData;
    $string =~ s/\#//g;
    return $string;
}

sub get_arrow_info {
    my ( $object_node, $id, $id_index )= @_;
    my($attribute,$attributes);

    $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "arrow_on_start");
    $bond_id_arrow_on_start{$id} = defined($attribute) ? get_dia_attribute_value("dia:boolean",$attribute) : 0;

    $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_string($attribute) : "[]";


    $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_string($attribute) : "[]";


}

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)) {


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]