/* Link Strength Calculator v1.4*/ /* Copyright 1995 by Travis Dahl */ /* This program will accept a series of routings (quantity + workstations) */ /* Then it will calculate (by quantity) the number of times a link between */ /* two workstations was used. (Hopefully. ) */ /* v1.4: now printf "." instead of "0" in output */ /* v1.3.2: now checks for consecutive dupes, output is comma delimited */ /* instead of space-delimited */ /* v1.3.1: increased defined variables by 1 (except for stations) */ /* v1.3: increased stations (to 11) for layout, increased max_stations, */ /* max_rtgs for new tests; added function to get rid of dupe processes */ /* eg. saw-lathe-lathe-burr */ /* v1.2.1: changed data output so that data is labeled */ /* v1.2: attempted to stop "segmentation fault" error, data wasn't being */ /* read in correcly (sometimes routings split between rows of matrix) */ /* v1.1: fixed two minor problems (Wasn't using 0 column, Couldn't detect */ /* last routing) */ #include /* Remember to change max_rtgs and max_stations after testing */ #define max_rtgs 184 #define max_stations 21 #define stations 11 /* Function Prototypes */ int check_data(void); void link_check(void); /* Global variables */ long int rtgs[max_rtgs][max_stations]; int links[10*stations+9][10*stations+9]; /* Note: the links array is set up like links[from][to] */ int count; void main(void) { /* declare variables (just like going through customs) */ int i1, i2, data_bad, fred; /* Zero Arrays & initialize Variables*/ for (i1=0; i1(-1)) { /* If the station is repeated more than 4 times, it won't */ /* get caugh by this */ for (i3=0; i3<4; i3++) if (rtgs[i1][i2]==dummy) { /* Delete dupe and shrink routing */ for (i4=i2; i4(-1)) { curr=rtgs[i1][i2]; links[prev][curr]=links[prev][curr]+rtgs[i1][0]; prev=curr; } /* Make sure last work stations is Pack */ else if ((rtgs[i1][i2]==(-1)) && (prev!=10)) { printf ("\nError! Last work stations was not Pack(547) in line %d\n", i1); } } } }