polygon1.c: #ifdef DEBUG_ALL_LABELS build print_labels()
[geda-pcb/gde.git] / lib / plcc.inc
blob5e1a1dce1048b85633c63bc06ff27e326ebff5ac
2 #                             COPYRIGHT
3
4 #   PCB, interactive printed circuit board design
5 #   Copyright (C) 1994,1995,1996 Thomas Nau
6
7 #   This program is free software; you can redistribute it and/or modify
8 #   it under the terms of the GNU General Public License as published by
9 #   the Free Software Foundation; either version 2 of the License, or
10 #   (at your option) any later version.
11
12 #   This program is distributed in the hope that it will be useful,
13 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #   GNU General Public License for more details.
16
17 #   You should have received a copy of the GNU General Public License
18 #   along with this program; if not, write to the Free Software
19 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 #   Contact addresses for paper mail and Email:
22 #   Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 #   Thomas.Nau@rz.uni-ulm.de
24
25 #   RCS: $Id$
27 # PLCC packages
30 # -------------------------------------------------------------------
31 # ThanX to Johan Andersson (johan@homemail.com), modified by Thomas Nau
32 # the definition of a plcc package
33 # modified for correct pad numbering by Holm Tiffe
35 # modified 11-Dec-1999 Larry Doolittle <LRDoolittle@lbl.gov>
36 # to shorten the pads by 10 mils; PUSHOUT=5 PUSHIN=40
38 # modified 22-Dec-1999 Larry Doolittle <LRDoolittle@lbl.gov>
39 # put back the 10 mils on the outside; PUSHOUT=5, PUSHIN=50
41 # One last tweak 12-Jan-2000 LRD, now that the shop complained I
42 # didn't leave them any room to solder (looks like the 22-Dec
43 # change was backwards);  PUSHOUT=20, PUSHIN=40
45 # $1: canonical name
46 # $2: name on PCB
47 # $3: value
48 # $4: number of pins
49 # $5: additional border (will be ignored)
51 define(`PKG_PLCC',
52         `define(`NUMPINS', `$4')
53         ifelse(eval(NUMPINS == 32),1,`define(`QUARTER',7)',`define(`QUARTER', `eval($4 /4)')')
54         define(`OFFSET', `eval((QUARTER +1) /2)')
55         define(`WIDTH', `eval((QUARTER-1) *50 +2*75)')
56         ifelse(eval(NUMPINS == 32),1,`define(`SIDE',`eval((NUMPINS-2*QUARTER)/2)')', `define(`SIDE',QUARTER)')
57         define(`HEIGHT', `eval((SIDE-1)* 50 + 2*75)')
58         define(`CENTER', `eval(WIDTH / 2)')
59         define(`PUSHOUT', 20)    # was 15
60         define(`PUSHIN', 40)     # was 50
61 Element(0x00 "$1" "`$2'" "$3" 100 CENTER 0 100 0x00)
63         # top left half
64 define(`X', CENTER)
65 define(`Y', 0)
66 define(`count', 1)
67 forloop(`i', 1, OFFSET,
68         `PAD(X, eval(Y-PUSHOUT), X, eval(Y+PUSHIN), 20, count)' `define(`count', incr(count))'
69         `define(`X', eval(X-50))'
70         )
73         # left row
74 define(`X', 0)
75 define(`Y', 75)
76 define(`count', `eval(OFFSET+1)')
77 forloop(`i', 1, SIDE,
78         `PAD(eval(X-PUSHOUT), Y, eval(X+PUSHIN), Y, 20, count)' `define(`count', incr(count))'
79         `define(`Y', eval(Y+50))'
80         )
82         # bottom row
83 define(`X', 75)
84 define(`Y', HEIGHT)
85 forloop(`i', 1, QUARTER,
86         `PAD(X, eval(Y+PUSHOUT), X, eval(Y-PUSHIN), 20, count)' `define(`count', incr(count))'
87         `define(`X', eval(X+50))'
90         # right row
91 define(`X', WIDTH)
92 define(`Y', eval(HEIGHT-75))
93 forloop(`i', 1, SIDE,
94         `PAD(eval(X+PUSHOUT), Y, eval(X-PUSHIN), Y, 20, count)' `define(`count', incr(count))'
95         `define(`Y', eval(Y-50))'
98         # top right row
99 define(`X', eval(WIDTH-75))
100 define(`Y', 0)
101 forloop(`i', 1, eval(OFFSET-1),
102         `PAD(X, eval(Y-PUSHOUT), X, eval(Y+PUSHIN), 20, count)' `define(`count', incr(count))'
103         `ifelse(eval(count > NUMPINS), 1, `define(`count', 1)')'
104         `define(`X', eval(X-50))'
107 #       ElementLine(50 0 WIDTH 0 20)
108 #       ElementLine(WIDTH 0 WIDTH WIDTH 20)
109 #       ElementLine(WIDTH WIDTH 0 WIDTH 20)
110 #       ElementLine(0 WIDTH 0 50 20)
111 #       ElementLine(0 50 50 0 20)
113 # Modified by Thomas Olson to eliminate silkscreen blobbing over pads.
114 # Approach one: eliminate ElementLine transgression over pads. leave corners
115 # only.
117 define(`OLWIDTH', eval(WIDTH-50))
118 define(`OLHEIGHT', eval(HEIGHT-50))
119         
120         ElementLine(OLWIDTH 0 WIDTH 0 10)
121         ElementLine(WIDTH 0 WIDTH 50 10)
122         ElementLine(WIDTH OLHEIGHT WIDTH HEIGHT 10)
123         ElementLine(WIDTH HEIGHT OLWIDTH HEIGHT 10)
124         ElementLine(50 HEIGHT 0 HEIGHT 10)
125         ElementLine(0 HEIGHT 0 OLHEIGHT 10)
126         ElementLine(0 50 50 0 10)
128 # Approach two: move outline to edge of pads.
129 # The outline should be 15 off. But since the pad algorithm
130 # is not making the square pads correctly I give it a total of 30
131 # to clear the pads.
133 # Try 40 mils, and parameterize it.  1/12/00 LRD
134 define(`NOSMUDGE', 40)
135 define(`OLWIDTH', eval(WIDTH+NOSMUDGE))
136 define(`OLHEIGHT', eval(HEIGHT+NOSMUDGE))
138         ElementLine(50 -NOSMUDGE OLWIDTH -NOSMUDGE 10)
139         ElementLine(OLWIDTH -NOSMUDGE OLWIDTH OLHEIGHT 10)
140         ElementLine(OLWIDTH OLHEIGHT -NOSMUDGE OLHEIGHT 10)
141         ElementLine(-NOSMUDGE OLHEIGHT -NOSMUDGE 50 10)
142         ElementLine(-NOSMUDGE 50 50 -NOSMUDGE 10)
144         ElementArc(CENTER 100 20 20 0 360 10)
146         Mark(0 0)
149 # -------------------------------------------------------------------
150 # the definition of a plcc package with through-hole socket
152 # for example, Assmann A-CCS##-{Z,G} series
153 # or mil-max 940-XX-XXX-24-000000 series.
155 # mil-max specifies 0.035" drill hole and 0.062" pad.
156 # Assman says 0.0315" hole.  Also the mil-max outside
157 # dimensions are ever so slightly larger than Assmann so
158 # use those.  See for example
159 # http://www.milmax.com/images/products/pdf/092.PDF
161 # modified for correct pin numbering by Holm Tiffe
162 # $1: canonical name
163 # $2: name on PCB
164 # $3: value
165 # $4: number of pins
166 # $5: additional border
168 define(`PKG_PLCC_SOCKET',
169         `define(`QUARTER', `eval($4 /4)')
170         define(`OFFSET', eval((QUARTER +1) / 2))
171         define(`BORDER', `$5')
172         define(`WIDTH', `eval((OFFSET+1) *100 +2*BORDER)')
173         define(`CENTER', `eval(WIDTH / 2)')
174         define(`NUMPINS', `$4')
175         define(`PADSIZE', `62')
176         define(`DRILL', `35')
177 Element(0x00 "$1" "`$2'" "$3" eval(BORDER+200) CENTER 0 100 0x00)
179 # PLCC - 44 is a  special case, pad 1 in inner row
181 ifelse(eval(NUMPINS == 44 || NUMPINS == 28 || NUMPINS == 32), 1, `(
183 define(`X',eval(CENTER+50))
184 define(`Y',eval(BORDER+100))
185 define(`count',1)
187 ifelse(eval(NUMPINS == 44),1,`define(`ltr',3)',`define(`ltr',2)')
188 ifelse(eval(NUMPINS == 32),1,`define(`QUARTER',9)')
190 # top left row
191 forloop(`i', 1, ltr,
192         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
193         `PIN(eval(X-100), eval(Y-100), PADSIZE, DRILL, count)' `define(`count', incr(count))'
194         `define(`X', eval(X-100))'
197 #left row
198 define(`X',eval(X-100))
199 forloop(`i', 1, eval((QUARTER-1)/2),
200         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
201         `PIN(eval(X+100), Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
202         `define(`Y', eval(Y+100))'
204 PIN(X, Y, PADSIZE, DRILL, count)
205 define(`count', incr(count))
207 # bottom row
208 define(`X',eval(X+100))
209 define(`Y',eval(Y+100))
210 forloop(`i', 1, eval(ltr*2-1),
211         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
212         `PIN(X, eval(Y-100), PADSIZE, DRILL, count)' `define(`count', incr(count))'
213         `define(`X', eval(X+100))'
215 PIN(X, Y, PADSIZE, DRILL, count)
216 define(`count', incr(count))
218 # right row
219 define(`X',eval(X+100))
220 define(`Y',eval(Y-100))
221 forloop(`i', 1, eval((QUARTER-1)/2),
222         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
223         `PIN(eval(X-100), Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
224         `define(`Y', eval(Y-100))'
226 PIN(X, Y, PADSIZE, DRILL, count)
227 define(`count', incr(count))
229 # top rigth row
230 define(`X',eval(X-100))
231 define(`Y',eval(Y-100))
232 forloop(`i', 1, eval(ltr-1),
233         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
234         `PIN(X, eval(Y+100), PADSIZE, DRILL, count)' `define(`count', incr(count))'
235         `define(`X', eval(X-100))'
237 PIN(X, Y, PADSIZE, DRILL, count)
239 ifelse(eval(NUMPINS == 32),1,`define(`HEIGHT',eval(WIDTH+100))',`define(`HEIGHT',WIDTH)')
240         ElementLine(0 0 WIDTH 0 20)
241         ElementLine(WIDTH 0 WIDTH HEIGHT 20)
242         ElementLine(WIDTH HEIGHT 0 HEIGHT 20)
243         ElementLine(0 HEIGHT 0 0 20)
244         ElementLine(0 100 100 0 10)
245         ElementLine(eval(CENTER-50) 0 CENTER 50 10)
246         ElementLine(CENTER 50 eval(CENTER+50) 0 10)
248         Mark(CENTER BORDER)
251 #------------------------------------------------------------------------
252 # all other sockets, currently 20,52,68 and 84 pins
254 )', `(
256 # the default case, Pad 1 is on outer top row, in the middle
259 #top left row
261 define(`X',CENTER)
262 define(`Y',BORDER)
263 define(`count',1)
264 forloop(`i', 1, eval((QUARTER-1)/4),
265         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
266         `PIN(X, eval(Y+100), PADSIZE, DRILL, count)' `define(`count', incr(count))'
267         `define(`X',eval(X-100))'
269 PIN(X, Y, PADSIZE, DRILL, count)
270 define(`count', incr(count))
272 # left row
273 define(`Y',eval(BORDER+100))
274 define(`X',BORDER)
275 forloop(`i', 1, eval((QUARTER-1)/2),
276         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
277         `PIN(eval(X+100), Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
278         `define(`Y',eval(Y+100))'
280 PIN(X, Y, PADSIZE, DRILL, count)
281 define(`count', incr(count))
283 # bottom row
284 define(`X',eval(BORDER+100))
285 define(`Y',eval(WIDTH-BORDER))
286 forloop(`i', 1, eval((QUARTER-1)/2),
287         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
288         `PIN(X, eval(Y-100), PADSIZE, DRILL, count)' `define(`count', incr(count))'
289         `define(`X',eval(X+100))'
291 PIN(X, Y, PADSIZE, DRILL, count)
292 define(`count', incr(count))
294 # right row
295 define(`X',eval(WIDTH-BORDER))
296 define(`Y',eval(WIDTH-BORDER-100))
297 forloop(`i', 1, eval((QUARTER-1)/2),
298         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
299         `PIN(eval(X-100), Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
300         `define(`Y',eval(Y-100))'
302 PIN(X, Y, PADSIZE, DRILL, count)
303 define(`count', incr(count))
305 #top right row
307 define(`X',eval(WIDTH-BORDER-100))
308 define(`Y',BORDER)
309 forloop(`i', 1, eval((QUARTER-1)/4),
310         `PIN(X, Y, PADSIZE, DRILL, count)' `define(`count', incr(count))'
311         `PIN(X, eval(Y+100), PADSIZE, DRILL, count)' `define(`count', incr(count))'
312         `define(`X',eval(X-100))'
315         ElementLine(0 0 WIDTH 0 20)
316         ElementLine(WIDTH 0 WIDTH WIDTH 20)
317         ElementLine(WIDTH WIDTH 0 WIDTH 20)
318         ElementLine(0 WIDTH 0 0 20)
319         ElementLine(0 100 100 0 10)
320         ElementLine(eval(CENTER-50) 0 CENTER 50 10)
321         ElementLine(CENTER 50 eval(CENTER+50) 0 10)
323         Mark(CENTER BORDER)
325 )')')