Subversion Repositories DevTools

Rev

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

Rev 261 Rev 263
Line 51... Line 51...
51
    @EXPORT      = qw(ErrorConfig ErrorDoExit
51
    @EXPORT      = qw(ErrorConfig ErrorDoExit
52
                      ReportError Fatal Error Warning
52
                      ReportError Fatal Error Warning
53
                      Message Message1
53
                      Message Message1
54
                      Information Information1
54
                      Information Information1
55
                      Question
55
                      Question
56
                      Verbose Verbose2 Verbose3
56
                      Verbose0 Verbose Verbose2 Verbose3
57
                      Debug0 Debug Debug2 Debug3
57
                      Debug0 Debug Debug2 Debug3
58
                      IsVerbose IsDebug IsQuiet
58
                      IsVerbose IsDebug IsQuiet
59
                      DebugDumpData DebugDumpPackage DebugTraceBack
59
                      DebugDumpData DebugDumpPackage DebugTraceBack
60
                      DebugPush DebugPop
60
                      DebugPush DebugPop
61
                      );
61
                      );
Line 67... Line 67...
67
    @EXPORT_OK   = qw();
67
    @EXPORT_OK   = qw();
68
 
68
 
69
    #
69
    #
70
    #   Ensure globals have a defined value
70
    #   Ensure globals have a defined value
71
    #
71
    #
72
    $::ScmWho = ''      unless defined( $::ScmWho );
72
    $::ScmWho = ''                          unless defined( $::ScmWho );
73
    $::ScmVerbose = 0   unless defined( $::ScmVerbose );
73
    $::ScmVerbose = $ENV{GBE_VERBOSE} || 0  unless defined( $::ScmVerbose );
74
    $::ScmDebug = 0     unless defined( $::ScmDebug );
74
    $::ScmDebug = $ENV{GBE_DEBUG} || 0      unless defined( $::ScmDebug );
75
    $::ScmQuiet = 0     unless defined( $::ScmQuiet );
75
    $::ScmQuiet = 0                         unless defined( $::ScmQuiet );
76
 
76
 
77
    #
77
    #
78
    #   Force autoflush in an attempt to limit the intermingling of
78
    #   Force autoflush in an attempt to limit the intermingling of
79
    #   Error and non-error output.
79
    #   Error and non-error output.
80
    #
80
    #
Line 464... Line 464...
464
        exit $ScmExitCode;
464
        exit $ScmExitCode;
465
    }
465
    }
466
}
466
}
467
 
467
 
468
#-------------------------------------------------------------------------------
468
#-------------------------------------------------------------------------------
-
 
469
# Function        : ArgsToString
-
 
470
#
-
 
471
# Description     : Convert an array of arguments to a string
-
 
472
#                   Main purpose is to allow Debug and Verbose
-
 
473
#                   calls to pass undef values without causing warnings
-
 
474
#
-
 
475
# Inputs          : REF to a list of scalar values
-
 
476
#                   Passing a REF is faster
-
 
477
#
-
 
478
# Returns         : A string
-
 
479
#
-
 
480
sub ArgsToString
-
 
481
{
-
 
482
    my $result = '';
-
 
483
 
-
 
484
    $result .= (defined ($_) ? $_ : '\'undef\'') . ' ' foreach  ( @{$_[0]} );
-
 
485
    return $result;
-
 
486
}
-
 
487
 
-
 
488
#-------------------------------------------------------------------------------
469
# Function        : Verbose
489
# Function        : Verbose0
-
 
490
#                   Verbose
470
#                   Verbose2
491
#                   Verbose2
471
#                   Verbose3
492
#                   Verbose3
472
#
493
#
473
# Description     : Various levels of progress reporting
494
# Description     : Various levels of progress reporting
474
#                   By default none are displayed
495
#                   By default none are displayed
475
#
496
#
476
# Inputs          : A single line string
497
# Inputs          : A single line string
477
#                   Multi-line output is not supported
498
#                   Multi-line output is not supported
-
 
499
#                   Arguments will be processed such that undef is handled well
478
#
500
#
-
 
501
sub Verbose0
-
 
502
{
-
 
503
    _Message '------', ArgsToString (\@_);
-
 
504
}
479
sub Verbose
505
sub Verbose
480
{
506
{
481
    _Message '(V)', "@_" if ($::ScmVerbose);
507
    _Message '(V)', ArgsToString (\@_) if ($::ScmVerbose);
482
}
508
}
483
 
509
 
484
sub Verbose2
510
sub Verbose2
485
{
511
{
486
    _Message '(V)', "@_" if ($::ScmVerbose >= 2);
512
    _Message '(V)', ArgsToString (\@_) if ($::ScmVerbose >= 2);
487
}
513
}
488
 
514
 
489
sub Verbose3
515
sub Verbose3
490
{
516
{
491
    _Message '(V)', "@_" if ($::ScmVerbose >= 3);
517
    _Message '(V)', ArgsToString (\@_) if ($::ScmVerbose >= 3);
492
}
518
}
493
 
519
 
494
sub IsVerbose
520
sub IsVerbose
495
{
521
{
496
    my( $level) = @_;
522
    my( $level) = @_;
Line 507... Line 533...
507
# Description     : Various levels of debug reporting
533
# Description     : Various levels of debug reporting
508
#                   By default none are displayed
534
#                   By default none are displayed
509
#
535
#
510
# Inputs          : A single line string
536
# Inputs          : A single line string
511
#                   Multi-line output is not supported
537
#                   Multi-line output is not supported
-
 
538
#                   Arguments will be processed such that undef is handled well
512
#
539
#
513
sub Debug0
540
sub Debug0
514
{
541
{
515
    _Message '------', "@_";
542
    _Message '------', ArgsToString (\@_);
516
}
543
}
517
 
544
 
518
sub Debug
545
sub Debug
519
{
546
{
520
    _Message '(D)', "@_" if ($::ScmDebug >= 1) ;
547
    _Message '(D)', ArgsToString (\@_) if ($::ScmDebug >= 1 ) ;
521
}
548
}
522
 
549
 
523
 
550
 
524
sub Debug2
551
sub Debug2
525
{
552
{
526
    _Message '(D)', "@_" if ($::ScmDebug >= 2) ;
553
    _Message '(D)', ArgsToString (\@_) if ($::ScmDebug >= 2) ;
527
}
554
}
528
 
555
 
529
 
556
 
530
sub Debug3
557
sub Debug3
531
{
558
{
532
    _Message '(D)', "@_" if ($::ScmDebug >= 3) ;
559
    _Message '(D)', ArgsToString (\@_) if ($::ScmDebug >= 3) ;
533
}
560
}
534
 
561
 
535
sub IsDebug
562
sub IsDebug
536
{
563
{
537
    my( $level) = @_;
564
    my( $level) = @_;