void outputstream ( /* ... */ ); void stor ( /* ... */ ); void rtos ( /* ... */ ); void readline ( /* ... */ ); void qualifierpresent ( /* ... */ ); productcode = "PLC", fname = "PLC", version = "2", release = "11", revision = "4"; void fatalerror ( /* ... */ ); void printidentification ( /* ... */ ); const int summary = 0; const int detail = 1; void warningmessage (message) { int s = outputstream; selectoutput (0); printstring (concat (fname, ": ")); printstring (message); newline (); selectoutput (1); printstring (concat (fname, ": ")); printstring (message); newline (); selectoutput (s); } void ps (s) { int i; for (i = 1; i <= strlen (s); i += 1) { if (s[(i) - 1] >= ' ') printsymbol (s[(i) - 1]); } } void printlimits (s, file, int mode) { // AST 1230: DECLARATION 1205 0 1227 // AST 1250: DECLARATION 1243 0 1247 if (setjmp ()) { newline (); return; } if ((strcmp (s, "") == 0) && (strcmp (file, "") == 0)) return; if ((strcmp (s, "") == 0)) { if (imp_resolve (file, concat ((":"), file))) { } if (imp_resolve (file, concat (("]"), file))) { } if (imp_resolve (file, concat (file, (";")))) { } if (strlen (file) == 12) { printstring (" from MEBES file"); } else { printstring (" default from input file"); } newline (); return; } else if (strstr (s, ("EXT"))) { printstring (" extents from input file"); newline (); return; } toupper (s); while (imp_resolve (s, concat (a, concat (("(INPUT "), b)))) s = concat (a, b); while (imp_resolve (s, concat (a, concat ((")"), b)))) s = concat (a, b); while (imp_resolve (s, concat (a, concat ((" "), b)))) s = concat (a, concat (" ", b)); while (imp_resolve (s, concat (a, concat ((" "), b)))) s = concat (a, concat (",", b)); if (imp_resolve (s, concat (lxs, concat ((","), a)))) { } if (imp_resolve (a, concat (lys, concat ((","), a)))) { } if (imp_resolve (a, concat (uxs, concat ((","), uys)))) { } if (mode == detail) { spaces (10 - strlen (lxs)); } else { space (); } printstring (lxs); printsymbol (','); printstring (lys); if (mode == detail) { spaces (20 - strlen (lys) - strlen (uxs)); } else { printstring (" to "); } printstring (uxs); printsymbol (','); printstring (uys); cx = ((float) ((stor (uxs) - stor (lxs))) / (float) (2 + stor (lxs))); cy = ((float) ((stor (uys) - stor (lys))) / (float) (2 + stor (lys))); cxs = rtos (cx, 0, 5); while (cxs[(strlen (cxs)) - 1] == '0') cxs[strlen (cxs) - 1] = '\0'; if (cxs[(strlen (cxs)) - 1] == '.') cxs[strlen (cxs) - 1] = '\0'; cys = rtos (cy, 0, 5); while (cys[(strlen (cys)) - 1] == '0') cys[strlen (cys) - 1] = '\0'; if (cys[(strlen (cys)) - 1] == '.') cys[strlen (cys) - 1] = '\0'; if (mode == detail) { spaces (20 - strlen (uys) - strlen (cxs)); } else { printstring (" centre "); } printstring (cxs); printsymbol (','); printstring (cys); newline (); } int main (int argc, char **argv) { const int maxlayer = 1000; const int true = 1, false = 0; const int primary = 0, secondary = 1, switch = 1; static gash =; // AST 3042: DECLARATION 3029 0 3039 file =, user = ""; const int eof = 16 _1827A, nsc = 16 _10001, nmf = 16 _182CA, topbit = 16 _10000000; // AST 3158: DECLARATION 3154 0 3155 int status; int count; int files; int total; int source; int hadfunction = false; // AST 3268: DECLARATION 3264 0 3265 // AST 3291: DECLARATION 3284 0 3288 cincnames[maxlayer - 1 + 1 /* hack for now */ ]; functions[maxlayer - 1 + 1 /* hack for now */ ]; static; static; grows[maxlayer - 1 + 1 /* hack for now */ ]; oselects[maxlayer - 1 + 1 /* hack for now */ ]; pselects[maxlayer - 1 + 1 /* hack for now */ ]; pinputs[maxlayer - 1 + 1 /* hack for now */ ]; plimits[maxlayer - 1 + 1 /* hack for now */ ]; psizings[maxlayer - 1 + 1 /* hack for now */ ]; pscalings[maxlayer - 1 + 1 /* hack for now */ ]; porients[maxlayer - 1 + 1 /* hack for now */ ]; players[maxlayer - 1 + 1 /* hack for now */ ]; pstructures[maxlayer - 1 + 1 /* hack for now */ ]; sselects[maxlayer - 1 + 1 /* hack for now */ ]; sinputs[maxlayer - 1 + 1 /* hack for now */ ]; slimits[maxlayer - 1 + 1 /* hack for now */ ]; ssizings[maxlayer - 1 + 1 /* hack for now */ ]; sscalings[maxlayer - 1 + 1 /* hack for now */ ]; sorients[maxlayer - 1 + 1 /* hack for now */ ]; slayers[maxlayer - 1 + 1 /* hack for now */ ]; sstructures[maxlayer - 1 + 1 /* hack for now */ ]; void checkfile () { // AST 4134: DECLARATION 4124 0 4131 if (setjmp ()) { return; } int main (int argc, char **argv) { if (setjmp ()) { warningmessage (concat ("Warning: Unable to open .cinc file ", rs)); // AST 4234: SIGNAL 4231 0 0 } openinput (1, rs); selectinput (1); } if (imp_resolve (rs, concat (("]"), cincname))) { } else if (imp_resolve (rs, concat (("/"), cincname))) { } else { cincname = rs; } if (! (imp_resolve (cincname, concat (cincname, (".CINC"))) || imp_resolve (cincname, concat (cincname, (".cinc"))))) return; int main (int argc, char **argv) { if (setjmp ()) { closeinput (); if (strcmp (grows (count), "0")) { if (strcmp (psizings (count), "0")) { if (stor (grows (count)) > 0 && stor (psizings (count)) > 0 || stor (grows (count)) < 0 && stor (psizings (count)) < 0) { if (!((strcmp (functions (count), "XOR") == 0))) { selectoutput (0); printstring (concat ("File ", concat (cincname, " has both GROW and Primary SIZE in same direction"))); newline (); if ((strcmp (user, "") == 0)) { selectinput (0); prompt ("Enter your initials to confirm this is OK: "); readline (user); toupper (user); } } } } if (strcmp (ssizings (count), "0")) { if (stor (grows (count)) > 0 && stor (ssizings (count)) > 0 || stor (grows (count)) < 0 && stor (ssizings (count)) < 0) { selectoutput (0); printstring (concat ("File ", concat (cincname, " has both GROW and Secondary SIZE in same direction"))); newline (); if (strcmp (user, "")) { selectinput (0); prompt ("Enter your initials to confirm this is OK: "); readline (user); toupper (user); } } } } return; } count += 1; cincnames[count] = cincname; strcpy (players[count], ""); strcpy (psizings[count], "0"); strcpy (porients[count], "0"); strcpy (pscalings[count], "1"); strcpy (players[count], ""); strcpy (pinputs[count], ""); strcpy (plimits[count], ""); strcpy (pstructures[count], ""); strcpy (ssizings[count], "0"); strcpy (sorients[count], "0"); strcpy (sscalings[count], "1"); strcpy (slayers[count], ""); strcpy (sinputs[count], ""); strcpy (sstructures[count], ""); strcpy (slimits[count], ""); strcpy (functions[count], ""); strcpy (grows[count], "0"); strcpy (oselects[count], "no"); strcpy (pselects[count], "no"); strcpy (sselects[count], "no"); strcpy (reverses[count], "no"); source = primary; for (;;) { readline (line); if (strlen (line) <= 3) continue; if ((strcmp (substring (line, 1, 3), "! #") == 0)) { count -= 1; return; } uline = line; toupper (uline); code = substring (uline, 1, 3); if (imp_resolve (line, concat ((" "), param))) { } if ((strcmp (code, "SWI") == 0)) { source = source ^ switch; } else if ((strcmp (code, "INP") == 0)) { if (source == primary) { strcpy (gash, ""); if (imp_resolve (param, concat ((":"), gash))) { } else if (imp_resolve (param, concat (("]"), gash))) { } else if (imp_resolve (param, concat (("/"), gash))) { } else { gash = param; } pinputs[count] = gash; } else { if (imp_resolve (param, concat ((":"), gash))) { } else if (imp_resolve (line, concat (("]"), gash))) { } else if (imp_resolve (line, concat (("/"), gash))) { } else { gash = param; } sinputs[count] = gash; } } else if ((strcmp (code, "LIM") == 0)) { if (source == primary) { plimits[count] = param; } else { slimits[count] = param; } } else if ((strcmp (code, "FUN") == 0)) { functions[count] = param; hadfunction = true; } else if ((strcmp (code, "RES") == 0)) { resolutions[count] = param; } else if ((strcmp (code, "GRO") == 0)) { grows[count] = param; } else if ((strcmp (code, "SIZ") == 0)) { if (source == primary) { psizings[count] = param; } else { ssizings[count] = param; } } else if ((strcmp (code, "SCA") == 0)) { if (source == primary) { pscalings[count] = param; } else { sscalings[count] = param; } } else if ((strcmp (code, "ORI") == 0)) { if (source == primary) { porients[count] = param; } else { sorients[count] = param; } } else if ((strcmp (code, "REV") == 0)) { reverses[count] = param; } else if ((strcmp (code, "SEL") == 0)) { if (strstr (uline, (" OUT"))) { strcpy (oselects[count], "YES"); } else if (source == primary) { strcpy (pselects[count], "YES"); } else { strcpy (sselects[count], "YES"); } } else if ((strcmp (code, "LAY") == 0)) { if (source == primary) { players[count] = param; } else { slayers[count] = param; } } else if ((strcmp (code, "STR") == 0)) { if (source == primary) { pstructures[count] = param; } else { sstructures[count] = param; } } } } } void outputinformation () { int i; int different; if (strcmp (user, "")) { printstring (concat ("User ", concat (user, " confirmed that same sign sizing was OK"))); newline (); } newline (); if (count > 1) { different = false; for (i = 2; i <= count; i += 1) { if (pinputs (i) != pinputs (1) || pstructures (i) != pstructures (1)) different = true; } } else { different = true; } if (different == false) { ps (concat ("All primary files input from " ", concat(pinputs(1), " ""))); if (strcmp (pstructures (1), "")) { ps (concat (" with structure " ", concat(pstructures(1), " ""))); } newline (); } else { printstring ("Filename Primary Input Structure"); newline (); for (i = 1; i <= count; i += 1) { ps (cincnames (i)); spaces (15 - strlen (cincnames (i))); ps (pinputs (i)); space (); spaces (30 - strlen (pinputs (i))); ps (pstructures (i)); newline (); } } if (hadfunction == true) { newline (); if (count > 1) { different = false; for (i = 2; i <= count; i += 1) { if (sinputs (i) != sinputs (1) || sstructures (i) != sstructures (1)) different = true; } } else { different = true; } if (different == false) { ps (concat ("All secondary files input from " ", concat(sinputs(1), " ""))); if (strcmp (sstructures (1), "")) { ps (concat (" with structure " ", concat(sstructures(1), " ""))); } newline (); } else { ps ("Filename Secondary Input Structure"); newline (); for (i = 1; i <= count; i += 1) { if ((strcmp (functions (i), "") == 0)) continue; ps (cincnames (i)); spaces (15 - strlen (cincnames (i))); ps (sinputs (i)); space (); spaces (30 - strlen (sinputs (i))); ps (sstructures (i)); newline (); } } } newline (); if (count > 1) { different = false; for (i = 2; i <= count; i += 1) { if (plimits (i) != plimits (1)) different = true; } } else { different = true; } if (different == false) { ps ("All primary files have LIMITS "); printlimits (plimits (1), pinputs (1), summary); } else { ps ("Filename Primary Limits LX,LY UX,UY CX,CY"); newline (); for (i = 1; i <= count; i += 1) { ps (cincnames (i)); spaces (15 - strlen (cincnames (i))); printlimits (plimits (i), pinputs (i), detail); } } if (hadfunction == true) { newline (); if (count > 1) { different = false; for (i = 2; i <= count; i += 1) { if (slimits (i) != slimits (1) || sinputs (i) != sinputs (1)) different = true; } } else { different = true; } if (different == false) { ps ("All secondary files have LIMITS "); printlimits (slimits (1), sinputs (1), summary); } else { ps ("Filename Secondary Limits LX,LY UX,UY CX,CY"); newline (); for (i = 1; i <= count; i += 1) { if ((strcmp (slimits (i), "") == 0) && (strcmp (sinputs (i), "") == 0)) continue; ps (cincnames (i)); spaces (15 - strlen (cincnames (i))); printlimits (slimits (i), sinputs (i), detail); } } } newline (); ps ("Filename Layers Resol'n Grow Sizing Scaling Orient Reverse Select"); newline (); for (i = 1; i <= count; i += 1) { ps (cincnames (i)); spaces (15 - strlen (cincnames (i))); if ((strcmp (players (i), "") == 0)) strcpy (players[i], "CFLT"); ps (players (i)); space (); spaces (14 - strlen (players (i))); junk = resolutions (i); if (strchr (junk, '.')) { while (junk[(strlen (junk)) - 1] == '0') junk[strlen (junk) - 1] = '\0'; if (junk[(strlen (junk)) - 1] == '0') strcat (junk, "0"); } ps (junk); space (); spaces (12 - strlen (junk) - strlen (grows (i))); ps (grows (i)); space (); junk = psizings (i); if (strchr (junk, '.')) { while (junk[(strlen (junk)) - 1] == '0') junk[strlen (junk) - 1] = '\0'; if (junk[(strlen (junk)) - 1] == '0') strcat (junk, "0"); } spaces (6 - strlen (junk)); ps (junk); space (); spaces (7 - strlen (pscalings (i))); ps (pscalings (i)); space (); spaces (6 - strlen (porients (i))); ps (porients (i)); spaces (4); ps (reverses (i)); space (); spaces (6 - strlen (reverses (i))); ps (pselects (i)); newline (); if (strcmp (functions (i), "")) { ps (" fun "); ps (functions (i)); spaces (8 - strlen (functions (i))); if ((strcmp (slayers (i), "") == 0)) strcpy (slayers[i], "CFLT"); ps (slayers (i)); space (); junk = ssizings (i); if (strchr (junk, '.')) { while (junk[(strlen (junk)) - 1] == '0') junk[strlen (junk) - 1] = '\0'; if (junk[(strlen (junk)) - 1] == '0') strcat (junk, "0"); } spaces (34 - strlen (slayers (i)) - strlen (junk)); ps (junk); space (); spaces (7 - strlen (sscalings (i))); ps (sscalings (i)); space (); spaces (6 - strlen (sorients (i))); ps (sorients (i)); spaces (11); ps (sselects (i)); newline (); } } } if (qualifierpresent ("IDENTIFY")) { printidentification (); if (!(qualifierpresent ("FILE"))) return; } count = 0; files = 0; for (;;) { if (strstr (rs, ("CATS_START.CINC")) || strstr (rs, ("cats_start.cinc"))) continue; files += 1; checkfile (); } outputinformation (); int main (int argc, char **argv) { if (setjmp ()) { fatalerror ("Unable to open file PLC.LOG in the current directory"); } openoutput (3, "plc.log"); } selectoutput (3); outputinformation (); closeoutput (); }