File: pincounts.h

package info (click to toggle)
geda-gsymcheck 20050313-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 904 kB
  • ctags: 132
  • sloc: sh: 3,465; ansic: 1,587; makefile: 138
file content (43 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* pincounts.h */

typedef struct st_pincount PINCOUNT;

struct st_pincount {
	char *footprint;
	int pincount;
};

static PINCOUNT p_pincounts[] = {
	{ "footprint=TO92", 3 },
	{ "footprint=TO-220AB", 3 },
	{ NULL, 3 },
	};


int s_get_footprint_size(char *footprint)
{
  PINCOUNT *pcount = p_pincounts;
  char *tmp;
	
  while(pcount->footprint != NULL) {
    if (!strcasecmp(footprint, pcount->footprint))
      return pcount->pincount;
    pcount++;
  }

  tmp = &footprint[strlen(footprint)-1];

  while((*tmp >= '0') && (*tmp <= '9'))
  {
    if (tmp == footprint)
      return -1;
    tmp--;
  }
  tmp++;

  if (*tmp == '\0')
    return -1;
 
  return atoi(tmp);
}