Native Inspect Manual (H06.03+)

Table Of Contents
Using Tcl Scripting
Native Inspect Manual528122-003
4-5
Tcl Examples
Other Scripts Must Import Packages and Commands
If you have explicitly exported your public commands, another user can use a wild card
to import your public commands, as follows:
# In an app or another package
namespace eval ::mySub:: {
namespace import ::mySub::*
}
A user can invoke your help by entering the Tcl help (or tclhelp) command, as follows:
tcl help commandname
Tcl Examples
The code for the Native Inspect eq command is implemented in Tcl:
# Syntax: eq <expr>
#
# Effect: Evaluate the expression and display the result in different
# formats.
#
#------------------------------------------------------------------
proc eq { args } {
# sanity check
if { ! [llength args] } {
SYNTAX_ERROR eq
}
set result [matheval $args]
set char [ASCII $result]
PUT "\n"
PUT "OCT: [format %06o $result] DEC: [format %-5d $result] HEX:
0x[format %04x result] ASCII: \'$char\'\n"
}
proc empty_str {str} {
expr { [scan $str "%s" tmp] == -1 }
#------------------------------------------------------------------
}
proc crunch_number {s endnum} {
return [string match {[-0-9#%]} [string index $s 0]]
}