void tty_write_str(char *str , TTY *p_tty){ CONSOLE *p_console = p_tty -> p_console; p_console -> current_videoaddr = dispstr(str , (p_console -> start_vmem * 2 + p_console -> current_videoaddr)) - p_console -> start_vmem * 2; set_cursor_console(p_console); }
int main(int argc, char *argv[]) { dispstr(0,"Welcome to the HMM program!\n"); #ifndef __STDC_IEC_559__ printf("WARNING: ISO/IEC 60559 not respected!\n"); #endif parse(argc, argv); dispstr(0,"Loading file...\n"); delays_mt input = getinput(); dispstr(0,"Sorting inputs...\n"); mysort(&input); //this offsets the timestamps to zero, and finds the min and max value of the delays. delay_mt ymin = input.delay[0]; delay_mt ymax = ymin; delay_mt current; time_mt tmin = input.time[0]; for(long long i = 0; i<input.length; i++) { input.time[i] = input.time[i] - tmin; current = input.delay[i]; if(current < ymin) ymin = current; if(current > ymax) ymax = current; } //now, we offset the delays to zero for(long long i = 0;i<input.length;i++) { //MINDELAY is an epsilon in order not to bug the algo input.delay[i] = input.delay[i] - ymin + MINDELAY; } struct params p; dispstr(0,"Initializing Markov parameters...\n"); initparams(&p, ymax); input.length = input.length/300; dispstr(0,"Training model...\n"); train(&p, &input, ymax); dispstr(0,"Writing results...\n"); write_results(&p); freeparams(&p); dispstr(0,"Done.\n"); return EXIT_SUCCESS; }
void tty_write_char(u32 char_code , TTY *p_tty){ char *output = {"0"}; CONSOLE *p_console = p_tty -> p_console; *output = (u8)char_code; p_console -> current_videoaddr = dispstr(output , (p_console -> start_vmem * 2 + p_console -> current_videoaddr)) - p_console -> start_vmem * 2; set_cursor_console(p_console); }