yeah..u r right. I have not posted the complete code. I an doing that now:
sub find_range
{
my $max=$_[0];
my $min=$_[1];
my $step=$_[2];
my @step_part;
my $range;
$dec_lolmt=0;
# for avoiding positive offset in compu method any min data gr
+eater than zero is made equal to zero.
if ($min>0)
{
$dec_lolmt=$min;
$min=0;
print OUT_LOG "WARNING: minimum physical value found to be
+ positive for $name and is reduced to zero \n";
}
my @step_part=split(/\//,$step);
if($step_part[1]=~ /^[0-9]/)
{
$step_real=$step_part[0]/$step_part[1];
}
else
{
$step_real=$step_part[0];
}
# check for proper value of range could be returned or not
if((!($step_real=~ /^[0-9]/))||($max==$min)||($step_real==0)|
+|(!($step_real =~ /^-?\d/)))
{
print OUT_LOG "WARNING: No proper range could be determine
+d for $name : default range returned as 255 \n";
$range = 255;
}
$range=($max-$min)/($step_real);
# check if range is feasible or not(range cannot be less than
+1)
if($range<1)
{
print OUT_LOG "WARNING: No proper range could be determine
+d for $name : defalult range returned as 255 \n";
$range = 255;
}
return($range);
}
The split is done to obtain the actual step values in cases where i read (say:100/65535) at step(read resolution).
the reading tagged data function is:
sub read_tagdata
{
my $tag_start= $_[0]; #read the start of the tag
my $tag_end=$_[1]; #read the end of the tag
my $temp_buffer_data= $_[2]; #read the tagged line
my @buffer_data_split;
$tag_error=($temp_buffer_data=~ s/$tag_start/;/);
$tag_error1=($temp_buffer_data=~ s/$tag_end/;/);
if (($tag_error==0) || ($tag_error1==0))
{
if(!($tag_start=~ /parameter/) && !($tag_start=~ /intern/)
+ && !($tag_start=~ /out/) && !($tag_start=~ /visu/))
{
print OUT_LOG "WARNING: No data found at $tag_start
+ $tag_end for $name_data \n";
$buffer_data_split[1]="UNKNOWN DATA";
}
}
else
{
@buffer_data_split= split(/;/,$temp_buffer_data);
}
return($buffer_data_split[1])
}
since i am very new to all this i thought that my code may seem stupid to u guys!! thats why i was hiding some part. But now I DONT CARE!!!! |