FreeCalypso > hg > ueda-linux
comparison ueda/mclutils/getfps.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 | d098f8548b44 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cd92449fdb51 |
---|---|
1 /* | |
2 * This program "gets" all footprints for the board. The footprint attributes | |
3 * are extracted from the MCL and a set of M4 macro calls is emitted on stdout | |
4 * which when run through M4 will produce all footprints for the board with the | |
5 * refdes and value filled in. | |
6 */ | |
7 | |
8 #include <stdio.h> | |
9 #include <strings.h> | |
10 #include "../libueda/mcl.h" | |
11 | |
12 extern char *optarg; | |
13 | |
14 extern char *MCLfile; | |
15 extern struct component components[]; | |
16 extern int ncomponents; | |
17 extern char *get_comp_attr(); | |
18 | |
19 int check_completeness; | |
20 | |
21 main(argc, argv) | |
22 char **argv; | |
23 { | |
24 register int c; | |
25 register struct component *comp; | |
26 register char *footprint, *value; | |
27 | |
28 while ((c = getopt(argc, argv, "chM:")) != EOF) | |
29 switch (c) { | |
30 case 'c': | |
31 check_completeness++; | |
32 break; | |
33 case 'h': | |
34 puts("include(template.pcb)"); | |
35 break; | |
36 case 'M': | |
37 MCLfile = optarg; | |
38 break; | |
39 default: | |
40 /* getopt prints the error message */ | |
41 exit(1); | |
42 } | |
43 | |
44 read_MCL(); | |
45 | |
46 for (comp = components, c = 0; c < ncomponents; comp++, c++) { | |
47 footprint = get_comp_attr(comp, "footprint"); | |
48 if (!footprint) { | |
49 if (check_completeness) | |
50 fprintf(stderr, "%s has no footprint\n", | |
51 comp->name); | |
52 continue; | |
53 } | |
54 if (!strcmp(footprint, "none")) | |
55 continue; | |
56 if (!strcmp(footprint, "TBD")) { | |
57 if (check_completeness) | |
58 fprintf(stderr, "%s: footprint=TBD\n", | |
59 comp->name); | |
60 continue; | |
61 } | |
62 value = get_comp_attr(comp, "pcbvalue"); | |
63 if (!value) | |
64 value = get_comp_attr(comp, "value"); | |
65 if (!value) | |
66 value = get_comp_attr(comp, "device"); | |
67 if (!value) | |
68 value = get_comp_attr(comp, "manufacturer_part_number"); | |
69 if (!value) | |
70 value = ""; | |
71 if (strncmp(footprint, "file:", 5)) | |
72 printf("make_footprint(`%s',`%s',`%s')\n", footprint, | |
73 comp->name, value); | |
74 else | |
75 printf("make_footprint_file(`%s',`%s',`%s')\n", | |
76 footprint + 5, comp->name, value); | |
77 } | |
78 exit(0); | |
79 } |