FreeCalypso > hg > ueda-linux
comparison ueda/mclutils/mkbom.c @ 81:6e43956e740d
beginning of BOM utils refactoring: seqrefdes code factored out
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 23 Feb 2017 19:15:48 +0000 |
parents | df98a82b807e |
children | 20c6f84c75e7 |
comparison
equal
deleted
inserted
replaced
80:df98a82b807e | 81:6e43956e740d |
---|---|
1 /* | 1 /* |
2 * This program generates a procurement-oriented BOM from the MCL. | 2 * This program generates a procurement-oriented BOM from the MCL. |
3 */ | 3 */ |
4 | 4 |
5 #include <ctype.h> | |
6 #include <stdio.h> | 5 #include <stdio.h> |
7 #include <stdlib.h> | 6 #include <stdlib.h> |
8 #include <string.h> | 7 #include <string.h> |
9 #include <strings.h> | 8 #include <strings.h> |
10 #include <unistd.h> | 9 #include <unistd.h> |
122 bp->qty = 1; | 121 bp->qty = 1; |
123 bp->next = NULL; | 122 bp->next = NULL; |
124 bp->refdeslist = NULL; | 123 bp->refdeslist = NULL; |
125 *bpp = bp; | 124 *bpp = bp; |
126 add_refdes_to_bompart(bp, refdes); | 125 add_refdes_to_bompart(bp, refdes); |
127 } | |
128 | |
129 is_string_num(str) | |
130 char *str; | |
131 { | |
132 if (*str < '1' || *str > '9') | |
133 return(0); | |
134 while (isdigit(*str)) | |
135 str++; | |
136 if (*str) | |
137 return(0); | |
138 else | |
139 return(1); | |
140 } | |
141 | |
142 is_refdes_sequential(str1, str2) | |
143 char *str1, *str2; | |
144 { | |
145 int num1, num2; | |
146 | |
147 while (isupper(*str1)) | |
148 if (*str1++ != *str2++) | |
149 return(0); | |
150 if (!is_string_num(str1) || !is_string_num(str2)) | |
151 return(0); | |
152 num1 = atoi(str1); | |
153 num2 = atoi(str2); | |
154 if (num2 == num1 + 1) | |
155 return(1); | |
156 else | |
157 return(0); | |
158 } | 126 } |
159 | 127 |
160 add_refdes_to_bompart(bp, refdes) | 128 add_refdes_to_bompart(bp, refdes) |
161 struct bompart *bp; | 129 struct bompart *bp; |
162 char *refdes; | 130 char *refdes; |