FreeCalypso > hg > ueda-linux
comparison ifctf-part-lib/uschem-symbols/mkheader.c @ 0:cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 20 Jul 2015 00:24:37 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cd92449fdb51 |
---|---|
1 /* | |
2 * This program generates a uschem (subset of gschem) symbol | |
3 * for a dual-row header. Can also be used for board-to-board connectors. | |
4 */ | |
5 | |
6 #include <stdio.h> | |
7 #include <strings.h> | |
8 #include <ctype.h> | |
9 | |
10 int npins, btb; | |
11 int pinlength = 300, vstep = 400, boxwidth = 800; | |
12 int textoff_x = 75, textoff_y = 50; | |
13 int curpin, ycoord; | |
14 | |
15 doit() | |
16 { | |
17 ycoord = npins / 2 * vstep; | |
18 printf("B %d 0 %d %d 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1\n", pinlength, | |
19 boxwidth, ycoord); | |
20 if (!btb) | |
21 printf("L %d %d %d 0 3 0 0 0 -1 -1\n", | |
22 pinlength + boxwidth / 2, ycoord, | |
23 pinlength + boxwidth / 2); | |
24 for (curpin = 1; curpin <= npins; ) { | |
25 ycoord -= vstep / 2; | |
26 printf("P 0 %d %d %d 1 0 0\n{\n", ycoord, pinlength, ycoord); | |
27 printf("T %d %d 5 8 1 1 0 6 1\n", pinlength - textoff_x, | |
28 ycoord + textoff_y); | |
29 printf("pinnumber=%d\n}\n", curpin++); | |
30 printf("P %d %d %d %d 1 0 1\n{\n", pinlength + boxwidth, ycoord, | |
31 pinlength * 2 + boxwidth, ycoord); | |
32 printf("T %d %d 5 8 1 1 0 0 1\n", | |
33 pinlength + boxwidth + textoff_x, ycoord + textoff_y); | |
34 printf("pinnumber=%d\n}\n", curpin); | |
35 ycoord -= vstep / 2; | |
36 if (!btb && curpin < npins) | |
37 printf("L %d %d %d %d 3 0 0 0 -1 -1\n", pinlength, | |
38 ycoord, pinlength + boxwidth, ycoord); | |
39 curpin++; | |
40 } | |
41 } | |
42 | |
43 main(argc, argv) | |
44 char **argv; | |
45 { | |
46 char **ap; | |
47 | |
48 ap = argv + 1; | |
49 if (*ap && !strcmp(*ap, "-b")) { | |
50 ap++; | |
51 btb = 1; | |
52 } | |
53 if (!*ap || !isdigit(**ap)) { | |
54 fprintf(stderr, "usage: %s [-b] npins\n", argv[0]); | |
55 exit(1); | |
56 } | |
57 npins = atoi(*ap); | |
58 if (npins < 2 || npins & 1) { | |
59 fprintf(stderr, "%s: invalid npins argument\n", argv[0]); | |
60 exit(1); | |
61 } | |
62 doit(); | |
63 exit(0); | |
64 } |