/* g++ boxcheck.C -o boxcheck.exe */ #include #include #include #include #include #include #include #include #include using namespace std; int main(int argc, char *argv[]) { if (argc<2) { printf("not enough arguments: argc = %d\nSyntax should be:\n./boxcheck.exe boxnumber\n",argc); printf("Example:\n./boxcheck.exe 12 \n"); return -1; } int iBox = atoi(argv[1]); const int debug = 2; const int kMaxTrays = 5; // per box int iTrayNum[kMaxTrays] = {0}; int iTraynTot[kMaxTrays] = {0}; int iTraynOK[kMaxTrays] = {0}; int iTraynB2[kMaxTrays] = {0}; int iTraynC1[kMaxTrays] = {0}; int iTraynC2[kMaxTrays] = {0}; // check how many trays are from different batches const int kMaxWafer = 30; // should be numbers 11 to 27 int waferCount[kMaxWafer] = {0}; const int kMaxRCode = 9; int trayCount[kMaxRCode] = {0}; // Step 1: figure out which (max 5) trays are in the requested box const char *listname="labels.txt"; const char *cBoxStr2 = "box:"; const char *cTrayStr1 = "tray"; ifstream flist(listname); if (!flist) { cerr << " - can't open flist for input" << endl; return 1; } int ibox = 0; int itray = 0; int icode = 0; int iwafer = 0; for (itray = 0; itray> cDesc1 >> cDesc2 >> ival; if (! flist.good() ) { break; } if (debug>2) cout << " cDesc1 " << cDesc1 << " cDesc2 " << cDesc2 << " ival " << ival << endl; if (! strcmp( cDesc2, cBoxStr2) ) { if (debug>2) cout << " box match - ival " << ival << endl; ibox = ival; itray = 0; } if (! strcmp( cDesc1, cTrayStr1) ) { if (debug>2) cout << " tray match - ival " << ival << endl; if (itray < kMaxTrays) { iTrayNum[itray] = ival; } itray++; } if (ibox == iBox) { break; } else { } } // flist flist.close(); cout << "Box " << iBox << " contains the following trays: " << endl; for (itray = 0; itray> nTests >> it >> icode >> filename; if (!flast.good()) break; bool boxMatch = false; for (itray = 0; itray < kMaxTrays; itray++) { if ( it == iTrayNum[itray] ) { boxMatch = true; } } if (boxMatch) { // figure out the chipnumber from the filename string str (filename); /* std::size_t pos = str.find("result"); cout << " pos " << pos << endl; */ string strChip = str.substr(55,6); //cout << " strChip " << strChip << endl; ichip = atoi(strChip.c_str()); iwafer = ichip / 10000; // 10000 = # chips per wafer-lot (max) waferCount[iwafer]++; trayCount[icode]++; } // boxMatch } flast.close(); cout << " Batch count report: " << endl; int nsum = 0; for (iwafer = 10; iwafer 0) { cout << " batch " << iwafer << " : " << waferCount[iwafer] << endl; nsum += waferCount[iwafer]; } } cout << " nsum " << nsum << endl; int nSum = trayCount[0] + trayCount[2] + trayCount[5] + trayCount[6]; printf(" nTot %3d nOK %3d nB2 %3d nC1 %3d nC2 %3d\n", nSum, trayCount[0], trayCount[2], trayCount[5], trayCount[6] ); return 0; }