static ssize_t dev_read( struct file *filp, char __user *ubuff, size_t len, loff_t *offs) { file_state_t *fs = filp->private_data; if (fs->read_state == READ_DONE) { fs->read_state = DO_READ; return 0; } int ret = 0; char *buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!buffer) return -ENOMEM; int blen = output_display(buffer, lcd_buffer); if (blen < len) { len = blen; } int uncopied = copy_to_user(ubuff, buffer, len); if (uncopied) { ret = -EFAULT; } else { ret = len; } kfree(buffer); fs->read_state = READ_DONE; return ret; }
void output_handler_old (OUTPUT_DESC *output, int type_call, int mouse_button, int mouse_state) { int nPersonOutput; if (g_nStatus == RECALL_PHASE) { // Avalia a saida if (strcmp (output->name, out_landmark.name) == 0) { g_nTotalTested++; if ((nPersonOutput = EvaluateOutput(output) + 1) == g_nPersonUniqueID) { g_nCorrect++; printf("Person: %3d - Correct Person: %3d - Tested: %3d - Correct: %3d - Hit Percent: %3.2f\n", nPersonOutput, g_nPersonUniqueID, g_nTotalTested, g_nCorrect, (float)(g_nCorrect * 100.0 / g_nTotalTested)); } else printf("Person: %3d - Correct Person: %3d - Tested: %3d - Correct: %3d - Hit Percent: %3.2f ***\n", nPersonOutput, g_nPersonUniqueID, g_nTotalTested, g_nCorrect, (float)(g_nCorrect * 100.0 / g_nTotalTested)); } } #ifndef NO_INTERFACE glutSetWindow (output->win); output_display (output); #endif }
void output_handler (OUTPUT_DESC *output, int type_call, int mouse_button, int mouse_state) { char strFileName[256]; FILE *pFile = NULL; int nClassCnaeOutput; int nClassCnaeID; int test = 0; if (g_nStatus == RECALL_PHASE) { // Obtem a saida da rede nClassCnaeOutput = EvaluateOutput(output); g_nTotalTested++; sprintf (strFileName, "%s%d.cnae", OBJETOS_SOCIAIS_PATH, g_nDocNumber); if ((pFile = fopen (strFileName, "r")) != NULL) { while(!feof(pFile)) { fscanf (pFile, "%d", &nClassCnaeID); // Compara a saida da rede com a classe real if(nClassCnaeOutput == nClassCnaeID) { test = 1; break; } break; } fclose (pFile); } else { printf ("Could not read file %s\n", strFileName); return; } if (test) { g_nCorrect++; printf("Class: %3d - Correct Class: %3d - Tested: %3d - Correct: %3d - Hit Percent: %3.2f\n", nClassCnaeOutput, nClassCnaeID, g_nTotalTested, g_nCorrect, (float)(g_nCorrect * 100.0 / g_nTotalTested)); } else { printf("Class: %3d - Correct Class: %3d - Tested: %3d - Correct: %3d - Hit Percent: %3.2f ***\n", nClassCnaeOutput, nClassCnaeID, g_nTotalTested, g_nCorrect, (float)(g_nCorrect * 100.0 / g_nTotalTested)); // printf("ERROR in the file: %s\n",strFileName); } } glutSetWindow (output->win); output_display (output); }
void info_xml_creator::output_one_device(device_t &device, const char *devtag) { bool has_speaker = FALSE, has_input = FALSE; // check if the device adds speakers to the system sound_interface_iterator snditer(device); if (snditer.first() != NULL) has_speaker = TRUE; // generate input list ioport_list portlist; std::string errors; device_iterator iptiter(device); for (device_t *dev = iptiter.first(); dev != NULL; dev = iptiter.next()) portlist.append(*dev, errors); // check if the device adds player inputs (other than dsw and configs) to the system for (ioport_port *port = portlist.first(); port != NULL; port = port->next()) for (ioport_field *field = port->first_field(); field != NULL; field = field->next()) if (field->type() >= IPT_START1 && field->type() < IPT_UI_FIRST) { has_input = TRUE; break; } // start to output info fprintf(m_output, "\t<%s", emulator_info::get_xml_top()); fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname())); std::string src(device.source()); strreplace(src,"../", ""); fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(src.c_str())); fprintf(m_output, " isdevice=\"yes\""); fprintf(m_output, " runnable=\"no\""); output_sampleof(); fprintf(m_output, ">\n"); fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(device.name())); output_rom(device); samples_device *samples = dynamic_cast<samples_device*>(&device); if (samples==NULL) output_sample(device); // ignore samples_device itself output_chips(device, devtag); output_display(device, devtag); if (has_speaker) output_sound(device); if (has_input) output_input(portlist); output_switches(portlist, devtag, IPT_DIPSWITCH, "dipswitch", "dipvalue"); output_switches(portlist, devtag, IPT_CONFIG, "configuration", "confsetting"); output_adjusters(portlist); output_images(device, devtag); output_slots(device, devtag); fprintf(m_output, "\t</%s>\n", emulator_info::get_xml_top()); }
void output_handler (OUTPUT_DESC *output, int type_call, int mouse_button, int mouse_state) { int person; float confidence; static float best_confidence = -1.0; static int nPersonOutput; if (g_nStatus == RECALL_PHASE) { // Avalia a saida if (strcmp (output->name, out_landmark.name) == 0) { if (g_nTry != 0) { person = EvaluateOutput2(output, &confidence); if (confidence > best_confidence) { best_confidence = confidence; nPersonOutput = person; } g_nTry--; } if (g_nTry == 0) { g_nTotalTested++; if ((nPersonOutput) == g_nPersonUniqueID) { g_nCorrect++; printf("Person: %3d - Correct Person: %3d - Tested: %3d - Correct: %3d - Confidence: %1.2f - Hit Percent: %3.2f HIT\n", nPersonOutput, g_nPersonUniqueID, g_nTotalTested, g_nCorrect, best_confidence, (float)(g_nCorrect * 100.0 / g_nTotalTested)); } else { printf("Person: %3d - Correct Person: %3d - Tested: %3d - Correct: %3d - Confidence: %1.2f - Hit Percent: %3.2f MISS\n", nPersonOutput, g_nPersonUniqueID, g_nTotalTested, g_nCorrect, best_confidence, (float)(g_nCorrect * 100.0 / g_nTotalTested)); } fflush (stdout); g_nTry = g_nTries; best_confidence = -1.0; } } } #ifndef NO_INTERFACE glutSetWindow (output->win); output_display (output); #endif }
void info_xml_creator::output_one() { // no action if not a game const game_driver &driver = m_drivlist.driver(); if (driver.flags & GAME_NO_STANDALONE) return; // allocate input ports machine_config &config = m_drivlist.config(); ioport_list portlist; astring errors; device_iterator iter(config.root_device()); for (device_t *device = iter.first(); device != NULL; device = iter.next()) portlist.append(*device, errors); // print the header and the game name fprintf(m_output, "\t<%s",emulator_info::get_xml_top()); fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name)); // strip away any path information from the source_file and output it const char *start = strrchr(driver.source_file, '/'); if (start == NULL) start = strrchr(driver.source_file, '\\'); if (start == NULL) start = driver.source_file - 1; fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(start + 1)); // append bios and runnable flags if (driver.flags & GAME_IS_BIOS_ROOT) fprintf(m_output, " isbios=\"yes\""); if (driver.flags & GAME_NO_STANDALONE) fprintf(m_output, " runnable=\"no\""); if (driver.flags & GAME_MECHANICAL) fprintf(m_output, " ismechanical=\"yes\""); // display clone information int clone_of = m_drivlist.find(driver.parent); if (clone_of != -1 && !(m_drivlist.driver(clone_of).flags & GAME_IS_BIOS_ROOT)) fprintf(m_output, " cloneof=\"%s\"", xml_normalize_string(m_drivlist.driver(clone_of).name)); if (clone_of != -1) fprintf(m_output, " romof=\"%s\"", xml_normalize_string(m_drivlist.driver(clone_of).name)); // display sample information and close the game tag output_sampleof(); fprintf(m_output, ">\n"); // output game description if (driver.description != NULL) fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(driver.description)); // print the year only if is a number or another allowed character (? or +) if (driver.year != NULL && strspn(driver.year, "0123456789?+") == strlen(driver.year)) fprintf(m_output, "\t\t<year>%s</year>\n", xml_normalize_string(driver.year)); // print the manufacturer information if (driver.manufacturer != NULL) fprintf(m_output, "\t\t<manufacturer>%s</manufacturer>\n", xml_normalize_string(driver.manufacturer)); // now print various additional information output_bios(); output_rom(m_drivlist.config().root_device()); output_device_roms(); output_sample(m_drivlist.config().root_device()); output_chips(m_drivlist.config().root_device(), ""); output_display(m_drivlist.config().root_device(), ""); output_sound(m_drivlist.config().root_device()); output_input(portlist); output_switches(portlist, "", IPT_DIPSWITCH, "dipswitch", "dipvalue"); output_switches(portlist, "", IPT_CONFIG, "configuration", "confsetting"); output_ports(portlist); output_adjusters(portlist); output_driver(); output_images(m_drivlist.config().root_device(), ""); output_slots(m_drivlist.config().root_device(), ""); output_software_list(); output_ramoptions(); // close the topmost tag fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top()); }
static int display_get(char *val, const struct kernel_param *kp) { return output_display(val, (char *)kp->arg); }