# HG changeset patch # User Mychaela Falconia # Date 1487877348 0 # Node ID 6e43956e740d26e1af7bc98d4f9c8f4f1e62e824 # Parent df98a82b807e0cce72e8d4f80509407b55021241 beginning of BOM utils refactoring: seqrefdes code factored out diff -r df98a82b807e -r 6e43956e740d ueda/mclutils/Makefile --- a/ueda/mclutils/Makefile Thu Feb 23 18:54:47 2017 +0000 +++ b/ueda/mclutils/Makefile Thu Feb 23 19:15:48 2017 +0000 @@ -6,7 +6,13 @@ all: ${PROGS} -${PROGS}: ${LIBUEDA} +getfps: getfps.o ${LIBUEDA} + ${CC} ${CFLAGS} -o $@ $@.o ${LIBUEDA} + +mkbom: mkbom.o seqrefdes.o ${LIBUEDA} + ${CC} ${CFLAGS} -o $@ $@.o seqrefdes.o ${LIBUEDA} + +shortbom: shortbom.o ${LIBUEDA} ${CC} ${CFLAGS} -o $@ $@.o ${LIBUEDA} install: @@ -16,7 +22,3 @@ clean: rm -f *.[ao] a.out core errs ${PROGS} - -getfps: getfps.o -mkbom: mkbom.o -shortbom: shortbom.o diff -r df98a82b807e -r 6e43956e740d ueda/mclutils/mkbom.c --- a/ueda/mclutils/mkbom.c Thu Feb 23 18:54:47 2017 +0000 +++ b/ueda/mclutils/mkbom.c Thu Feb 23 19:15:48 2017 +0000 @@ -2,7 +2,6 @@ * This program generates a procurement-oriented BOM from the MCL. */ -#include #include #include #include @@ -126,37 +125,6 @@ add_refdes_to_bompart(bp, refdes); } -is_string_num(str) - char *str; -{ - if (*str < '1' || *str > '9') - return(0); - while (isdigit(*str)) - str++; - if (*str) - return(0); - else - return(1); -} - -is_refdes_sequential(str1, str2) - char *str1, *str2; -{ - int num1, num2; - - while (isupper(*str1)) - if (*str1++ != *str2++) - return(0); - if (!is_string_num(str1) || !is_string_num(str2)) - return(0); - num1 = atoi(str1); - num2 = atoi(str2); - if (num2 == num1 + 1) - return(1); - else - return(0); -} - add_refdes_to_bompart(bp, refdes) struct bompart *bp; char *refdes; diff -r df98a82b807e -r 6e43956e740d ueda/mclutils/seqrefdes.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ueda/mclutils/seqrefdes.c Thu Feb 23 19:15:48 2017 +0000 @@ -0,0 +1,40 @@ +/* + * Detection of sequential reference designators + * for the tallying of refdes lists in BOM outputs + */ + +#include +#include +#include + +static +is_string_num(str) + char *str; +{ + if (*str < '1' || *str > '9') + return(0); + while (isdigit(*str)) + str++; + if (*str) + return(0); + else + return(1); +} + +is_refdes_sequential(str1, str2) + char *str1, *str2; +{ + int num1, num2; + + while (isupper(*str1)) + if (*str1++ != *str2++) + return(0); + if (!is_string_num(str1) || !is_string_num(str2)) + return(0); + num1 = atoi(str1); + num2 = atoi(str2); + if (num2 == num1 + 1) + return(1); + else + return(0); +}