Native Inspect Manual (H06.04+)

Using Tcl Scripting
Native Inspect Manual528122-005
5-6
Tcl Examples
To use a Tcl command (ListPCBs) to walk data structure (symexpr is a Tcl
command used to evaluate symbolic expressions):
To use the Tcl script ListPCBs to walk data structure:
#------------------------------------------------------------------
# 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"
}
}
(eInspect 0,519):tcl source mypcb
(eInspect 0,519):ListPCBs
20 Active PCBs
pin flags attributes
0 0x6000 7
1 0x0500 0
2 0x6000 0
3 0x0500 0
4 0x6000 0
5 0x0500 0
6 0x0000 0
7 0x0000 0
8 0x0000 0
9 0x0000 0
10 0x0000 0
11 0x0000 0
12 0x0000 0
13 0x0000 0
14 0x0000 0
15 0x0000 0
16 0x0000 0
17 0x0000 0
18 0x0000 0
19 0x0000 0