annotate pads2gpcb/silkselect.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 9d7e2937883d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
62
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 #define MAX_LEVEL_SELECT 8
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 static int select_array[MAX_LEVEL_SELECT];
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 static int num_select;
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 select_drawlevel_for_silk(level)
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 {
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 if (num_select >= MAX_LEVEL_SELECT) {
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 fprintf(stderr, "Error: MAX_LEVEL_SELECT exceeded\n");
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 exit(1);
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 }
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 select_array[num_select++] = level;
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 return(0);
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 }
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 is_drawlevel_selected(level)
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 {
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 int i;
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 for (i = 0; i < num_select; i++)
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 if (select_array[i] == level)
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 return(1);
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 return(0);
9d7e2937883d pads2gpcb: select specific drawing levels for silk with -s
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 }