void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) { wxString reportName, msg; bool make_report = m_CreateRptCtrl->IsChecked(); if( make_report ) // Create a rpt file { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent dummy; OnButtonBrowseRptFileClick( dummy ); } if( !reportName.IsEmpty() ) reportName = makeValidFileNameReport(); } SetDrcParmeters(); m_tester->m_doZonesTest = m_cbReportTracksToZonesErrors->GetValue(); m_tester->m_rptFilename = reportName; m_tester->m_doCreateRptFile = make_report; m_tester->m_refillZones = m_cbRefillZones->GetValue(); m_tester->m_drcInLegacyRoutingMode = false; m_tester->m_reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue(); m_tester->m_testFootprints = m_cbTestFootprints->GetValue(); DelDRCMarkers(); wxBeginBusyCursor(); wxWindowDisabler disabler; // run all the tests, with no UI at this time. m_Messages->Clear(); wxSafeYield(); // Allows time slice to refresh the Messages m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest calculations m_tester->RunTests(m_Messages); m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab // Generate the report if( !reportName.IsEmpty() ) { if( writeReport( reportName ) ) { msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) ); wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) ); popupWindow.ShowModal(); } else { msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) ); DisplayError( this, msg ); } } wxEndBusyCursor(); RedrawDrawPanel(); }
void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event ) { wxString reportName; bool make_report = m_CreateRptCtrl->IsChecked(); if( make_report ) // Create a file rpt { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent junk; OnButtonBrowseRptFileClick( junk ); } if( !reportName.IsEmpty() ) reportName = makeValidFileNameReport(); } SetDrcParmeters(); m_tester->SetSettings( true, // Pad to pad DRC test enabled true, // unconnected pads DRC test enabled true, // DRC test for zones enabled true, // DRC test for keepout areas enabled reportName, make_report ); DelDRCMarkers(); wxBeginBusyCursor(); m_Messages->Clear(); m_tester->ListUnconnectedPads(); m_Notebook->ChangeSelection( 1 ); // display the 2nd tab "Unconnected..." // Generate the report if( !reportName.IsEmpty() ) { if( writeReport( reportName ) ) { wxString msg; msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) ); wxString caption( _( "Disk File Report Completed" ) ); wxMessageDialog popupWindow( this, msg, caption ); popupWindow.ShowModal(); } else DisplayError( this, wxString::Format( _( "Unable to create report file '%s' "), GetChars( reportName ) ) ); } UpdateDisplayedCounts(); wxEndBusyCursor(); /* there is currently nothing visible on the DrawPanel for unconnected pads * RedrawDrawPanel(); */ }
void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) { wxString reportName; bool make_report = m_CreateRptCtrl->IsChecked(); if( make_report ) // Create a rpt file { reportName = m_RptFilenameCtrl->GetValue(); if( reportName.IsEmpty() ) { wxCommandEvent dummy; OnButtonBrowseRptFileClick( dummy ); } if( !reportName.IsEmpty() ) reportName = makeValidFileNameReport(); } SetDrcParmeters(); m_tester->SetSettings( true, // Pad to pad DRC test enabled true, // unconnected pads DRC test enabled true, // DRC test for zones enabled true, // DRC test for keepout areas enabled m_cbCourtyardOverlap->GetValue(), m_cbCourtyardMissing->GetValue(), reportName, make_report ); DelDRCMarkers(); wxBeginBusyCursor(); // run all the tests, with no UI at this time. m_Messages->Clear(); wxSafeYield(); // Allows time slice to refresh the m_Messages window m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations m_tester->RunTests(m_Messages); m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..." // Generate the report if( !reportName.IsEmpty() ) { if( writeReport( reportName ) ) { wxString msg; msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) ); wxString caption( _( "Disk File Report Completed" ) ); wxMessageDialog popupWindow( this, msg, caption ); popupWindow.ShowModal(); } else DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\" "), GetChars( reportName ) ) ); } wxEndBusyCursor(); RedrawDrawPanel(); }
/* main filter function */ int main_filter(int argc, char *argv[]){ char *output, *subfam, *out, *outReport; unsigned long long int *cnt; struct hash *hashRmsk = newHash(0); struct hash *hashRep = newHash(0); struct hash *hashFam = newHash(0); struct hash *hashCla = newHash(0); int optSam = 0, optthreshold = 1; char *optoutput = NULL, *optname = NULL, *optclass = NULL, *optfamily = NULL; unsigned int optreadlist = 0, optQual = 10, optisize = 500, optExt = 150; int filterField = 0, c, optDup = 0, optNorm = 0, optaddChr = 0, optDis =0, optTreat = 0; float optCov = 0.0001; time_t start_time, end_time; start_time = time(NULL); while ((c = getopt(argc, argv, "SQ:g:N:n:c:t:f:rRTDCE:I:o:h?")) >= 0) { switch (c) { case 'S': optSam = 1; break; case 'Q': optQual = (unsigned int)strtol(optarg, 0, 0); break; case 'g': optCov = atof(optarg); break; case 'N': optNorm = (unsigned int)strtol(optarg, 0, 0); break; case 't': optthreshold = (unsigned int)strtol(optarg, 0, 0); break; case 'r': optreadlist = 1; break; case 'R': optDup = 1; break; case 'T': optTreat = 1; break; case 'D': optDis = 1; break; case 'C': optaddChr = 1; break; case 'n': optname = strdup(optarg); break; case 'c': optclass = strdup(optarg); break; case 'f': optfamily = strdup(optarg); break; case 'E': optExt = (unsigned int)strtol(optarg, 0, 0); break; case 'I': optisize = (unsigned int)strtol(optarg, 0, 0); break; case 'o': optoutput = strdup(optarg); break; case 'h': case '?': return filter_usage(); break; default: return 1; } } if (optind + 4 > argc) return filter_usage(); char *chr_size_file = argv[optind]; char *rep_size_file = argv[optind+1]; char *rmsk_file = argv[optind+2]; char *sam_file = argv[optind+3]; if ( (optname && optclass) || (optname && optfamily) || (optclass && optfamily) || (optname && optclass && optfamily)) errAbort("Please specify only one filter, either -n, -c or -f."); int nindex = 0; if (optNorm == 0){ nindex = 7; } else if (optNorm == 1){ nindex = 8; } else if (optNorm == 2) { nindex = 6; } else if (optNorm == 3) { nindex = 4; } else{ errAbort("Wrong normalization method specified"); } subfam = cloneString("ALL"); if (optname) { optclass = NULL; optfamily = NULL; subfam = cloneString(optname); filterField = 10; }else if (optclass) { optname = NULL; optfamily = NULL; subfam = cloneString(optclass); filterField = 11; } else if (optfamily) { optname = NULL; optclass= NULL; subfam = cloneString(optfamily); filterField = 12; } if (sameString(subfam, "ALL")){ fprintf(stderr, "* You didn't specify any filter, will output all repeats\n"); filterField = 0; } if(optoutput) { output = optoutput; } else { output = cloneString(get_filename_without_ext(basename(sam_file))); } struct hash *chrHash = hashNameIntFile(chr_size_file); struct hash *repHash = hashNameIntFile(rep_size_file); fprintf(stderr, "* Start to parse the rmsk file\n"); rmsk2binKeeperHash(rmsk_file, chrHash, repHash, &hashRmsk, &hashRep, &hashFam, &hashCla, filterField, subfam); //sam file fprintf(stderr, "* Start to parse the SAM/BAM file\n"); //if (optPair){ // cnt = PEsamFile2nodupRepbedFile(sam_file, chrHash, hashRmsk, hashRep, hashFam, hashCla, optSam, optQual, 1, optDup, optaddChr, optisize); //} else { // cnt = samFile2nodupRepbedFile(sam_file, chrHash, hashRmsk, hashRep, hashFam, hashCla, optSam, optQual, 1, optDup, optaddChr); //} cnt = samFile2nodupRepbedFileNew(sam_file, chrHash, hashRmsk, hashRep, hashFam, hashCla, optSam, optQual, 1, optDup, optaddChr, optDis, optisize, optExt, optCov, optTreat, NULL, NULL, 0); fprintf(stderr, "* Preparing the output file\n"); if (asprintf(&out, "%s_%s.iteres.loci", output, subfam) < 0) errAbort("Preparing output wrong"); if (asprintf(&outReport, "%s_%s.iteres.reportloci", output, subfam) < 0) errAbort("Preparing output wrong"); writeFilterOut(hashRmsk, out, optreadlist, optthreshold, subfam, cnt[nindex]); //write report file fprintf(stderr, "* Preparing report file\n"); writeReport(outReport, cnt, optQual, subfam); hashFree(&chrHash); hashFree(&repHash); hashFree(&hashRmsk); hashFree(&hashRep); hashFree(&hashFam); hashFree(&hashCla); free(out); free(outReport); end_time = time(NULL); fprintf(stderr, "* Done, time used %.0f seconds.\n", difftime(end_time, start_time)); return 0; }
/*------------------------------------------------------------------------- Run n copies of the test. Return value is 0 on success. -------------------------------------------------------------------------*/ int /* */ run_n_nodes( char *exe, /* */ int loops) /* */ { char *childArgs[7] = {NULL, NULL, "nhosts", "nloops", "childnum", "nextadr.possibly.internet.address:maybeWithPortNumber", NULL}; int* procs = NULL; int* result = NULL; int i; childArgs[0] = exe; childArgs[1] = results.driver; if ((procs = (int *) malloc(results.n_hosts * sizeof(int))) == NULL) abortTest(logFile, 3, "Unable to allocate process handle storage.\n", NULL); if((result = (int *) malloc(results.n_hosts * sizeof(int))) == NULL) abortTest(logFile, 3, "Unable to allocate result storage.\n", NULL); /* Start tests */ for (i=0; i < results.n_hosts; i++) { sprintf(childArgs[2], "%d", results.n_hosts); sprintf(childArgs[3], "%d", loops); sprintf(childArgs[4], "%d", i); #if LOOPBACK_ADDRESS sprintf(childArgs[5], "%d.0.0.0", ((i+1) % results.n_hosts) + 1); #elif INTERNET_ADDRESS sprintf(childArgs[5], "207.82.188.88:%d", ((i+1) % results.n_hosts) + PORT_OFFSET); #else Warning: Must choose one of the above defines. #endif printf("Launching %s %s %s %s %s %s\n", childArgs[0], childArgs[1], childArgs[2], childArgs[3], childArgs[4], childArgs[5]); procs[i] = _spawnv(_P_NOWAIT, exe, childArgs); if(procs[i] == -1) { sprintf(buf, "Unable to start process %d: %s\n", i, strerror(errno)); abortTest(logFile, 4, buf, NULL); } } /* Wait for tests to finish */ for (i=0; i < results.n_hosts; i++) { _cwait(&(result[i]), procs[i], 0); printf("Node %d returned %d\n", i, result[i]); } /* Get test results */ { FILE* fp; char fname[256]; sprintf(fname, LOGNAME, 0); if ((fp = fopen(fname, "r")) != NULL) { readReport(fp, &results); } else fprintf(logFile, "Can't read client %d's logfile %s\n", 0, fname); } writeReport(logFile, &results); return 0; }
/*------------------------------------------------------------------------- This is called by the dptab_handlePacket when a new variable arrives or an old one is deleted. Note the time of the callback in the result block. -------------------------------------------------------------------------*/ int dp_PASCAL table_cb( dptab_t *dptab, /* table owner */ dptab_table_t *table, /* table */ playerHdl_t src, /* */ playerHdl_t dest, /* */ char *subkey, /* key of variable */ int subkeylen, /* number of bytes in subkey */ void *buf, /* pointer to variable */ size_t sent, size_t total, int seconds_left, void *context, /* whatever we gave it */ dp_result_t err) /* operation completed upon variable */ { clock_t now = eclock(); printf("Node %d: table_cb: type:%d src h:%x dest h:%x table:%s key:%s\n", results.thisHost, err, src, dest, key2a(table->key, table->keylen), key2a2(subkey, subkeylen)); if (err == dp_RES_CREATED || err == dp_RES_CHANGED) { /*printf("table_cb: CREATED/CHANGED: src h:%x dest h:%x table:%s key:%s\n", src, dest, key2a(table->key, table->keylen), key2a2(subkey, subkeylen));*/ if ((dest == PLAYER_ME) && (sent == total)) { /* Got a variable */ switch (subkey[0]) { case SUBKEY_SINGLE_SMALL: if(table->key[0] == 2) { results.gotSingleSmallTime = now; results.singleSmallTime = ((float)now - results.sentSingleSmallTime) / ECLOCKS_PER_SEC; /* Move this statement to right after last measurement taken */ writeReport(logFile, &results); } break; case SUBKEY_SINGLE_LARGE: results.gotSingleLargeTime = now; break; case SUBKEY_MULTIPLE_SMALL: results.gotMultipleSmallTime = now; break; default: ; } printf("Node %d: Got variable from h:%x; table %s, subkey %s; len %d\n", results.thisHost, src, key2a(table->key, table->keylen), key2a2(subkey, subkeylen), total); } } else if (err == dp_RES_CLOSED) { /*printf("table_cb: Deleted: src h:%x dest h:%x\n", src, dest);*/ if (dest == PLAYER_ME) { switch (subkey[0]) { case SUBKEY_SINGLE_SMALL: results.gotDeleteTime = now; results.deleteTime = ((float)now - results.sentDeleteTime) / ECLOCKS_PER_SEC; break; default: ; } printf("Node %d: Got delete variable from h:%x; table %s, subkey %s\n", results.thisHost, src, key2a(table->key, table->keylen), key2a2(subkey, subkeylen)); } } (void) dptab; (void) buf; (void) seconds_left; (void) context; return TRUE; }