FreeCalypso > hg > ueda-linux
annotate pads2gpcb/mainoutput.c @ 152:d41cdd682db5
m4-fp: support for CUI DS04-254-SMT DIP switch series
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 24 Jun 2021 05:13:16 +0000 |
parents | 58f11f06d831 |
children |
rev | line source |
---|---|
74
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include <stdio.h> |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 #include <stdlib.h> |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 #include "globals.h" |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 #include "struct.h" |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 write_elements_pcb(filename) |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 char *filename; |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 { |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 struct part_instance *p; |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 FILE *outf; |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 outf = fopen(filename, "w"); |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 if (!outf) { |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 perror(filename); |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 exit(1); |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 } |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 for (p = part_inst_list; p; p = p->next) { |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 if (!p->newname) |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 continue; |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 write_gpcb_element(outf, p->body, p->type->alpha_pins, |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 p->type->name, p->newname, p->decal->name, |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 p->onbottom); |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 } |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 fclose(outf); |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 return(0); |
58f11f06d831
pads2gpcb: main output implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 } |