Subversion Repositories DevTools

Rev

Rev 6276 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6276 Rev 6504
Line 157... Line 157...
157
#
157
#
158
# Inputs          : A hash of option,value pairs
158
# Inputs          : A hash of option,value pairs
159
#                   Valid options
159
#                   Valid options
160
#                       name        - Name to report in error
160
#                       name        - Name to report in error
161
#                       function    - Name of enclosing function
161
#                       function    - Name of enclosing function
162
#                       prefix      - 1st line prefix
-
 
163
#                       verbose     - vebosity level
162
#                       verbose     - vebosity level
164
#                       debug       - debug level
163
#                       debug       - debug level
165
#                       on_exit     - Register on-exit function
164
#                       on_exit     - Register on-exit function
166
#                       delay_exit  - Delay exit on error
165
#                       delay_exit  - Delay exit on error
167
#                       prefix      - Optional prefix. First line only
166
#                       prefix      - Optional prefix. First line only
Line 610... Line 609...
610
# Function        : ArgsToString
609
# Function        : ArgsToString
611
#
610
#
612
# Description     : Convert an array of arguments to a string
611
# Description     : Convert an array of arguments to a string
613
#                   Main purpose is to allow Debug and Verbose
612
#                   Main purpose is to allow Debug and Verbose
614
#                   calls to pass undef values without causing warnings
613
#                   calls to pass undef values without causing warnings
-
 
614
#                   
-
 
615
#                   Put all args on one line, unless '++' is encountered
-
 
616
#                   This will force one arg per line mode
615
#
617
#
616
# Inputs          : REF to a list of scalar values
618
# Inputs          : REF to a list of scalar values
617
#                   Passing a REF is faster
619
#                   Passing a REF is faster
618
#
620
#
619
# Returns         : A string
621
# Returns         : A string. May be empty, but will be defined
620
#
622
#
621
sub ArgsToString
623
sub ArgsToString
622
{
624
{
623
    my $result = '';
625
    my @result;
-
 
626
    my $mode;
-
 
627
    foreach ( @{$_[0]} ) {
-
 
628
        my $item = defined($_) ? $_ : '\'undef\'';
-
 
629
        if ( $item eq '++' ) {
-
 
630
            @result = join (' ', @result);
-
 
631
            $mode = 1;
-
 
632
        } else {
-
 
633
            push @result, $item;
-
 
634
        }
-
 
635
    }
-
 
636
 
-
 
637
    unless ($mode) {
-
 
638
        @result = join (' ', @result);
-
 
639
    }
624
 
640
 
625
    $result .= (defined ($_) ? $_ : '\'undef\'') . ' ' foreach  ( @{$_[0]} );
641
    push @result, '' unless @result;
626
    return $result;
642
    return @result;
627
}
643
}
628
 
644
 
629
#-------------------------------------------------------------------------------
645
#-------------------------------------------------------------------------------
630
# Function        : Verbose0
646
# Function        : Verbose0
631
#                   Verbose
647
#                   Verbose
Line 634... Line 650...
634
#
650
#
635
# Description     : Various levels of progress reporting
651
# Description     : Various levels of progress reporting
636
#                   By default none are displayed
652
#                   By default none are displayed
637
#
653
#
638
# Inputs          : A single line string
654
# Inputs          : A single line string
639
#                   Multi-line output is not supported
655
#                   Multi-line output is supported after arg that is '++'
640
#                   Arguments will be processed such that undef is handled well
656
#                   Arguments will be processed such that undef is handled well
641
#
657
#
642
sub Verbose0
658
sub Verbose0
643
{
659
{
644
    _Message '------', ArgsToString (\@_);
660
    _Message '------', ArgsToString (\@_);
Line 673... Line 689...
673
#
689
#
674
# Description     : Various levels of debug reporting
690
# Description     : Various levels of debug reporting
675
#                   By default none are displayed
691
#                   By default none are displayed
676
#
692
#
677
# Inputs          : A single line string
693
# Inputs          : A single line string
678
#                   Multi-line output is not supported
694
#                   Multi-line output is supported after arg that is '++'
679
#                   Arguments will be processed such that undef is handled well
695
#                   Arguments will be processed such that undef is handled well
680
#
696
#
681
sub Debug0
697
sub Debug0
682
{
698
{
683
    _Message '------', ArgsToString (\@_);
699
    _Message '------', ArgsToString (\@_);