This file is indexed.

/usr/share/pcb/m4/connector.inc is in pcb-common 20110918-9.

This file is owned by root:root, with mode 0o644.

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
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
*# -*- m4 -*-
#                             COPYRIGHT
# 
#   PCB, interactive printed circuit board design
#   Copyright (C) 1994,1995,1996 Thomas Nau
# 
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
# 
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
# 
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# 
#   Contact addresses for paper mail and Email:
#   Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
#   Thomas.Nau@rz.uni-ulm.de
# 
#   RCS: $Id$
#
# connector packages

# -------------------------------------------------------------------
# the definition of a single connector
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: number of rows
# $5: number of columns
#
define(`PKG_CONNECTOR',
	`define(`MAXY', `eval(`$4' * 100)')
	define(`MAXX', `eval(`$5' * 100)')
Element(0x00 "$1" "`$2'" "$3" eval(MAXX + 60) 0 3 100 0x00)
(
	forloop(`row', 1, $4, `forloop(`col', 1, $5,
		`PIN(eval(col * 100 -50), eval(row * 100 -50), 60, 38, eval((row-1)*$5+col))
	') ')
	ElementLine(0 0 0 MAXY 10)
	ElementLine(0 MAXY MAXX MAXY 10)
	ElementLine(MAXX MAXY MAXX 0 10)
	ElementLine(MAXX 0 0 0 10)
	ElementLine(0 100 100 100 10)
	ElementLine(100 100 100 0 10)
	Mark(50 50)
)')

# -------------------------------------------------------------------
# the definition of a 2 column header connector with DIP
# pin numbering.  Use PKG_CONNECTOR for ribbon cable numbering
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: number of rows
#
define(`PKG_CONNECTOR_DIL',
	`define(`MAXY', `eval(`$4' * 100)')
	define(`MAXX', `200')
Element(0x00 "$1" "`$2'" "$3" eval(MAXX + 60) 0 3 100 0x00)
(
	forloop(`row', 1, eval(`$4'),
		`PIN(50, eval(row * 100 -50), 60, 38, eval(row))
	')
	forloop(`row', 1, eval(`$4'),
		`PIN(150, eval(($4 + 1 - row) * 100 -50), 60, 38, eval($4 + row))
	')
	ElementLine(0 0 0 MAXY 10)
	ElementLine(0 MAXY MAXX MAXY 10)
	ElementLine(MAXX MAXY MAXX 0 10)
	ElementLine(MAXX 0 0 0 10)
	ElementLine(0 100 100 100 10)
	ElementLine(100 100 100 0 10)
	Mark(50 50)
)')



# ---------------------------------------------------------------
# base definition (housing) for connector DIN 41.612
# 11/95 Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de)
# female package added 05/96 also by Volker Bosch
#
# derived from above for 48 - Pin Connectors from the same series
# Holm Tiffe
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: requested rows a,b,c
#
define(`PKG_DIN41_612MALE_SMALL',
	`define(`XPOS', `eval(300 + 100 * i)')
	define(`MINY', 300)
Element(0x00 "$1" "`$2'" "$3" 520 550 0 200 0x00)
(
	# Reihe a
	ifelse(index(`$4', `a'), `-1', ,
		forloop(`i', 1, 16, `PIN(eval(2000 - 100 *i), 300, 60, 30, i)
	'))

	# Reihe b
	ifelse(index(`$4', `b'), `-1', , `define(`MINY', 200)'
		forloop(`i', 1, 16, `PIN(eval(2000 - 100 *i), 200, 60, 30, eval(16 + i))
	'))

	# Reihe c
	ifelse(index(`$4', `c'), `-1', , `define(`MINY', 100)'
		forloop(`i', 1, 16, `PIN(eval(2000 - 100 *i), 100, 60, 30, eval(32 + i))
	'))
    # Rueckseite Kontaktstifte
	forloop(`i', 1, 16, `ElementLine(XPOS MINY XPOS 375 40)
	')

	# Befestigungsbohrung
	Pin( 200 400 120 80 "M1" 0x01)
	Pin(2100 400 120 80 "M2" 0x01)

	# Begrenzung M1
	ElementLine( 100  300  320  300 20)
	ElementLine( 320  300  320  395 20)
	ElementLine( 320  395  320  620 10)
	ElementLine( 320  620  200  620 10)
	ElementLine( 200  620  100  620 20)
	ElementLine( 100  620  100  300 20)

	# Begrenzung M2
	ElementLine(1980  300 2200  300 20)
	ElementLine(2200  300 2200  620 20)
	ElementLine(2200  620 2100  620 20)
	ElementLine(2100  620 1980  620 10)
	ElementLine(1980  620 1980  395 10)
	ElementLine(1980  395 1980  300 20)

	# Kante Pins
	ElementLine( 320  395 1980  395 20)

	# Kanten Stifte
	ElementLine( 200 620  200 800 20)
	ElementLine( 200 800 2100 800 20)
	ElementLine(2100 800 2100 620 20)

	Mark(1900 300)
)')

define(`PKG_DIN41_612FEMALE_SMALL',
	`define(`MAXX', 420)
	define(`MAXX1', `eval(MAXX -170)')
	define(`MAXX2', `eval(MAXX -40)')
Element(0x00 "$1" "`$2'" "$3" 50 100 3 200 0x00)
(
	# Reihe a
	ifelse(index(`$4', `a'), `-1', ,
		forloop(`i', 1, 16, `PIN(200, eval(300 + 100 *i), 60, 30, i)
	'))

	# Reihe b
	ifelse(index(`$4', `b'), `-1', ,
		forloop(`i', 1, 16, `PIN(300, eval(300 + 100 *i), 60, 30, eval(16 + i))
	'))

	# Reihe c
	ifelse(index(`$4', `c'), `-1', , `define(`MAXX', 520)'
		forloop(`i', 1, 16, `PIN(400, eval(300 + 100 *i), 60, 30, eval(32 + i))
	'))

	# Befestigungsbohrung
	Pin(290  180 120 80 "M1" 0x01)
	Pin(290 2120 120 80 "M2" 0x01)

	# Aeussere Begrenzung
	ElementLine( 80  80 MAXX   80 20)
	ElementLine(MAXX  80 MAXX 2220 20)
	ElementLine(MAXX 2220 80 2220 20)
	ElementLine( 80 2220 80   80 20)

	# Innere Begrenzung
	ElementLine(120  320 MAXX1  320 10)
	ElementLine(MAXX1  320 MAXX1  360 10)
	ElementLine(MAXX1  360 MAXX2  360 10)
	ElementLine(MAXX2  360 MAXX2 1940 10)
	ElementLine(MAXX2 1940 MAXX1 1940 10)
	ElementLine(MAXX1 1940 MAXX1 1980 10)
	ElementLine(MAXX1 1980 120 1980 10)
	ElementLine(120 1980 120  320 10)

	# Markierung: Pin 1a
	Mark(200 400)
)')


# ---------------------------------------------------------------
# base definition (housing) for connector DIN 41.612
# 11/95 Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de)
# female package added 05/96 also by Volker Bosch
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: requested rows a,b,c
#
define(`PKG_DIN41_612MALE',
	`define(`XPOS', `eval(300 + 100 * i)')
	define(`MINY', 300)
Element(0x00 "$1" "`$2'" "$3" 520 550 0 200 0x00)
(
	# Reihe a
	ifelse(index(`$4', `a'), `-1', ,
		forloop(`i', 1, 32, `PIN(eval(3600 - 100 *i), 300, 60, 30, i)
	'))

	# Reihe b
	ifelse(index(`$4', `b'), `-1', , `define(`MINY', 200)'
		forloop(`i', 1, 32, `PIN(eval(3600 - 100 *i), 200, 60, 30, eval(32 + i))
	'))

	# Reihe c
	ifelse(index(`$4', `c'), `-1', , `define(`MINY', 100)'
		forloop(`i', 1, 32, `PIN(eval(3600 - 100 *i), 100, 60, 30, eval(64 + i))
	'))
    # Rueckseite Kontaktstifte
	forloop(`i', 1, 32, `ElementLine(XPOS MINY XPOS 375 40)
	')

	# Befestigungsbohrung
	Pin( 200 400 120 80 "M1" 0x01)
	Pin(3700 400 120 80 "M2" 0x01)

	# Begrenzung M1
	ElementLine( 100  300  320  300 20)
	ElementLine( 320  300  320  395 20)
	ElementLine( 320  395  320  620 10)
	ElementLine( 320  620  200  620 10)
	ElementLine( 200  620  100  620 20)
	ElementLine( 100  620  100  300 20)

	# Begrenzung M2
	ElementLine(3580  300 3800  300 20)
	ElementLine(3800  300 3800  620 20)
	ElementLine(3800  620 3700  620 20)
	ElementLine(3700  620 3580  620 10)
	ElementLine(3580  620 3580  395 10)
	ElementLine(3580  395 3580  300 20)

	# Kante Pins
	ElementLine( 320  395 3580  395 20)

	# Kanten Stifte
	ElementLine( 200 620  200 800 20)
	ElementLine( 200 800 3700 800 20)
	ElementLine(3700 800 3700 620 20)

	Mark(3500 300)
)')

define(`PKG_DIN41_612FEMALE',
	`define(`MAXX', 420)
	define(`MAXX1', `eval(MAXX -170)')
	define(`MAXX2', `eval(MAXX -40)')
Element(0x00 "$1" "`$2'" "$3" 50 100 3 200 0x00)
(
	# Reihe a
	ifelse(index(`$4', `a'), `-1', ,
		forloop(`i', 1, 32, `PIN(200, eval(300 + 100 *i), 60, 30, i)
	'))

	# Reihe b
	ifelse(index(`$4', `b'), `-1', ,
		forloop(`i', 1, 32, `PIN(300, eval(300 + 100 *i), 60, 30, eval(32 + i))
	'))

	# Reihe c
	ifelse(index(`$4', `c'), `-1', , `define(`MAXX', 520)'
		forloop(`i', 1, 32, `PIN(400, eval(300 + 100 *i), 60, 30, eval(64 + i))
	'))

	# Befestigungsbohrung
	Pin(290  180 120 80 "M1" 0x01)
	Pin(290 3720 120 80 "M2" 0x01)

	# Aeussere Begrenzung
	ElementLine( 80  80 MAXX   80 20)
	ElementLine(MAXX  80 MAXX 3820 20)
	ElementLine(MAXX 3820 80 3820 20)
	ElementLine( 80 3820 80   80 20)

	# Innere Begrenzung
	ElementLine(120  320 MAXX1  320 10)
	ElementLine(MAXX1  320 MAXX1  360 10)
	ElementLine(MAXX1  360 MAXX2  360 10)
	ElementLine(MAXX2  360 MAXX2 3540 10)
	ElementLine(MAXX2 3540 MAXX1 3540 10)
	ElementLine(MAXX1 3540 MAXX1 3580 10)
	ElementLine(MAXX1 3580 120 3580 10)
	ElementLine(120 3580 120  320 10)

	# Markierung: Pin 1a
	Mark(200 400)
)')

# ---------------------------------------------------------------
# base definition (housing) for connector DIN 41.651 laying and standing
# 05/96 Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de)
#
# Changed hole size from 20 mils to 28 mils; 07/00 LRDoolittle@lbl.gov
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: number of pins
#
define(`PKG_DIN41_651LAY',
	`define(`MAXY', `eval($4/2 *100 +400)')
	define(`CENTERY', `eval($4/2 *50 +425)')
Element(0x00 "$1" "`$2'" "$3" 400 250 3 200 0x00)
(
	forloop(`i', 1, eval($4 / 2),
		`PIN(100,  eval(100*i +400), 60, 40, eval(2*i-1))
		PIN(200, eval(100*i +400), 60, 40, eval(2*i))
	')

	# Befestigungsbohrung
	Pin(180  270 100 80 "M1" 0x01)
	Pin(180 eval(MAXY+230) 100 80 "M2" 0x01)

	# aeusserer Rahmen
	ElementLine(80 70 335 70 20)
	ElementLine(335 70 770 200 20)
	ElementLine(770 200 770 300 20)
	ElementLine(770 300 610 390 20)
	ElementLine(610 390 610 eval(MAXY+150) 20)
	ElementLine(610 eval(MAXY+150) 770 eval(MAXY+200) 20)
	ElementLine(770 eval(MAXY+200) 770 eval(MAXY+300) 20)
	ElementLine(770 eval(MAXY+300) 335 eval(MAXY+430) 20)
	ElementLine(335 eval(MAXY+430) 80 eval(MAXY+430) 20)
	ElementLine( 80 eval(MAXY+430) 80 70 20)

	# Codieraussparung
	ElementLine(610 eval(CENTERY -50) 435 eval(CENTERY -50) 5)
	ElementLine(435 eval(CENTERY -50) 435 eval(CENTERY +100) 5)
	ElementLine(435 eval(CENTERY +100) 610 eval(CENTERY +100) 5)

	# Markierung Pin 1
	ElementLine(610 450 500 500 5)
	ElementLine(500 500 610 550 5)

	# Plazierungsmarkierung == Pin 1
	Mark(100 500)
)')

define(`PKG_DIN41_651STAND',
	`define(`MAXY', `eval($4/2 *100 +400)')
	define(`CENTERY', `eval($4/2 *50 +425)')
Element(0x00 "$1" "`$2'" "$3" 50 100 3 200 0x00)
(
	forloop(`i', 1, eval($4 / 2),
		`PIN(200,  eval(100*i +400), 60, 40, eval(2*i-1))
		PIN(300, eval(100*i +400), 60, 40, eval(2*i))
	')
	# aeusserer Rahmen
	ElementLine(90 70 410 70 20)
	ElementLine(410 70 410 eval(MAXY +430) 20)
	ElementLine(410 eval(MAXY +430) 90 eval(MAXY +430) 20)
	ElementLine(90 eval(MAXY +430) 90 70 20)

	# innerer Rahmen mit Codieraussparung
	ElementLine(110  350 390  350 5)
	ElementLine(390  350 390 eval(MAXY +150) 5)
	ElementLine(390 eval(MAXY +150) 110 eval(MAXY +150) 5)
	ElementLine(110 eval(MAXY +150) 110 eval(CENTERY +100) 5)
	ElementLine(110 eval(CENTERY +100)  90 eval(CENTERY +100) 5)
	ElementLine(90  eval(CENTERY -50) 110 eval(CENTERY -50) 5)
	ElementLine(110 eval(CENTERY -50) 110  350 5)

	# Markierung Pin 1
	ElementLine(110 390 150 350 5)

	# Auswurfhebel oben
	ElementLine(200 70 200 350 5)
	ElementLine(300 70 300 350 5)

	# Auswurfhebel unten
	ElementLine(200 eval(MAXY+150) 200 eval(MAXY+430) 5)
	ElementLine(300 eval(MAXY+150) 300 eval(MAXY+430) 5)

	# Plazierungsmarkierung == Pin 1
	Mark(200 500)
)')

# ---------------------------------------------------------------
# base definition (housing) for SUB-D connectors, laying
# 11/95 Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de)
# female package added 05/96 also by Volker Bosch
# Pins reordered, 12/99 Larry Doolittle  <LRDoolittle@lbl.gov>

# Connector dimensions changed!  No, these stupid things don't
# line up neatly on a 50 mil grid.  Now corresponds to AMP's
# Application Specification 114-40013 03-APR-97 Rev B, for
# AMPLIMITE[TM] HD-20 Series 454 and 545.
# Also pulled silkscreen lines away from pins by NOSMUDGE.
# 12/99 Larry Doolittle  <LRDoolittle@lbl.gov>
#
# Parameterized silkscreen in terms of PANEL_DISTANCE, the distance
# from the drilling holes to the intended edge of the board.
# According to the drawing listed above, that should be 398 or 489
# plus some unknown flange thickness.  For the part I have in my hand
# (AMP 747846-4), it's about 365 mils.  The original version of this
# macro had it hard coded at 460.  I also reduced size of pads and holes
# to 60/35.  The drawing listed above recommends 47 mil holes, the part
# in my hand has 28 mil pins.
#
# Status: Female tested, works great, 07-Jan-2000.
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: pins
#
# base is upper drilling hole
#
define(`PKG_SUBD_LAY_BASE',
	`define(`BASEX', 1000)
	define(`BASEY', 1000)
	define(`PY1', `eval(BASEY +270)')
	define(`PY2', `eval(PY1 +($4-1)/2*108)')
	define(`OFFSET', `eval(($4+1)/2)')
	define(`PANEL_DISTANCE', 365)
Element(0x00 "$1" "`$2'" "$3" eval(BASEX-0) eval(PY2-0) 1 150 0x00)
(
	# Gehaeuse (schmaler Kasten incl. Bohrungen)
	define(`X1', `eval(BASEX-PANEL_DISTANCE)')
	define(`Y1', `eval(PY1-390)')
	define(`X2', `eval(BASEX-PANEL_DISTANCE+30)')
	define(`Y2', `eval(PY2+390)')
	ElementLine(X1 Y1 X2 Y1 10)
	ElementLine(X2 Y1 X2 Y2 10)
	ElementLine(X2 Y2 X1 Y2 10)
	ElementLine(X1 Y2 X1 Y1 10)
	ElementLine(X1 eval(Y1+60) X2 eval(Y1+60) 10)
	ElementLine(X1 eval(Y1+180) X2 eval(Y1+180) 10)
	ElementLine(X1 eval(Y2-60) X2 eval(Y2-60) 10)
	ElementLine(X1 eval(Y2-180) X2 eval(Y2-180) 10)

	# Gehaeuse (aeusserer Kasten)
	# This part of the connector normally hangs off the circuit board,
	# so it is confusing to actually mark it on the silkscreen
	# define(`X1', `eval(BASEX-PANEL_DISTANCE-260)')
	# define(`Y1', `eval(PY1-100)')
	# define(`X2', `eval(BASEX-PANEL_DISTANCE)')
	# define(`Y2', `eval(PY2+100)')
	# ElementLine(X1 Y1 X2 Y1 20)
	# ElementLine(X2 Y1 X2 Y2 10)
	# ElementLine(X2 Y2 X1 Y2 20)
	# ElementLine(X1 Y2 X1 Y1 20)

	# Gehaeuse (innerer Kasten)
	define(`X1', `eval(BASEX-PANEL_DISTANCE+30)')
	define(`Y1', `eval(PY1-160)')
	define(`X2', `eval(BASEX-230)')
	define(`Y2', `eval(PY2+160)')
	ElementLine(X1 Y1 X2 Y1 20)
	ElementLine(X2 Y1 X2 Y2 20)
	ElementLine(X2 Y2 X1 Y2 20)
	ElementLine(X1 Y2 X1 Y1 10)

	# Pins
	SUBD_SUBFUNCTION

	# Befestigungsbohrung
	Pin(BASEX  BASEY 250 125 "C1" 0x01)
	Pin(BASEX eval(PY2+270) 250 125 "C2" 0x01)

)')

define(`PKG_SUBD_MALE_LAY',
	`define(`SUBD_SUBFUNCTION',
		`
		define(`NOSMUDGE', 40)
		# First row
		forloop(`i', 1, eval($4/2),
			`define(`Y', eval(PY1 +(i-1)*108))
			PIN(eval(BASEX+56), Y, 60, 35, i)
			ElementLine(eval(BASEX+56-NOSMUDGE) Y X2 Y 20)
		')

		# Last pin in first row
		PIN(eval(BASEX+56), PY2, 60, 35, OFFSET)
		ElementLine(eval(BASEX+56-NOSMUDGE) PY2 X2 PY2 20)

		# Second row
		forloop(`i', 1, eval($4/2),
			`define(`Y', eval(PY1 +(i-1)*108+54))
			PIN(eval(BASEX-56), Y, 60, 35, eval(i+OFFSET))
			ElementLine(eval(BASEX-56-NOSMUDGE) Y X2 Y 20)
		')
		# Plazierungsmarkierung == PIN 1
		Mark(eval(BASEX +50) PY1)
	')'
	`PKG_SUBD_LAY_BASE(`$1', `$2', `$3', `$4')'
)

define(`PKG_SUBD_FEMALE_LAY',
	`define(`SUBD_SUBFUNCTION',
		`
		define(`NOSMUDGE', 40)
		# Pin 1
		PIN(eval(BASEX+56), PY2, 60, 35, 1)
		ElementLine(eval(BASEX+56-NOSMUDGE) PY2 X2 PY2 20)

		# Plazierungsmarkierung == PIN 1
		# Changed PY1 to PY2 13-Dec-1999 LRD
		Mark(eval(BASEX +56) PY2)

		# Remainder of the first row
		forloop(`i', 1, eval($4/2),
			`define(`Y', eval(PY1 +($4/2-i)*108))
			PIN(eval(BASEX+56), Y, 60, 35, eval($4/2+i+2-OFFSET))
			ElementLine(eval(BASEX+56-NOSMUDGE) Y X2 Y 20)
		')

		# Second row
		forloop(`i', 1, eval($4/2),
			`define(`Y', eval(PY1 +($4/2-i)*108+54))
			PIN(eval(BASEX-56), Y, 60, 35, eval($4/2+i+1))
			ElementLine(eval(BASEX-56-NOSMUDGE) Y X2 Y 20)
		')
	')'
	`PKG_SUBD_LAY_BASE(`$1', `$2', `$3', `$4')'
)

# ---------------------------------------------------------------
# definition for a right angle BNC connector,
# such as Amphenol 31-5640-1010 or OUPIIN 8928
# 12/99 Larry Doolittle <LRDoolittle@lbl.gov>
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: pins
#
# base is one of the pegs
#
define(`PKG_BNC_LAY',
	`define(`BASEX', 200)
	define(`BASEY', -200)
Element(0x00 "$1" "`$2'" "$3" BASEX eval(BASEY+200) 3 100 0x00)
(
	define(`X1', `eval(BASEX-260)')
	define(`Y1', `eval(BASEY-90)')
	define(`X2', `eval(BASEX+290)')
	define(`Y2', `eval(BASEY+490)')
	ElementLine(X1 Y1 X2 Y1 10)
	ElementLine(X2 Y1 X2 Y2 10)
	ElementLine(X2 Y2 X1 Y2 10)
	ElementLine(X1 Y2 X1 Y1 10)
	PIN(eval(BASEX-200), eval(BASEY+200), 60, 35, 1)
	PIN(eval(BASEX-200), eval(BASEY+100), 60, 35, 2)
	PIN(eval(BASEX),     eval(BASEY),     100, 81, m1)
	PIN(eval(BASEX),     eval(BASEY+400), 100, 81, m2)
)')


# ---------------------------------------------------------------
# definition for MTA-100 header,
# such as AMP 640456-x
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: pins
#
#      0.100" pin pitch
#      0.038" drill diameter
#      0.060" pad diameter
#      Available with 2 through 15 pins
#
define(`PKG_MTA_100',
`
        define(`PITCH', `100')
        define(`NPINS', `eval($4)')
        define(`SILKW', `10')
        define(`SILKXOFS', `75')
        define(`SILKYOFS', `115')
        define(`SILKX1', `-SILKXOFS')
        define(`SILKX2', `eval((NPINS-1)*PITCH + SILKXOFS)')
        define(`SILKY1', `-SILKYOFS')
        define(`SILKY2', `SILKYOFS')
        define(`SILKY3', `eval(SILKYOFS+2*SILKW)')

Element(0x00 "$1" "`$2'" "$3" 0  140 0 150 0x00)
(
        forloop(`i', 1, `$4',
                `PIN(eval((i-1)*100), 0, 60, 38, `i')
        ')
        define(`X1',-78)
        define(`X2', `eval(`$4'*100-78)')
        ElementLine(SILKX1  SILKY1 SILKX2 SILKY1 SILKW) 
        ElementLine(SILKX2  SILKY1 SILKX2 SILKY3 SILKW) 
        ElementLine(SILKX2  SILKY2 SILKX1 SILKY2 SILKW) 
        ElementLine(SILKX1  SILKY3 SILKX1 SILKY1 SILKW) 

        ElementLine(SILKX2  SILKY3 SILKX1 SILKY3 SILKW) 

        Mark(0 0)
)')

# ---------------------------------------------------------------
# definition for MTA-156 header,
# such as AMP 640445-x
# 12/99 Larry Doolittle <LRDoolittle@lbl.gov>
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: pins
#
# base is pin 1 (although I don't claim to know which end is
#                conventionally pin 1)
#      0.156 pin pitch
#      0.070 holes
#      0.078 end clearance
#      0.180 and 0.120 side clearance
#      Available with 2 through 24 pins
#
define(`PKG_MTA_156',
	`
Element(0x00 "$1" "`$2'" "$3" 0  140 0 150 0x00)
(
	forloop(`i', 1, `$4',
		`PIN(eval((i-1)*156), 0, 100, 70, `i')
	')
	define(`X1',-78)
	define(`X2', `eval(`$4'*156-78)')
	ElementLine(X1  120 X2  120 10) 
	ElementLine(X2  120 X2 -180 10) 
	ElementLine(X2 -180 X1 -180 10) 
	ElementLine(X2  -80 X1  -80 10) 
	ElementLine(X1 -180 X1  120 10)
)')

# ---------------------------------------------------------------
# definition for a vertical SMA connector,
# 6/00 Larry Doolittle <LRDoolittle@lbl.gov>
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: pins
#
# base is the center pin
#
define(`PKG_SMA_VERT',
	`define(`BASEX', 0)
	define(`BASEY', 0)
Element(0x00 "$1" "`$2'" "$3" BASEX eval(BASEY+150) 3 100 0x00)
(
	define(`X1', `eval(BASEX-160)')
	define(`Y1', `eval(BASEY-160)')
	define(`X2', `eval(BASEX+160)')
	define(`Y2', `eval(BASEY+160)')
	ElementLine(X1 Y1 X2 Y1 10)
	ElementLine(X2 Y1 X2 Y2 10)
	ElementLine(X2 Y2 X1 Y2 10)
	ElementLine(X1 Y2 X1 Y1 10)
	PIN(     BASEX     ,      BASEY     , 80, 30, 1)
	PIN(eval(BASEX-100), eval(BASEY+100), 80, 30, 2)
	PIN(eval(BASEX-100), eval(BASEY-100), 80, 30, 3)
	PIN(eval(BASEX+100), eval(BASEY+100), 80, 30, 4)
	PIN(eval(BASEX+100), eval(BASEY-100), 80, 30, 5)
)')

# ---------------------------------------------------------------
# definition for a Molex high density connector, 53467/53645
# Board-to-Board 0.635mm (0.25") Ptich Plug - SMT Dual Row, Vertical Stacking
# Reference: http://www.molex.com/product/micro/53467.html
# 4/01 Larry Doolittle <LRDoolittle@lbl.gov>
#
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: pins
#
# base is on the symmetry line, between pins 1 and 2
#
define(`PKG_MOLEX_025',
	`define(`PINPAIRS',`eval($4/2)')
Element(0x00 "$1" "`$2'" "$3" 0 0 3 100 0x00)
(
	forloop(`i', 1, PINPAIRS,
		`define(`Y', eval(25*(i-1)) )'
		`PAD(  54, Y, 111, Y, 14, eval(i*2-1))'
		`PAD(-111, Y, -54, Y, 14, eval(i*2))'
	)
	define(`ENDY',eval(25*(PINPAIRS-1)))

	# Keying is done with two sizes of alignment pins: 35 and 28 mils
	Pin(0 -50 50 35 "M1" 0x01)
	Pin(0 eval(ENDY+50) 43 28 "M2" 0x01)

	# ends of mounting pads are 71 and 169 mils from end pad centers
	PAD(0, -110, 0, -130, 79, M3)
	PAD(0, eval(ENDY+110), 0, eval(ENDY+130), 79, M4)

	define(`BOXY',eval(ENDY+150))
	ElementLine(-100 -150   50 -150 10)
	ElementLine(  50 -150  100 -100 10)
	ElementLine( 100 -100  100 BOXY 10)
	ElementLine( 100 BOXY -100 BOXY 10)
	ElementLine(-100 BOXY -100 -150 10)

	# Support for aggregate parts built from this base, like
	# the nanoEngine below.
	ifdef(`MOLEX_EXTRA', `MOLEX_EXTRA', )
)')

# ---------------------------------------------------------------
# definition for a Bright Star nanoEngine, StrongARM single board computer
# Reference: http://www.brightstar.com/arm/nanoman.pdf
# 4/01 Larry Doolittle <LRDoolittle@lbl.gov>
#
# $1: canonical name
# $2: name on PCB
# $3: value
#
# base borrowed from the Molex connector
#
define(`PKG_NANOENGINE',
	`define(`MOLEX_EXTRA', `
		ElementLine(-175 -215 -175 2185 15)
		ElementLine(-175 2185 1225 2185 15)
		ElementLine(1225 2185 1225 -215 15)
		ElementLine(1225 -215 -175 -215 15)
		Pin(525 -115 125 70 "M5" 0x01)
		Pin(525 2085 125 70 "M6" 0x01)
	')'
	`PKG_MOLEX_025($1, $2, $3, 160)'
)

# -------------------------------------------------------------------
# the definition of a through hole test point
# $1: canonical name
# $2: name on PCB
# $3: value
# $4: drill diameter (mils)
# $5: silk diameter  (mils)
#
define(`PKG_TP',
        `
	define(`DRILL', `$4')
	define(`SILK',  `eval($5/2)')
	define(`PADDIA', `eval(DRILL + 20)')
	define(`SILKW', `10')
Element(0x00 "$1" "`$2'" "$3" -20 eval(-SILK - 60) 0 100 0x00)
(
	Pin( 0 0 PADDIA DRILL "1" "1" 0x0)
	ElementArc(0 0 SILK SILK 0 360 SILKW)
	
	# Mark at the common centroid
        Mark(0 0)
)')