//----------------------------------------------------------------------------- int main( int argc, char* argv[] ) { banner(); say("Welcome to the bracket checker!"); if (argc!=2) fatal( "usage: %s file", argv[0] ); say( "Checking file '%s'", argv[1] ); stream instream = fopen( argv[1], "r" ); if (instream==NULL) fatal( "can't open file '%s' for reading", argv[1] ); analyze( instream ); fclose( instream ); bye(); }
u32 DisassemblyManager::getStartAddress(u32 address) { auto it = findDisassemblyEntry(entries,address,false); if (it == entries.end()) { analyze(address); it = findDisassemblyEntry(entries,address,false); if (it == entries.end()) return address; } DisassemblyEntry* entry = it->second; int line = entry->getLineNum(address,true); return entry->getLineAddress(line); }
void makePlots() { gROOT->LoadMacro("analyze.C+"); TStopwatch ts; ts.Start(); TString input_ele = "ELE_FILE_TO_RUN"; TString input_muon = "MUON_FILE_TO_RUN"; bool addMC = true; int intLumi = 19712; // quote to 19.7 double metCut = -1.; bool displayKStest = true; bool blinded = true; int nPhotons_req = 0; const int nChannels = 4; TString channels[nChannels] = {"ele_jjj", "ele_bjj", "muon_jjj", "muon_bjj"}; int nBtagReq[nChannels] = {0, 1, 0, 1}; for(int i = 0; i < nChannels; i++) { if(i != 1 && i != 3) continue; if(i < 2) analyze(input_ele, addMC, i, intLumi, metCut, nPhotons_req, nBtagReq[i], displayKStest, blinded); else analyze(input_muon, addMC, i, intLumi, metCut, nPhotons_req, nBtagReq[i], displayKStest, blinded); } ts.Stop(); std::cout << "RealTime : " << ts.RealTime()/60.0 << " minutes" << std::endl; std::cout << "CPUTime : " << ts.CpuTime()/60.0 << " minutes" << std::endl; }
//Main Function int main (int argc, char *argv[]) { int numberofnotes; char outs[12]; char* outputfile=&outs[12]; printf("Melodic Analyzer %s\nBy: Nathanial Karahalis\nWritten in C\n\nWhere would you like to save the file?(*.csv): ",curvers); scanf("%s", outputfile); printf("How many notes are in this melody?: "); scanf("%i",&numberofnotes); printf("\n\nTo input notes format them with the letter name and octave number\nnote: C 4 is middle, Insert notes one by one.\n\n"); analyze(outputfile,numberofnotes); return 0; }
string matchKeyword(string in) { //Is it a constant? switch(analyze(in)) { case BooleanTrue: in = exportRGB(master.Colorscheme.find("BooleanTrue")->second) + in + "</span>"; break; case BooleanFalse: in = exportRGB(master.Colorscheme.find("BooleanFalse")->second) + in + "</span>"; break; case Integer: in = exportRGB(master.Colorscheme.find("Integer")->second) + in + "</span>"; break; case Character: in = exportRGB(master.Colorscheme.find("Character")->second) + in + "</span>"; break; case Real: in = exportRGB(master.Colorscheme.find("Real")->second) + in + "</span>"; break; case String: in = exportRGB(master.Colorscheme.find("String")->second) + in + "</span>"; break; case Symbol: { //Is it a TopLevel or Core function? if(Core.find(in) != Core.end()) in = exportRGB(master.Colorscheme.find("Core")->second) + in + "</span>"; //Is it a symbol? else if(lookup(in) != NULL) in = exportRGB(master.Colorscheme.find("Symbol")->second) + in + "</span>"; //Is it a type? else if(checkTypeExistence(in)) in = exportRGB(master.Colorscheme.find("Type")->second) + in + "</span>"; else if(checkGenericExistence(in,true) || checkGenericExistence(in,false)) in = exportRGB(master.Colorscheme.find("Generic")->second) + in + "</span>"; //lol wtf is it just return it break; } case Unidentifiable: { nerror("Received an unidentifiable form as input."); break; } } return in; }
void loop_transformt::transform(goto_programt &goto_program) { goto_program.compute_incoming_edges(); // pass 1: simple stuff Forall_goto_program_instructions(it, goto_program) if(it->is_backwards_goto()) { assert(it->targets.size()==1); goto_programt::targett begin = it->targets.front(); goto_programt::targett end = it; split_multi_head(goto_program, begin, end); transform_do_while(goto_program, begin, end); move_returns(goto_program, begin, end); } // pass 2: loop simulation Forall_goto_program_instructions(it, goto_program) if(it->is_backwards_goto()) { goto_programt::targett begin = it->targets.front(); goto_programt::targett end = it; std::set<goto_programt::targett> entries; std::set<goto_programt::targett> exits; analyze(goto_program, begin, end, entries, exits); transform(goto_program, begin, end, entries, exits); it=end; } goto_program.update(); #if 1 // Another run for debugging forall_goto_program_instructions(it, goto_program) if(it->is_backwards_goto()) { goto_programt::const_targett begin = it->targets.front(); goto_programt::const_targett end = it; run_checks(goto_program, begin, end); } #endif }
void MainWindow::grade(const char *exercise, const char *audioFile) { exercise_ = game_->openExerciseFile(QString(exercise)); if (exercise_ == NULL) return; setupExercise(); exercise_->setTryFile( audioFile ); audio_->loadFile(exercise_->getTryFilename()); analyze(); QString print(audioFile); print.append("\t"); print.append( QString().setNum(exercise_->getTryScore()) ); // qDebug(print.toAscii()); }
int main(){ int n, k; int n_c[size], n_r[size],n_x[2]; char matrix[size][size]; int nothing=0; FILE *fPtr1, *fPtr2; fPtr1 = freopen("moveIn.txt","r",stdin); //fPtr2 = freopen("movesOut.txt","w",stdout); if (!fPtr1) { printf("檔案建立失敗...\n"); exit(1); } /* if (!fPtr2) { printf("檔案建立失敗...\n"); exit(1); } */ // get the times scanf("%d\n", &n); printf("%d round(s)\n", n); /* Start Get the map */ for(k=0; k<n; k++) { printf("Test Case #%d:\n", k+1); /* Get Board */ for(int row=0; row<size; row++){ for(int col=0; col<size; col++) scanf("%c", &matrix[row][col]); scanf("\n"); } print(matrix); analyze(matrix); printf("\n"); } system("pause"); return 0; }
static void config_folder_changed (GtkFileChooser *chooser1, struct arguments *argument) { gchar *folder = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser1)); GDir *dir = g_dir_open (folder, 0, NULL); FILE *list; list = fopen("list.txt", "w+"); float resnum_temp; explore(dir, folder, list); float resnum = 0; ssize_t len = 0; char *line = NULL; int count = 0; fseek(list, 0, SEEK_SET); while (fgets(line, 1000, list) != NULL) { free(current_sample_array); line[strcspn(line, "\n")] = '\0'; resnum_temp = analyze(line); resnum += resnum_temp > 0 ? resnum_temp : 0; if(resnum_temp != 0) ++count; printf("%s, %f\n", line, resnum/count); } free(line); fclose(list); /*tmpcount = count; while(tmpcount-- > 0) { free(current_sample_array); int rand = g_random_int_range(0, count); rewind(list); for(i = count; i > tmpcount; --i) fgets(line, 1000, list); line[strcspn(line, "\n")] = '\0'; printf("%s, %f\n", line, resnum_temp); resnum_temp = analyze(line); resnum += resnum_temp; if(resnum_temp == 0) { --count; --tmpcount; } }*/ printf("%f\n", resnum/count); }
std::vector<DetectedPoint> DetectorThreshold::detect(Mat *frame) { std::vector<DetectedPoint> result; if (!frame->empty() && frame->channels() == 3) { Mat workFrame = process(frame); workFrame = analyze(&workFrame); std::vector<KeyPoint> keyPoints; detector->detect(workFrame, keyPoints); for (KeyPoint keyPoint : keyPoints) { DetectedPoint point; point = keyPoint; result.push_back(point); } } return result; }
int main(int argc, char **argv) { FILE *in; struct meta *imghead; uint16_t *imgdata; struct ares ar; size_t want; if(argc != 3) { printf("Usage: %s <is2-input> <png-output>\n", argv[0]); exit(1); } in = fopen(argv[1], "rb"); if(!in) { perror("fopen"); exit(1); } want = 366; imghead = readblob(in, want); puts("Header m1"); hexdump(imghead, want); want = 160 * 120 * 2; imgdata = readblob(in, want); puts("Image"); hexdump(imgdata, want); puts("Analyzing..."); analyze(&ar, imgdata, 160, 120); fumble(&ar, imgdata, 160, 120); printf("min %x max %x\n", ar.min, ar.max); writepng(argv[2], imgdata, 160, 120); return 0; }
void InstructionBuilder::visit(Query& query) { printf("analyze query: %s\n", query.to_s().c_str()); resource_ = manifest_->findResourceByName(query.model()); if (!resource_) throw std::runtime_error("No resource found with name '" + query.model() + "'."); query.functionName(); for (auto& param: query.params()) { param->accept(*this); } for (auto& field: query.fields()) { analyze(field.get()); } }
void go(){ // printf("give-me the encoded text\n"); // scanf("%s",BUFF); const char * BUFF = "kqerejebcppcjcrkieacuzbkrvpkrbcibqcarbjcvfcupkriofkpacuzqepbkrxpeiieabdkpbcpfcdccafieabdkpbcpfeqpkazbkrhaibkapcciburccdkdccjcidfuixpafferbiczdfkabicbbenefcupjcvkabpcydccdpkbcocperkivkscpicbrkijpkabi"; // const char * BUFF = "emglosudcgdncuswysfhnsfcykdpumlwgyicoxysipjckqpkugkmgolicgincgacksnisacykzsckxecjckshysxcgoidpkzcnkshicgiwygkkgkgoldsilkgoiusigledspwzugfzccmdgyysfuszcnxeojncgyeoweupxezgacgnfglknsacigoiyckxcjuciuzcfzccndgyysfeuekuzcsocfzccnciaczejncshfzejzegmxcyhcjumgkucy"; textSize = strlen(BUFF); text =(char *) calloc(textSize, sizeof(char)); strcpy(text, BUFF); analyze(); map(); // free(BUFF); // free(text); broke(); }
void Sensor::readData() { SensorReading reading; while (m_serialPort.canReadLine()) { QByteArray line = m_serialPort.readLine().trimmed(); if (!reading.fromCsv(line)) { emit error(reading.lastError()); break; } m_readings.append(reading); QDateTime firstTime = m_readings.first().time(); if (firstTime.msecsTo(QDateTime::currentDateTimeUtc()) >= 5000) { // We have 5 seconds of readings, so emit the batch. emit analyze(m_readings); m_readings.clear(); } } }
void JitWriter::writeOp1(const FrameState* frame, const uint8_t *pc, AbcOpcode abcop, uint32_t opd1, Traits*) { analyze(abcop, pc, frame); if (needSavedScopes(pc, abcop)) abc_->abc_instrs.put(pc, new (abc_->alloc_) AbcInstr(abcop, opd1)); if (isBranchOpcode(abcop)) { const uint8_t* nextpc = pc + 4; int offset = int32_t(opd1); if (abcop == OP_jump) { abc_->analyzeEnd(current_block_, nextpc + offset); finishBlock(nextpc); } else { abc_->analyzeBranch(current_block_, abcop, nextpc, offset); finishBlock(nextpc); newBlock(nextpc, frame); } } }
/**************************************************************************** * Main */ int main(int argc, char** argv) { size_t length; unsigned char *data; image_t image = {0}; char* filename; if (argc <= 1) { fprintf(stderr, "unmakelev -- a program for converting levels from\n" " the cavern flying game Wings.\n" "\n" "Usage: unmakelev <levelfile>\n"); return 1; } /* Load the file given */ data = load_file(argv[1], &length); if (data == NULL) { fprintf(stderr, "Failed to load data.\n"); return 1; } /* Convert it to an image */ if (analyze(data, length, &image)) { fprintf(stderr, "Analyzing data failed.\n"); xfree(data); return 1; } xfree(data); /* Write the image */ filename = xmalloc(strlen(argv[1]) + 4 + 1); strcpy(filename, argv[1]); strcat(filename, ".bmp"); write_image(&image, filename); /* Free image pixels */ xfree(image.pixels); /* All done */ return 0; }
// override this to call our ExampleVisitor on each top-level Decl virtual bool HandleTopLevelDecl(clang::DeclGroupRef DG) { if (!DG.isSingleDecl()) { return true; } clang::Decl *D = DG.getSingleDecl(); const clang::FunctionDecl *FD = clang::dyn_cast<clang::FunctionDecl>(D); // Skip other functions if (!FD || FD->getName().str().compare(funcToAnalyze)) { return true; } analyze(D); // recursively visit each AST node in Decl "D" // visitor->TraverseDecl(D); return true; }
void report_simple_stat(struct selfish_data *sd) { int i; struct selfish_rec *sr; printf("# cpuid detour[%%] mean[usec] niterated nrecorded \n"); for (i = 0; i < sd->nth; i++) { analyze(sd, i); sr = sd->srs[i]; printf("%2d %lf %lf %lu %d\n", i, sr->sum * 100.0 / (double)sr->elapsed, ticks2usec(sd, sr->mean), sr->niterated, sr->nrecorded ); } }
void AnalyzerEngine::run() { m_iManager->addLog("The analyzer Engine has started"); sleep(2); //Allow time for client connection, so they don't miss the beginning of the show while (!stopReceived) { m_iManager->setCurrentProblemList("No problem being treated now"); ProblemQuestion * pq = new ProblemQuestion( "Enter the problems list : "); m_iManager->ask(pq); string pb = pq->getAnswer(); delete pq; string pbLog = "Received problem list : " + pb; m_iManager->addLog(pbLog); if (!stopReceived) { analyze(pb); } } m_iManager->addLog("Exiting analyzer engine"); }
void unicodeMeasureString(char *utf8, int utf8Length, int *wPtr, int *hPtr) { SCRIPT_STRING_ANALYSIS ssa; HDC hdc; CONST SIZE *pSize; if (utf8Length == 0) return; hdc = CreateCompatibleDC(0); ssa = analyze(hdc, utf8, utf8Length); if (ssa != NULL) { pSize = ScriptString_pSize(ssa); if (pSize != NULL) { *wPtr = pSize->cx; *hPtr = pSize->cy; } ScriptStringFree(&ssa); } DeleteDC(hdc); }
void BlockAnalyzer::resizeEvent( QResizeEvent *e ) { DEBUG_BLOCK Analyzer::Base2D::resizeEvent( e ); const uint oldRows = m_rows; //all is explained in analyze().. //+1 to counter -1 in maxSizes, trust me we need this! m_columns = myMax( uint(double(width()+1) / (WIDTH+1)), MAX_COLUMNS ); m_rows = uint(double(height()+1) / (HEIGHT+1)); //this is the y-offset for drawing from the top of the widget m_y = (height() - (m_rows * (HEIGHT+1)) + 2) / 2; m_scope.resize( m_columns ); if( m_rows != oldRows ) { m_barPixmap = QPixmap( WIDTH, m_rows*(HEIGHT+1) ); for ( uint i = 0; i < FADE_SIZE; ++i ) m_fade_bars[i] = QPixmap( WIDTH, m_rows*(HEIGHT+1) ); m_yscale.resize( m_rows + 1 ); const float PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat for( uint z = 0; z < m_rows; ++z ) m_yscale[z] = 1 - (log10( PRE+z ) / log10( PRE+m_rows+PRO )); m_yscale[m_rows] = 0; determineStep(); paletteChange( palette() ); } else if( width() > e->oldSize().width() || height() > e->oldSize().height() ) drawBackground(); analyze( m_scope ); }
int main(int argc, char* argv[]) { if (argc < 2) { showHelpAndExitWithCode(1); } // modernize the arguments, because passing arrays is a nightmare std::vector<std::string> args(argv, argv + argc); try { for (int i = 0; i < args.size(); i++) { if (args.at(i).compare("-e") == 0) { encrypt(args, i); break; } if (args.at(i).compare("-d") == 0) { decrypt(args, i); break; } if (args.at(i).compare("-a") == 0) { analyze(args, i); break; } if (i == args.size() - 1) { showHelpAndExitWithCode(1); } } } catch (std::runtime_error &ex) { std::cout << ex.what() << std::endl; } return 0; }
void leaky::open() { LoadMap(); setupSymbols(progFile); // open up the log file mappedLogFile = ::open(logFile, O_RDONLY); if (mappedLogFile < 0) { perror("open"); exit(-1); } off_t size; firstLogEntry = (malloc_log_entry*) mapFile(mappedLogFile, PROT_READ, &size); lastLogEntry = (malloc_log_entry*)((char*)firstLogEntry + size); analyze(); exit(0); }
int main(int argc, char **argv) { printf("dumplarc 0.0 - extract from .la files (LARC header)\n\n"); CHECK_ERROR(argc != 2, "Incorrect program usage\n\nusage: dumplarc input.la"); /* open file */ FILE *infile = fopen(argv[1], "rb"); CHECK_ERRNO(!infile, "fopen"); /* get file size */ CHECK_ERRNO(fseek(infile, 0 , SEEK_END) != 0, "fseek"); long file_length = ftell(infile); CHECK_ERRNO(file_length == -1, "ftell"); rewind(infile); analyze(infile, file_length); exit(EXIT_SUCCESS); }
static void file_changed (GtkFileChooser *chooser2, struct arguments *argument) { int resnum = 0; gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser2)); resnum = analyze(filename); gtk_adjustment_configure(argument->adjust, 0, 0, current_song.duration, 1, 1, 1); gtk_adjustment_changed(argument->adjust); if(resnum == 2) { gtk_label_set_text ((GtkLabel*)argument->label, "Can't Conclude"); gtk_label_set_text((GtkLabel*)argument->artist_label, current_song.artist); gtk_label_set_text((GtkLabel*)argument->title_label, current_song.title); gtk_label_set_text((GtkLabel*)argument->album_label, current_song.album); } else if(resnum == 0) { gtk_label_set_text ((GtkLabel*)argument->label, "Much loud"); gtk_label_set_text((GtkLabel*)argument->artist_label, current_song.artist); gtk_label_set_text((GtkLabel*)argument->title_label, current_song.title); gtk_label_set_text((GtkLabel*)argument->album_label, current_song.album); } else if(resnum == 1) { gtk_label_set_text((GtkLabel*)argument->artist_label, current_song.artist); gtk_label_set_text((GtkLabel*)argument->title_label, current_song.title); gtk_label_set_text((GtkLabel*)argument->album_label, current_song.album); gtk_label_set_text ((GtkLabel*)argument->label, "Such calm"); } char artist[strlen(current_song.artist) + 9]; char title[strlen(current_song.title) + 8]; char album[strlen(current_song.album) + 8]; strcpy(artist, "Artist: "); strcpy(title, "Title: "); strcpy(album, "Album: "); gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->artist_label), strcat(artist, current_song.artist)); gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->title_label), strcat(title, current_song.title)); gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->album_label), strcat(album, current_song.album)); }
static inline char * tparam_internal(const char *string, va_list ap) { char *p_is_s[NUM_PARM]; long param[NUM_PARM]; int popcount; int number; int len; int level; int x, y; int i; const char *cp = string; grub_size_t len2; static int dynamic_var[NUM_VARS]; static int static_vars[NUM_VARS]; if (cp == 0) return 0; out_used = out_size = fmt_size = 0; len2 = (int) grub_strlen(cp); /* * Find the highest parameter-number referred to in the format string. * Use this value to limit the number of arguments copied from the * variable-length argument list. */ number = analyze(cp, p_is_s, &popcount); if (fmt_buff == 0) return 0; for (i = 0; i < max(popcount, number); i++) { /* * A few caps (such as plab_norm) have string-valued parms. * We'll have to assume that the caller knows the difference, since * a char* and an int may not be the same size on the stack. */ if (p_is_s[i] != 0) { p_is_s[i] = va_arg(ap, char *); } else {
int insert(context_t context, char*fname) { int ret; DB* dbContext = db_getContext(context); DBT key, data; char *pContext; analSet anal = {{{0}},{0}}; if(context[0]) { pContext = context; } else { pContext = g_lastcontext; } printf("(%d) [%s] Adding %s\n", ++unsafeCtr, pContext, fname); memset (&key, 0, sizeof (key)); memset (&data, 0, sizeof (data)); // analyze the file to be inserted analyze(fname, &anal); // this is the simple key value store //compress(fname, comp); key.data = fname; key.size = strlen(fname); data.data = (void*)&anal; data.size = sizeof(analSet); if ((ret = dbContext->put (dbContext, NULL, &key, &data, 0)) != 0) { dbContext->err (dbContext, ret, "(db)"); } ixPut(fname, &anal); return 0; }
int main(int argc, char **argv) { ac = argc; avp = argv; reset_element_information(); if (argc < 2) { moldyn_usage(); } moldyn_init_graphics(&argc, argv, argv[1]); read_dat(); if (autoscale) { analyze(); } read_cycle(); range = fabs(zmax) + fabs(zmin); if (range < fabs(xmax) + fabs(xmin)) range = fabs(xmax) + fabs(xmin); if (range < fabs(ymax) + fabs(ymin)) range = fabs(ymax) + fabs(ymin); magnification = pow(1.2, (double) magstep); zeye = -2.0 * range * magnification; moldyn_update_graphics(); if (povray <= 0) { start_mainloop(); } else { makePov(MOLDYN_EXPORT_TO_PNG); } return 0; }
UINTN gptsync(VOID) { UINTN status = 0; UINTN status_gpt, status_mbr; BOOLEAN proceed = FALSE; Print(L"gptsync version %s\ncopyright (c) 2006-2007 Christoph Pfisterer & 2013 Roderick W. Smith\n", VERSION); // get full information from disk status_gpt = read_gpt(); status_mbr = read_mbr(); if (status_gpt != 0 || status_mbr != 0) return (status_gpt || status_mbr); // cross-check current situation Print(L"\n"); status = check_gpt(); // check GPT for consistency if (status != 0) return status; status = check_mbr(); // check MBR for consistency if (status != 0) return status; status = analyze(); // analyze the situation & compose new MBR table if (status != 0) return status; if (new_mbr_part_count == 0) return status; // offer user the choice what to do status = input_boolean(STR("\nMay I update the MBR as printed above? [y/N] "), &proceed); if (status != 0 || proceed != TRUE) return status; // adjust the MBR and write it back status = write_mbr(); if (status != 0) return status; return status; }
static void cfunbody(JF, js_Ast *name, js_Ast *params, js_Ast *body) { F->lightweight = 1; F->arguments = 0; if (F->script) F->lightweight = 0; if (body) analyze(J, F, body); cparams(J, F, params); if (name) { emit(J, F, OP_CURRENT); if (F->lightweight) { addlocal(J, F, name, 0); emit(J, F, OP_INITLOCAL); emitraw(J, F, findlocal(J, F, name->string)); } else { emitstring(J, F, OP_INITVAR, name->string); } } if (body) { cvardecs(J, F, body); cfundecs(J, F, body); } if (F->script) { emit(J, F, OP_UNDEF); cstmlist(J, F, body); emit(J, F, OP_RETURN); } else { cstmlist(J, F, body); emit(J, F, OP_UNDEF); emit(J, F, OP_RETURN); } }