annotate ifctf-part-lib/uschem-symbols/mkheader.c @ 128:e90e948e9368

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