/* MAIN */ int main(int argc, char *argv[]) { if ( argc < 4 ) return EXIT_FAILURE; t_timemes t_run = {0}; t_init(t_run); const char *patterns_filename = argv[1], *patt_size_pch = argv[2], *filename = argv[3]; unsigned int patt_size = atoi(patt_size_pch), text_size = 0; uchar *text = NULL, *pattern = NULL; FILE * file = NULL; text_size = read_file_content<uchar>(&text, filename); if (text == NULL) return EXIT_FAILURE; pattern = (uchar*)calloc (patt_size+1, CH_SIZE); if (pattern == NULL) { free(text); report_critical_error("Error: Can't allocate memory for pattern."); } file = fopen (patterns_filename, "rb"); if (!file) { free(text); free(pattern); report_critical_error("Error: Can't open patterns file."); } while (fread (pattern, CH_SIZE, patt_size, file)==patt_size) { t_start(t_run); cf::cf1<cf::cf1_verif_lev>(pattern, patt_size, text, text_size, K_DIFF, NULL); t_stop(t_run); } approx_cf::print_result(t_get_seconds(t_run), 0, indexes.size(), text_size, patt_size, K_DIFF); indexes.clear(); free(text); free(pattern); fclose(file); return EXIT_SUCCESS; }
void stop(void) { #ifdef USE_THREE_WHEEL t_stop(); #endif delay_ms(10); }
/**************************** Main ****************************************/ void main(void) { unsigned char zaehlertief, zaehlerhoch, data[256]; long periode = 1000000L; /* Zeitintervall zwischen Messungen */ int i, start = TRUE; initcom(); ginit(); gwindow(0,255,0,255); t_start(); /* Installiere Timer-Software */ t_alarm_start(); /* Installiere Alarm-Uhr */ printf("\nPOISSON V1.0\n"); for ( i = 0; i <= 255; i++ ) data[i] = 0; t_alarm_set(0,periode,T_ONCE); do { do ; while ( t_alarm_check(0) == 0 ); t_alarm_set(0,periode,T_ONCE); txchar(SYNCHBYTE); zaehlertief = rxcharw(); zaehlerhoch = rxcharw(); if ( start ) start = FALSE; /* Erster Wert unbrauchbar */ else data[zaehlertief]++; gclear(); for ( i = 0; i <= 255; i++ ) { if ( i == 0 ) gpos(i, data[i]); else gdraw(i, data[i]); } } while ( !kbhit() ); t_stop(); /* Desinstalliere Timer */ printf("\nDr�cke Taste..."); getch(); getch(); gend(); }
static VALUE t_restart(VALUE self) { t_stop(self); watch_directory(self); return self; }