Native Inspect Manual (H06.13+, J06.03+)

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]]
}
To create and use a simple Tcl command (allbases):
file: mytcl
#----------------------------------------------------------
# Syntax: allbases <expr>
# Effect: Evaluate the expression and display the result in
# different formats.
#----------------------------------------------------------
proc allbases { 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"
}
(eInspect 3,615):tcl source mytcl
(eInspect 3,615):allbases 304
OCT: 000460 DEC: 304 HEX: 0x0130 ASCII: '...0'
(eInspect 3,615):
To use a Tcl command (ListPCBs) to walk data structure (symexpr is a Tcl command used
to evaluate symbolic expressions):
#------------------------------------------------------------------
# Syntax: ListPCBS
# Synopsis: Walk the PCBList, printing info about each PCB
#------------------------------------------------------------------
proc ListPCBs { } {
set pcbCount [FORMAT [SYMEXPR PCBList.count] short DEC]
PUT "\n$pcbCount Active PCBs\n"
PUT "pin\tflags\tattributes\n"
for { set i 0 } { [expr $i < $pcbCount] } { incr i } {
set pin [SYMEXPR PCBList.entry\[$i\]->ref.pcb->pin]
set flags [SYMEXPR PCBList.entry\[$i\]->ref.pcb->flags.word]
set attributeCount [SYMEXPR PCBList.entry\[$i\]->ref.pcb->attributeCount]
PUT "[FORMAT $pin short DEC]\t[FORMAT $flags short]\
t[FORMAT $attributeCount short DEC]\n"
132 Using Tcl Scripting