Change several python and robot files to 110 chars
Taking advantage of current team limit of 110 chars.
Change-Id: If7ab51fe894889967b8c8bb2f2fa4664f01117d5
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/print.tcl b/lib/print.tcl
index 98cd051..3959088 100755
--- a/lib/print.tcl
+++ b/lib/print.tcl
@@ -1,7 +1,6 @@
#!/usr/bin/wish
-# This file provides many valuable print procedures such as sprint_var,
-# sprint_time, sprint_error, etc.
+# This file provides many valuable print procedures such as sprint_var, sprint_time, sprint_error, etc.
my_source [list data_proc.tcl call_stack.tcl]
@@ -9,14 +8,12 @@
package require Expect
-# Setting the following variables for use both inside this file and by
-# programs sourcing this file.
+# Setting the following variables for use both inside this file and by programs sourcing this file.
set program_path $argv0
set program_dir_path "[file dirname $argv0]/"
set program_name "[file tail $argv0]"
-# Some procedures (e.g. sprint_pgm_header) need a program name value that
-# looks more like a valid variable name. Therefore, we'll swap out odd
-# characters (like ".") for underscores.
+# Some procedures (e.g. sprint_pgm_header) need a program name value that looks more like a valid variable
+# name. Therefore, we'll swap out odd characters (like ".") for underscores.
regsub {\.} $program_name "_" pgm_name_var_name
# Initialize some time variables used in procedures in this file.
@@ -25,36 +22,33 @@
proc calc_wrap_stack_ix_adjust {} {
- # Calculate and return a number which can be used as an offset into the
- # call stack for wrapper procedures.
+ # Calculate and return a number which can be used as an offset into the call stack for wrapper procedures.
- # NOTE: This procedure is designed expressly to work with this file's print
- # procedures scheme (i.e. print_x is a wrapper for sprint_x, etc.). In
- # other words, this procedure may not be well-suited for general use.
+ # NOTE: This procedure is designed expressly to work with this file's print procedures scheme (i.e.
+ # print_x is a wrapper for sprint_x, etc.). In other words, this procedure may not be well-suited for
+ # general use.
- # Get a list of the procedures in the call stack beginning with our
- # immediate caller on up to the top-level caller.
+ # Get a list of the procedures in the call stack beginning with our immediate caller on up to the
+ # top-level caller.
set call_stack [get_call_stack -2]
# The first stack entry is our immediate caller.
set caller [lindex $call_stack 0]
# Remove first entry from stack.
set call_stack [lreplace $call_stack 0 0]
- # Strip any leading "s" to arrive at base_caller name (e.g. the
- # corresponding base name for "sprint_var" would be "print_var").
+ # Strip any leading "s" to arrive at base_caller name (e.g. the corresponding base name for "sprint_var"
+ # would be "print_var").
set base_caller [string trimleft $caller s]
- # Account for alias print procedures which have "p" vs "print_" (e.g. pvar
- # vs print_var).
+ # Account for alias print procedures which have "p" vs "print_" (e.g. pvar vs print_var).
regsub "print_" $base_caller "p" alias_base_caller
# Initialize the stack_ix_adjust value.
set stack_ix_adjust 0
- # Note: print_vars|pvars is a special case so we add it explicitly to the
- # regex below.
+ # Note: print_vars|pvars is a special case so we add it explicitly to the regex below.
set regex ".*(${base_caller}|${alias_base_caller}|print_vars|pvars)$"
foreach proc_name $call_stack {
- # For every remaining stack item that looks like a wrapper (i.e. matches
- # our regex), we increment the stack_ix_adjust.
+ # For every remaining stack item that looks like a wrapper (i.e. matches our regex), we increment the
+ # stack_ix_adjust.
if { [regexp -expanded $regex $proc_name]} {
incr stack_ix_adjust
continue
@@ -68,25 +62,23 @@
}
-# hidden_text is a list of passwords which are to be replaced with asterisks
-# by print procedures defined in this file.
+# hidden_text is a list of passwords which are to be replaced with asterisks by print procedures defined in
+# this file.
set hidden_text [list]
# password_regex is created from the contents of the hidden_text list above.
set password_regex ""
proc register_passwords {args} {
- # Register one or more passwords which are to be hidden in output produced
- # by the print procedures in this file.
+ # Register one or more passwords which are to be hidden in output produced by the print procedures in this
+ # file.
# Note: Blank password values are NOT registered. They are simply ignored.
# Description of argument(s):
- # args One or more password values. If a given
- # password value is already registered, this
- # procedure will simply ignore it, i.e.
- # there will be no duplicate values in the
- # hidden_text list.
+ # args One or more password values. If a given password value is already
+ # registered, this procedure will simply ignore it, i.e. there will be no
+ # duplicate values in the hidden_text list.
global hidden_text
global password_regex
@@ -108,14 +100,12 @@
proc replace_passwords {buffer} {
- # Replace all registered password found in buffer with a string of
- # asterisks and return the result.
+ # Replace all registered password found in buffer with a string of asterisks and return the result.
# Description of argument(s):
# buffer The string to be altered and returned.
- # Note: If environment variable GEN_PRINT_DEBUG is set, this procedure
- # will do nothing.
+ # Note: If environment variable GEN_PRINT_DEBUG is set, this procedure will do nothing.
global env
if { [get_var ::env(GEN_PRINT_DEBUG) 0] } { return $buffer }
@@ -141,9 +131,8 @@
# Description of argument(s):
# cmd_buf The command string to be run.
- # iterations The number of times to run the command
- # string. Typically, more iterations yields
- # more accurate results.
+ # iterations The number of times to run the command string. Typically, more
+ # iterations yields more accurate results.
print_issuing $cmd_buf
set result [time {uplevel 1 $cmd_buf} $iterations]
@@ -160,18 +149,16 @@
}
-# If environment variable "GEN_PRINT_DEBUG" is set, this module will output
-# debug data. This is primarily intended for the developer of this module.
+# If environment variable "GEN_PRINT_DEBUG" is set, this module will output debug data. This is primarily
+# intended for the developer of this module.
set GEN_PRINT_DEBUG [get_var ::env(GEN_PRINT_DEBUG) 0]
-# The user can set the following environment variables to influence the
-# output from print_time and print_var procedures. See the prologs of those
-# procedures for details.
+# The user can set the following environment variables to influence the output from print_time and print_var
+# procedures. See the prologs of those procedures for details.
set NANOSECONDS [get_var ::env(NANOSECONDS) 0]
set SHOW_ELAPSED_TIME [get_var ::env(SHOW_ELAPSED_TIME) 0]
-# _gtp_default_print_var_width_ is adjusted based on NANOSECONDS and
-# SHOW_ELAPSED_TIME.
+# _gtp_default_print_var_width_ is adjusted based on NANOSECONDS and SHOW_ELAPSED_TIME.
if { $NANOSECONDS } {
set _gtp_default_print_var_width_ 36
set width_incr 14
@@ -181,20 +168,20 @@
}
if { $SHOW_ELAPSED_TIME } {
incr _gtp_default_print_var_width_ $width_incr
- # Initializing _sprint_time_last_seconds_ which is a global value to
- # remember the clock seconds from the last time sprint_time was called.
+ # Initializing _sprint_time_last_seconds_ which is a global value to remember the clock seconds from the
+ # last time sprint_time was called.
set _gtp_sprint_time_last_micro_seconds_ [clock microseconds]
}
-# tcl_precision is a built-in Tcl variable that specifies the number of
-# digits to generate when converting floating-point values to strings.
+# tcl_precision is a built-in Tcl variable that specifies the number of digits to generate when converting
+# floating-point values to strings.
set tcl_precision 17
proc sprint { { buffer {} } } {
# Simply return the user's buffer.
- # This procedure is used by the qprint and dprint functions defined
- # dynamically below, i.e. it would not normally be called for general use.
+ # This procedure is used by the qprint and dprint functions defined dynamically below, i.e. it would not
+ # normally be called for general use.
# Description of arguments.
# buffer This will be returned to the caller.
@@ -207,8 +194,8 @@
proc sprintn { { buffer {} } } {
# Simply return the user's buffer plus a trailing line feed..
- # This procedure is used by the qprintn and dprintn functions defined
- # dynamically below, i.e. it would not normally be called for general use.
+ # This procedure is used by the qprintn and dprintn functions defined dynamically below, i.e. it would not
+ # normally be called for general use.
# Description of arguments.
# buffer This will be returned to the caller.
@@ -243,38 +230,29 @@
# #(CDT) 2016/08/03 17:12:05 - Hi.
- # The following environment variables will affect the formatting as
- # described:
- # NANOSECONDS This will cause the time stamps to be
- # precise to the microsecond (Yes, it
- # probably should have been named
- # MICROSECONDS but the convention was set
- # long ago so we're sticking with it).
- # Example of the output when environment
- # variable NANOSECONDS=1.
+ # The following environment variables will affect the formatting as described:
+ # NANOSECONDS This will cause the time stamps to be precise to the microsecond (Yes, it
+ # probably should have been named MICROSECONDS but the convention was set
+ # long ago so we're sticking with it). Example of the output when
+ # environment variable NANOSECONDS=1.
# #(CDT) 2016/08/03 17:16:25.510469 - Hi.
- # SHOW_ELAPSED_TIME This will cause the elapsed time to be
- # included in the output. This is the
- # amount of time that has elapsed since the
- # last time this procedure was called. The
- # precision of the elapsed time field is
- # also affected by the value of the
- # NANOSECONDS environment variable. Example
- # of the output when environment variable
- # NANOSECONDS=0 and SHOW_ELAPSED_TIME=1.
+ # SHOW_ELAPSED_TIME This will cause the elapsed time to be included in the output. This is
+ # the amount of time that has elapsed since the last time this procedure
+ # was called. The precision of the elapsed time field is also affected by
+ # the value of the NANOSECONDS environment variable. Example of the output
+ # when environment variable NANOSECONDS=0 and SHOW_ELAPSED_TIME=1.
# #(CDT) 2016/08/03 17:17:40 - 0 - Hi.
- # Example of the output when environment variable NANOSECONDS=1 and
- # SHOW_ELAPSED_TIME=1.
+ # Example of the output when environment variable NANOSECONDS=1 and SHOW_ELAPSED_TIME=1.
# #(CDT) 2016/08/03 17:18:47.317339 - 0.000046 - Hi.
# Description of argument(s).
- # buffer A string string whhich is to be appended
- # to the formatted time string and returned.
+ # buffer A string string whhich is to be appended to the formatted time string and
+ # returned.
global NANOSECONDS
global _gtp_sprint_time_last_micro_seconds_
@@ -326,8 +304,7 @@
# Return the value of sprint_time + a line feed.
# Description of argument(s):
- # args All args are passed directly to
- # subordinate function, sprint_time. See
+ # args All args are passed directly to subordinate function, sprint_time. See
# that function's prolog for details.
return [sprint_time {*}$args]\n
@@ -340,8 +317,7 @@
# Return a standardized error string which includes the callers buffer text.
# Description of argument(s):
- # buffer Text to be returned as part of the error
- # message.
+ # buffer Text to be returned as part of the error message.
return [sprint_time "**ERROR** $buffer"]
@@ -350,11 +326,9 @@
proc sprint_varx { var_name var_value { indent 0 } { width {} } { hex 0 } } {
- # Return the name and value of the variable named in var_name in a
- # formatted way.
+ # Return the name and value of the variable named in var_name in a formatted way.
- # This procedure will visually align the output to look good next to
- # print_time output.
+ # This procedure will visually align the output to look good next to print_time output.
# Example:
@@ -368,8 +342,7 @@
# print_varx first_name $first_name 2
# print_varx age $age 2
- # With environment variables NANOSECONDS and SHOW_ELAPSED_TIME both set,
- # the following output is produced:
+ # With environment variables NANOSECONDS and SHOW_ELAPSED_TIME both set, the following output is produced:
# #(CST) 2017/12/14 16:38:28.259480 - 0.000651 - Initializing variables.
# last_name: Montana
@@ -377,23 +350,15 @@
# age: 50
# Description of argument(s):
- # var_name The name of the variable whose name and
- # value are to be printed.
+ # var_name The name of the variable whose name and value are to be printed.
# var_value The value to be printed.
- # indent The number of spaces to indent each line
- # of output.
- # width The width of the column containing the
- # variable name. By default this will align
- # with the print_time text (see example
- # above).
- # hex Indicates that the variable value is to be
- # printed in hexedecimal format. This is
- # only valid if the variable value is an
- # integer. If the variable is NOT an
- # integer and is blank, this will be
- # interpreted to mean "print the string
- # '<blank>', rather than an actual blank
- # value".
+ # indent The number of spaces to indent each line of output.
+ # width The width of the column containing the variable name. By default this
+ # will align with the print_time text (see example above).
+ # hex Indicates that the variable value is to be printed in hexedecimal format.
+ # This is only valid if the variable value is an integer. If the variable
+ # is NOT an integer and is blank, this will be interpreted to mean "print
+ # the string '<blank>', rather than an actual blank value".
# Note: This procedure relies on global var _gtp_default_print_var_width_
@@ -428,19 +393,16 @@
proc sprint_var { var_name args } {
- # Return the name and value of the variable named in var_name in a
- # formatted way.
+ # Return the name and value of the variable named in var_name in a formatted way.
- # This procedure will visually align the output to look good next to
- # print_time output.
+ # This procedure will visually align the output to look good next to print_time output.
- # Note: This procedure is the equivalent of sprint_varx with one
- # difference: This function will figure out the value of the named variable
- # whereas sprint_varx expects you to pass the value. This procedure in fact
- # calls sprint_varx to do its work.
+ # Note: This procedure is the equivalent of sprint_varx with one difference: This function will figure
+ # out the value of the named variable whereas sprint_varx expects you to pass the value. This procedure in
+ # fact calls sprint_varx to do its work.
- # Note: This procedure will detect whether var_name is an array and print
- # it accordingly (see the second example below).
+ # Note: This procedure will detect whether var_name is an array and print it accordingly (see the second
+ # example below).
# Example:
@@ -454,8 +416,7 @@
# print_var first_name 2
# print_var age 2
- # With environment variables NANOSECONDS and SHOW_ELAPSED_TIME both set,
- # the following output is produced:
+ # With environment variables NANOSECONDS and SHOW_ELAPSED_TIME both set, the following output is produced:
# #(CST) 2017/12/14 16:38:28.259480 - 0.000651 - Initializing variables.
# last_name: Montana
@@ -474,16 +435,13 @@
# data(1): horse
# Description of argument(s):
- # var_name The name of the variable whose name and
- # value are to be printed.
- # args The args understood by sprint_varx (after
- # var_name and var_value). See
+ # var_name The name of the variable whose name and value are to be printed.
+ # args The args understood by sprint_varx (after var_name and var_value). See
# sprint_varx's prolog for details.
# Note: This procedure relies on global var _gtp_default_print_var_width_
- # Determine who our caller is and therefore what upvar_level to use to get
- # var_value.
+ # Determine who our caller is and therefore what upvar_level to use to get var_value.
set stack_ix_adjust [calc_wrap_stack_ix_adjust]
set upvar_level [expr $stack_ix_adjust + 1]
upvar $upvar_level $var_name var_value
@@ -509,8 +467,7 @@
return $buffer
}
- # If var_value is not defined, catch the error and print its value as
- # "variable not set".
+ # If var_value is not defined, catch the error and print its value as "variable not set".
if {[catch {set buffer [sprint_varx $var_name $var_value {*}$args]} error_text options]} {
set regex ":\[ \]no\[ \]such\[ \]variable"
if { [regexp -expanded ${regex} ${error_text}]} {
@@ -528,22 +485,18 @@
proc sprint_list { var_name args } {
- # Return the name and value of the list variable named in var_name in a
- # formatted way.
+ # Return the name and value of the list variable named in var_name in a formatted way.
# This procedure is the equivalent of sprint_var but for lists.
# Description of argument(s):
- # var_name The name of the variable whose name and
- # value are to be printed.
- # args The args understood by sprint_varx (after
- # var_name and var_value). See
+ # var_name The name of the variable whose name and value are to be printed.
+ # args The args understood by sprint_varx (after var_name and var_value). See
# sprint_varx's prolog for details.
- # Note: In TCL, there is no way to determine that a variable represents a
- # list vs a string, etc. It is up to the programmer to decide how the data
- # is to be interpreted. Thus the need for procedures such as this one.
- # Consider the following code:
+ # Note: In TCL, there is no way to determine that a variable represents a list vs a string, etc. It is up
+ # to the programmer to decide how the data is to be interpreted. Thus the need for procedures such as this
+ # one. Consider the following code:
# set my_list {one two three}
# print_var my_list
@@ -556,9 +509,8 @@
# my_list[1]: two
# my_list[2]: three
- # As far as print_var is concerned, my_list is a string and is printed
- # accordingly. By using print_list, the programmer is asking to have the
- # output shown as a list with list indices, etc.
+ # As far as print_var is concerned, my_list is a string and is printed accordingly. By using print_list,
+ # the programmer is asking to have the output shown as a list with list indices, etc.
# Determine who our caller is and therefore what upvar_level to use.
set stack_ix_adjust [calc_wrap_stack_ix_adjust]
@@ -586,38 +538,32 @@
proc sprint_dict { var_name args } {
- # Return the name and value of the dictionary variable named in var_name in
- # a formatted way.
+ # Return the name and value of the dictionary variable named in var_name in a formatted way.
# This procedure is the equivalent of sprint_var but for dictionaries.
# Description of argument(s):
- # var_name The name of the variable whose name and
- # value are to be printed.
- # args The args understood by sprint_varx (after
- # var_name and var_value). See
+ # var_name The name of the variable whose name and value are to be printed.
+ # args The args understood by sprint_varx (after var_name and var_value). See
# sprint_varx's prolog for details.
- # Note: In TCL, there is no way to determine that a variable represents a
- # dictionary vs a string, etc. It is up to the programmer to decide how the
- # data is to be interpreted. Thus the need for procedures such as this one.
- # Consider the following code:
+ # Note: In TCL, there is no way to determine that a variable represents a dictionary vs a string, etc. It
+ # is up to the programmer to decide how the data is to be interpreted. Thus the need for procedures such
+ # as this one. Consider the following code:
# set my_dict [dict create first Joe last Montana age 50]
# print_var my_dict
# print_dict my_dict
# Output from aforementioned code:
- # my_dict: first Joe last Montana
- # age 50
+ # my_dict: first Joe last Montana age 50
# my_dict:
# my_dict[first]: Joe
# my_dict[last]: Montana
# my_dict[age]: 50
- # As far as print_var is concerned, my_dict is a string and is printed
- # accordingly. By using print_dict, the programmer is asking to have the
- # output shown as a dictionary with dictionary keys/values, etc.
+ # As far as print_var is concerned, my_dict is a string and is printed accordingly. By using print_dict,
+ # the programmer is asking to have the output shown as a dictionary with dictionary keys/values, etc.
# Determine who our caller is and therefore what upvar_level to use.
set stack_ix_adjust [calc_wrap_stack_ix_adjust]
@@ -646,11 +592,10 @@
# Sprint the values of one or more variables.
# Description of arg(s):
- # args: A list of variable names to be printed. The first argument in the
- # arg list found to be an integer (rather than a variable name) will be
- # interpreted to be first of several possible sprint_var arguments (e.g.
- # indent, width, hex). See the prologue for sprint_var above for
- # descriptions of this variables.
+ # args: A list of variable names to be printed. The first argument in the arg list found to be an
+ # integer (rather than a variable name) will be interpreted to be first of several possible sprint_var
+ # arguments (e.g. indent, width, hex). See the prologue for sprint_var above for descriptions of this
+ # variables.
# Example usage:
# set var1 "hello"
@@ -686,15 +631,12 @@
# Return a string of dashes to the caller.
# Description of argument(s):
- # indent The number of characters to indent the
- # output.
+ # indent The number of characters to indent the output.
# width The width of the string of dashes.
- # line_feed Indicates whether the output should end
- # with a line feed.
- # char The character to be repeated in the output
- # string. In other words, you can call on
- # this function to print a string of any
- # character (e.g. "=", "_", etc.).
+ # line_feed Indicates whether the output should end with a line feed.
+ # char The character to be repeated in the output string. In other words, you
+ # can call on this function to print a string of any character (e.g. "=",
+ # "_", etc.).
set_var_default indent 0
set_var_default width 80
@@ -714,8 +656,7 @@
# #(CST) 2017/11/28 15:08:03.261466 - 0.015214 - Executing: proc1 hi
# Description of argument(s):
- # include_args Indicates whether proc args should be
- # included in the result.
+ # include_args Indicates whether proc args should be included in the result.
set stack_ix_adjust [calc_wrap_stack_ix_adjust]
set level [expr -(2 + $stack_ix_adjust)]
@@ -733,12 +674,9 @@
# #(CDT) 2016/08/25 17:57:36 - Issuing: ls
# Description of arg(s):
- # cmd_buf The command to be executed by caller. If
- # this is blank, this procedure will search
- # up the stack for the first cmd_buf value
- # to use.
- # test_mode With test_mode set, your output will look
- # like this:
+ # cmd_buf The command to be executed by caller. If this is blank, this procedure
+ # will search up the stack for the first cmd_buf value to use.
+ # test_mode With test_mode set, your output will look like this:
# #(CDT) 2016/08/25 17:57:36 - (test_mode) Issuing: ls
@@ -759,8 +697,8 @@
proc sprint_call_stack { { indent 0 } } {
- # Return a call stack report for the given point in the program with line
- # numbers, procedure names and procedure parameters and arguments.
+ # Return a call stack report for the given point in the program with line numbers, procedure names and
+ # procedure parameters and arguments.
# Sample output:
@@ -774,8 +712,7 @@
# ---------------------------------------------------------------------------
# Description of arguments:
- # indent The number of characters to indent each
- # line of output.
+ # indent The number of characters to indent each line of output.
append buffer "[sprint_dashes ${indent}]"
append buffer "[string repeat " " $indent]TCL procedure call stack\n\n"
@@ -810,15 +747,13 @@
proc sprint_error_report { { error_text "\n" } { indent 0 } } {
- # Return a string with a standardized report which includes the caller's
- # error text, the call stack and the program header.
+ # Return a string with a standardized report which includes the caller's error text, the call stack and
+ # the program header.
# Description of arg(s):
- # error_text The error text to be included in the
- # report. The caller should include any
- # needed linefeeds.
- # indent The number of characters to indent each
- # line of output.
+ # error_text The error text to be included in the report. The caller should include
+ # any needed linefeeds.
+ # indent The number of characters to indent each line of output.
set width 120
set char "="
@@ -837,15 +772,13 @@
proc sprint_pgm_header { {indent 0} {linefeed 1} } {
- # Return a standardized header that programs should print at the beginning
- # of the run. It includes useful information like command line, pid,
- # userid, program parameters, etc.
+ # Return a standardized header that programs should print at the beginning of the run. It includes useful
+ # information like command line, pid, userid, program parameters, etc.
# Description of arguments:
- # indent The number of characters to indent each
- # line of output.
- # linefeed Indicates whether a line feed be included
- # at the beginning and end of the report.
+ # indent The number of characters to indent each line of output.
+ # linefeed Indicates whether a line feed be included at the beginning and end of the
+ # report.
global program_name
global pgm_name_var_name
@@ -898,8 +831,8 @@
proc sprint_pgm_footer {} {
- # Return a standardized footer that programs should print at the end of the
- # program run. It includes useful information like total run time, etc.
+ # Return a standardized footer that programs should print at the end of the program run. It includes
+ # useful information like total run time, etc.
global program_name
global pgm_name_var_name
@@ -933,12 +866,11 @@
# Example:
#
- # set desc "When in the Course of human events, it becomes necessary for
- # one people to dissolve the political bands which have connected them with
- # another, and to assume among the powers of the earth, the separate and
- # equal station to which the Laws of Nature and of Nature's God entitle
- # them, a decent respect to the opinions of mankind requires that they
- # should declare the causes which impel them to the separation."
+ # set desc "When in the Course of human events, it becomes necessary for one people to dissolve the
+ # political bands which have connected them with another, and to assume among the powers of the earth, the
+ # separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect
+ # to the opinions of mankind requires that they should declare the causes which impel them to the
+ # separation."
# set buffer [sprint_arg_desc "--declaration" $desc]
# puts $buffer
@@ -955,12 +887,10 @@
# which impel them to the separation.
# Description of argument(s):
- # arg_title The content that you want to appear on the
- # first line in column 1.
+ # arg_title The content that you want to appear on the first line in column 1.
# arg_desc The text that describes the argument.
# indent The number of characters to indent.
- # col1_width The width of column 1, which is the column
- # containing the arg_title.
+ # col1_width The width of column 1, which is the column containing the arg_title.
# line_width The total max width of each line of output.
set fold_width [expr $line_width - $col1_width]
@@ -1004,11 +934,9 @@
# First, create templates.
# Notes:
# - The resulting procedures will replace all registered passwords.
-# - The resulting "quiet" and "debug" print procedures will search the stack
-# for quiet and debug, respectively. That means that the if a procedure
-# calls qprint_var and the procedure has a local version of quiet set to 1,
-# the print will not occur, even if there is a global version of quiet set
-# to 0.
+# - The resulting "quiet" and "debug" print procedures will search the stack for quiet and debug,
+# respectively. That means that the if a procedure calls qprint_var and the procedure has a local version
+# of quiet set to 1, the print will not occur, even if there is a global version of quiet set to 0.
set print_proc_template " puts -nonewline<output_stream> \[replace_passwords"
append print_proc_template " \[<base_proc_name> {*}\$args\]\]\n}\n"
set qprint_proc_template " set quiet \[get_stack_var quiet 0\]\n if {"
@@ -1022,30 +950,22 @@
set print_proc_templates(d) $dprint_proc_template
proc create_print_wrapper_procs {proc_names {stderr_proc_names {}} } {
- # Generate code for print wrapper procs and return the generated code as a
- # string.
+ # Generate code for print wrapper procs and return the generated code as a string.
- # To illustrate, suppose there is a "print_foo_bar" proc in the proc_names
- # list.
+ # To illustrate, suppose there is a "print_foo_bar" proc in the proc_names list.
# This proc will...
# - Expect that there is an sprint_foo_bar proc already in existence.
- # - Create a print_foo_bar proc which calls sprint_foo_bar and prints the
- # result.
- # - Create a qprint_foo_bar proc which calls upon sprint_foo_bar only if
- # global value quiet is 0.
- # - Create a dprint_foo_bar proc which calls upon sprint_foo_bar only if
- # global value debug is 1.
+ # - Create a print_foo_bar proc which calls sprint_foo_bar and prints the result.
+ # - Create a qprint_foo_bar proc which calls upon sprint_foo_bar only if global value quiet is 0.
+ # - Create a dprint_foo_bar proc which calls upon sprint_foo_bar only if global value debug is 1.
- # Also, code will be generated to define aliases for each proc as well.
- # Each alias will be created by replacing "print_" in the proc name with "p"
- # For example, the alias for print_foo_bar will be pfoo_bar.
+ # Also, code will be generated to define aliases for each proc as well. Each alias will be created by
+ # replacing "print_" in the proc name with "p" For example, the alias for print_foo_bar will be pfoo_bar.
# Description of argument(s):
- # proc_names A list of procs for which print wrapper
- # proc code is to be generated.
- # stderr_proc_names A list of procs whose generated code
- # should print to stderr rather than to
- # stdout.
+ # proc_names A list of procs for which print wrapper proc code is to be generated.
+ # stderr_proc_names A list of procs whose generated code should print to stderr rather than
+ # to stdout.
global print_proc_template
global print_proc_templates