| 1 |
# ======= Utilities for printing warning/error messages, etc ========= |
| 2 |
# Author: Tom Payerle <[email protected]> |
| 3 |
|
| 4 |
#-------------------------------------------------------------------- |
| 5 |
# PrintIfLoading: |
| 6 |
# |
| 7 |
# Prints supplied text to stderr but only if in "load" mode |
| 8 |
proc PrintIfLoading { args } { |
| 9 |
if [ module-info mode load ] { |
| 10 |
set tmp [ join $args ] |
| 11 |
puts stderr "$tmp" |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
#-------------------------------------------------------------------- |
| 16 |
# PrintLoadInfo: |
| 17 |
# |
| 18 |
# Prints supplied text to stderr as informational message, but only |
| 19 |
# if actually trying to load the module. |
| 20 |
proc PrintLoadInfo { args } { |
| 21 |
set tmp [ join $args ] |
| 22 |
PrintIfLoading " |
| 23 |
\[INFO\] $tmp |
| 24 |
" |
| 25 |
} |
| 26 |
|
| 27 |
#-------------------------------------------------------------------- |
| 28 |
# PrintLoadWarning: |
| 29 |
# |
| 30 |
# Prints supplied text to stderr as warning message, but only |
| 31 |
# if actually trying to load the module. |
| 32 |
proc PrintLoadWarning { args } { |
| 33 |
set tmp [ join $args ] |
| 34 |
PrintIfLoading " |
| 35 |
WARNING: |
| 36 |
$tmp |
| 37 |
|
| 38 |
" |
| 39 |
} |
| 40 |
|
| 41 |
#-------------------------------------------------------------------- |
| 42 |
# PrintLoadError: |
| 43 |
# |
| 44 |
# Like PrintLoadWarning, but as error message and does a "break" |
| 45 |
proc PrintLoadError { args } { |
| 46 |
set tmp [ join $args ] |
| 47 |
PrintIfLoading " |
| 48 |
**** ERROR *****: |
| 49 |
$tmp |
| 50 |
|
| 51 |
" |
| 52 |
if [ module-info mode load ] { |
| 53 |
break |
| 54 |
} |
| 55 |
} |