Index: mttroot/mtt/bin/trans/ese_r2make.pl ================================================================== --- mttroot/mtt/bin/trans/ese_r2make.pl +++ mttroot/mtt/bin/trans/ese_r2make.pl @@ -47,10 +47,15 @@ $outfile = "${sys}_ese.make" if ($outfile eq ''); #------------------------------------------------------------------------------- # main #------------------------------------------------------------------------------- + +if ($debug) { + my $logfile = "ese_r2make_${sys}.log"; + open (LOG, ">$logfile") or die ("MTT: ese_r2make, cannot open $logfile"); +} # First the elementary system equations are read # and placed in the "expressions" hash. read_ese_r (); @@ -61,10 +66,11 @@ # Finally the expressions are written to a makefile # where the targets are the left hand values and the # pre-requisites are the dependencies write_make ($sys); +close (LOG) if ($debug); #------------------------------------------------------------------------------- # subroutines #------------------------------------------------------------------------------- sub read_ese_r { @@ -85,11 +91,11 @@ # separate the left and right side of equations # and assign them to the expressions hash my ($lvar,$expr) = split (/:=/); $expressions{$lvar} = $expr; - print "$lvar\t= $expressions{$lvar}\n" if $debug; + print LOG "$lvar\t= $expressions{$lvar}\n" if $debug; } close (ESE); } #------------------------------------------------------------------------------- @@ -104,11 +110,11 @@ # a left value has been found in the expression # add it to the dependencies for this lvar $dependencies{$lvar} = "$dependencies{$lvar} $lvar2"; } } - print "$lvar:\t$dependencies{$lvar}\n" if $debug; + print LOG "$lvar:\t$dependencies{$lvar}\n" if $debug; } } #------------------------------------------------------------------------------- sub write_make { Index: mttroot/mtt/bin/trans/lbl2cmp_txt2m.pl ================================================================== --- mttroot/mtt/bin/trans/lbl2cmp_txt2m.pl +++ mttroot/mtt/bin/trans/lbl2cmp_txt2m.pl @@ -45,10 +45,15 @@ GetOptions ('sys=s' => \$sys, 'debug' => \$debug); die usage() if ($sys eq ''); + +if ($debug) { + my $logfile = "lbl2cmp_txt2m_${sys}.log"; + open (LOG, ">$logfile") or die ("MTT: lbl2cmp_txt2m, cannot open $logfile"); +} $cmp = "${sys}_cmp.txt"; $lbl = "${sys}_lbl.txt"; $out = "${sys}_cmp.m"; @@ -56,10 +61,11 @@ read_lbl_file(); sort_components(); write_header(); write_body(); +close (LOG) if ($debug); sub usage() { return "Usage: lbl2cmp_txt2m --sys=\n"; } @@ -78,11 +84,11 @@ next if (/^(\s)*[%\#]/); # remove leading and trailing whitespace s/^\s*(\S.*\S)\s*$/$1/; $line = $_; - print "read_cmp_file: line='${line}'\n" if ($debug); + print LOG "read_cmp_file: line='${line}'\n" if ($debug); # cmp provides type, name and repetition information # class is inferred from type and name # (cr and args are placeholders) @@ -113,11 +119,11 @@ } $name = '' unless defined $name; $rep = 1 unless defined $rep; - print "read_cmp_line: type='$type', name='$name', rep='$rep'\n" if ($debug); + print LOG "read_cmp_line: type='$type', name='$name', rep='$rep'\n" if ($debug); return ($type, $name, $rep); } sub name_anonymous_component() { my $type = $_; @@ -127,11 +133,11 @@ $name = "mtt${type}_${num}"; } else { $anonymous_component_type_index{$type} = 1; $name = "mtt${type}"; } - print "name_anonymous_component: type='${type}', name='${name}'\n" if ($debug); + print LOG "name_anonymous_component: type='${type}', name='${name}'\n" if ($debug); return ($name); } sub port_or_component_or_junction() { @@ -153,11 +159,11 @@ } elsif ($type eq "1") { $retval = "1junction"; } else { $retval = "component"; } - print "port_or_component_or_junction: type='$type', name='$name' class='$retval'\n" if ($debug); + print LOG "port_or_component_or_junction: type='$type', name='$name' class='$retval'\n" if ($debug); return ($retval); } sub read_lbl_file() { my (@line, $name, $type, $cr, $arg, $i); @@ -200,11 +206,11 @@ $arg = shift (@line); $cr = '' unless defined ($cr); $arg = '' unless defined ($arg); - print "read_lbl_line: name='$name' cr='$cr' arg='$arg'\n" if ($debug); + print LOG "read_lbl_line: name='$name' cr='$cr' arg='$arg'\n" if ($debug); return ($name, $cr, $arg); } sub write_header() { my $date = `date`; @@ -237,11 +243,11 @@ for $name (@sorted_list) { $class = $component_class{$name}; if ($class eq $target) { if (! defined ($sorted_component_list{$name})) { $sorted_component_list{$name} = $i++; - print "sorted: '$name' '$i'\n" if ($debug); + print LOG "sorted: '$name' '$i'\n" if ($debug); } } } } }