/usr/share/pcb/tools/tgo2pcb.tcl is in pcb-common 20110918-7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | #! /usr/bin/tclsh
#
# tango to PCB netlist converter
# usage: tgo2pcb input > output
#
# Copyright 1998, Ingo Cyliax, Derivation Systems, Inc.
# Email: cyliax@derivation.com
#
set nets() ""
#
# read a tango netlist and extract the essentials we need, this
# has been tested with OrCad's tango netlister
#
proc rdtgo { file } {
set fd [open $file r]
set line ""
set args ""
set ln 0
set lch ""
set net ""
set pin ""
set ref ""
global nets cnvt
while { 1 } {
set n [gets $fd line]
if { $n == -1 } { break }
incr ln 1
set ch [string index $line 0]
if { $ch == "\["} {
set lch $ch
set ln 0
}
if { $ch == "]"} {
set lch $ch
set ln 0
}
if { $ch == "("} {
set lch $ch
set ln 0
}
if { $ch == ")"} {
set lch $ch
set ln 0
}
if { $ch != "(" && $lch == "(" && $ln == "1"} {
set net $line
}
if { $ch != "(" && $lch == "(" && $ln != "1"} {
set xx [split $line ,]
set pin [lindex $xx 1]
set ref [lindex $xx 0]
if { $cnvt($pin) != "" } {
set pin $cnvt($pin)
}
lappend nets($net) "$ref-$pin"
}
}
close $fd
}
#
# write out a PCB netlist
#
proc wrpcb { } {
global nets
foreach i [array names nets] {
if { $nets($i) != "" } {
puts "$i $nets($i)"
}
}
}
#
# pins 1-99 convert to 1-99, all input pins are converted in this array
#
set pin 1
for { set i 1 } { $i <= 99 } { incr i } {
set cnvt($i) $pin
incr pin
}
#
# read the input file and convert to internal netlist
#
rdtgo [lindex $argv 0]
#
# convert and write to output
#
wrpcb
exit
|