这篇教程C++ ARRAY_LENGTH函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ARRAY_LENGTH函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY_LENGTH函数的具体用法?C++ ARRAY_LENGTH怎么用?C++ ARRAY_LENGTH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ARRAY_LENGTH函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: output_filestatic int output_file(file_type type, int srcrootlen, int dstrootlen, const astring *srcfile, const astring *dstfile, int link_to_file){ const char *comment_start, *comment_end, *comment_inline, *token_chars; const char *comment_start_esc, *comment_end_esc, *comment_inline_esc; const token_entry *token_table; const astring *srcfile_subpath; char srcline[4096], *srcptr; int in_comment = FALSE; UINT8 is_token[256]; int color_quotes; core_file *src; core_file *dst; int toknum; int linenum = 1; /* extract a normalized subpath */ srcfile_subpath = normalized_subpath(srcfile, srcrootlen + 1); if (srcfile_subpath == NULL) return 1; fprintf(stderr, "Processing %s/n", astring_c(srcfile_subpath)); /* set some defaults */ color_quotes = FALSE; comment_start = comment_start_esc = ""; comment_end = comment_end_esc = ""; comment_inline = comment_inline_esc = ""; token_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"; token_table = dummy_token_table; /* based on the file type, set the comment info */ switch (type) { case FILE_TYPE_C: color_quotes = TRUE; comment_start = comment_start_esc = "/*"; comment_end = comment_end_esc = "*/"; comment_inline = comment_inline_esc = "//"; token_table = c_token_table; break; case FILE_TYPE_MAKE: color_quotes = TRUE; comment_inline = comment_inline_esc = "#"; break; case FILE_TYPE_XML: color_quotes = TRUE; comment_start = "<!--"; comment_start_esc = "<!--"; comment_end = "-->"; comment_end_esc = "-->"; break; default: case FILE_TYPE_TEXT: break; } /* make the token lookup table */ memset(is_token, 0, sizeof(is_token)); for (toknum = 0; token_chars[toknum] != 0; toknum++) is_token[(UINT8)token_chars[toknum]] = TRUE; /* open the source file */ if (core_fopen(astring_c(srcfile), OPEN_FLAG_READ, &src) != FILERR_NONE) { fprintf(stderr, "Unable to read file '%s'/n", astring_c(srcfile)); return 1; } /* open the output file */ dst = create_file_and_output_header(dstfile, "MAME Source Code", astring_c(srcfile_subpath)); if (dst == NULL) { fprintf(stderr, "Unable to write file '%s'/n", astring_c(dstfile)); core_fclose(src); return 1; } /* output the directory navigation */ core_fprintf(dst, "<h3>Viewing File: "); output_path_as_links(dst, srcfile_subpath, FALSE, link_to_file); core_fprintf(dst, "</h3>"); astring_free((astring *)srcfile_subpath); /* start with some tags */ core_fprintf(dst, "/t<pre style=/"font-family:'Courier New','Courier',monospace; font-size:12px;/">/n"); /* iterate over lines in the source file */ while (core_fgets(srcline, ARRAY_LENGTH(srcline), src) != NULL) { char dstline[4096], *dstptr = dstline; int in_inline_comment = FALSE; int last_token_was_include = FALSE; int last_was_token = FALSE; int quotes_are_linked = FALSE; char in_quotes = 0; int curcol = 0;//.........这里部分代码省略.........
开发者ID:cdenix,项目名称:ps3-mame-0125,代码行数:101,
示例2: main//.........这里部分代码省略......... fprintf (stderr, "Can't manage screen backlight on this system./nPlease disable backlight with config option 'workmode='1' or command line switch '-w 1'./nIf you believe this is an error, open a bug report: https://github.com/poliva/lightum/issues/n"); exit (1); } else { dbus_backend = 2; } } else { dbus_backend = 1; } } else { dbus_backend = 0; } } if (conf.idleoff != 0 || conf.screenidle != 0) { display = XOpenDisplay (NULL); if (display == NULL) { fprintf (stderr, "Failed to open display/n"); exit (1); } } signal_installer (); if (!conf.ignoresession) { connection = get_dbus_connection (); proxy_manager = get_dbus_proxy_manager (connection); proxy_session = get_dbus_proxy_session (connection, proxy_manager); } // initialize the light values array if (!conf.manualmode) { light = get_light_sensor_value (); for (i = 0; i < ARRAY_LENGTH (lightvalues); i++) lightvalues[i] = light; countarray[light] = ARRAY_LENGTH (lightvalues); } else { for (i = 0; i < ARRAY_LENGTH (lightvalues); i++) lightvalues[i] = 0; } while (1) { if (reloadconfig) { conf = config_parse (); if (verbose) printf ("lightum: SIGUSR1 received, configuration reloaded/n"); check_config_values (conf); reloadconfig = 0; } if (!conf.ignoresession) { if (!get_session_active (proxy_session)) { if (verbose) printf ("lightum: user session not active, sleeping %d milliseconds./nIf you believe this is an error, try running lightum with 'ignoresession=1' or '-U' command line switch./n", conf.polltime); usleep (conf.polltime * 1000); continue; } } if (!conf.manualmode) { light = get_light_sensor_value (); if (verbose) printf ("light_sensor: %d ", light);
开发者ID:vgeddes,项目名称:lightum,代码行数:67,
示例3: palette_allocvoid laserdisc_device::init_video(){ // register for VBLANK callbacks m_screen->register_vblank_callback(vblank_state_delegate(FUNC(laserdisc_device::vblank_state_changed), this)); // allocate palette for applying brightness/contrast/gamma m_videopalette = palette_alloc(256, 1); if (m_videopalette == NULL) throw emu_fatalerror("Out of memory allocating video palette"); for (int index = 0; index < 256; index++) palette_entry_set_color(m_videopalette, index, MAKE_RGB(index, index, index)); // allocate video frames for (int index = 0; index < ARRAY_LENGTH(m_frame); index++) { // first allocate a YUY16 bitmap at 2x the height frame_data &frame = m_frame[index]; frame.m_bitmap.allocate(m_width, m_height * 2); frame.m_bitmap.set_palette(m_videopalette); fillbitmap_yuy16(frame.m_bitmap, 40, 109, 240); // make a copy of the bitmap that clips out the VBI and horizontal blanking areas frame.m_visbitmap.wrap(&frame.m_bitmap.pix16(44, frame.m_bitmap.width() * 8 / 720), frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, frame.m_bitmap.height() - 44, frame.m_bitmap.rowpixels()); frame.m_visbitmap.set_palette(m_videopalette); } // allocate an empty frame of the same size m_emptyframe.allocate(m_width, m_height * 2); m_emptyframe.set_palette(m_videopalette); fillbitmap_yuy16(m_emptyframe, 0, 128, 128); // allocate texture for rendering m_videoenable = true; m_videotex = machine().render().texture_alloc(); if (m_videotex == NULL) fatalerror("Out of memory allocating video texture/n"); // allocate overlay m_overenable = overlay_configured(); if (m_overenable) { // bind our handlers m_overupdate_ind16.bind_relative_to(*owner()); m_overupdate_rgb32.bind_relative_to(*owner()); // configure bitmap formats bitmap_format format = !m_overupdate_ind16.isnull() ? BITMAP_FORMAT_IND16 : BITMAP_FORMAT_RGB32; texture_format texformat = !m_overupdate_ind16.isnull() ? TEXFORMAT_PALETTEA16 : TEXFORMAT_ARGB32; // allocate overlay bitmaps for (int index = 0; index < ARRAY_LENGTH(m_overbitmap); index++) { m_overbitmap[index].set_format(format, texformat); m_overbitmap[index].set_palette(machine().palette); m_overbitmap[index].resize(m_overwidth, m_overheight); } // allocate overlay texture m_overtex = machine().render().texture_alloc(); if (m_overtex == NULL) fatalerror("Out of memory allocating overlay texture/n"); }}
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:66,
示例4: if ); if (!p) moves.nMoves++; else if (p->whatColor() != color) moves.nMoves++; } } return; }const POSITIONOFFSET kingOffset[] = { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1}, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };const int nKingOffsets = ARRAY_LENGTH(kingOffset);const POSITIONOFFSET knightOffset[] = { { 1, 2 }, { 2, 1}, { -1, 2 }, { 2, -1 }, { 1, -2}, { -2, 1 }, { -1, -2 }, { -2, -1 } };const int nKnightOffsets = ARRAY_LENGTH(knightOffset);void PAWN::promote(PIECETYPE promoteType) { switch (promoteType) { case TYPEQUEEN: promotePiece = new QUEEN(whatColor()); break; case TYPEROOK:
开发者ID:wkaras,项目名称:xterm-CUI-Chess,代码行数:31,
示例5: memsetvoid jangou_blitter_device::device_reset(){ memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data)); m_bltflip = false;}
开发者ID:RafTacker,项目名称:mame,代码行数:5,
示例6: recurse_dirstatic int recurse_dir(int srcrootlen, const astring *srcdir){ static const osd_dir_entry_type typelist[] = { ENTTYPE_DIR, ENTTYPE_FILE }; int result = 0; int entindex; /* iterate first over directories, then over files */ for (entindex = 0; entindex < ARRAY_LENGTH(typelist) && result == 0; entindex++) { osd_dir_entry_type entry_type = typelist[entindex]; const osd_directory_entry *entry; list_entry **listarray = NULL; list_entry *list = NULL; list_entry *curlist; osd_directory *dir; int found = 0; /* open the directory and iterate through it */ dir = osd_opendir(astring_c(srcdir)); if (dir == NULL) { result = 1; goto error; } /* build up the list of files */ while ((entry = osd_readdir(dir)) != NULL) if (entry->type == entry_type && entry->name[0] != '.') { list_entry *lentry = (list_entry *)malloc(sizeof(*lentry)); lentry->name = astring_dupc(entry->name); lentry->next = list; list = lentry; found++; } /* close the directory */ osd_closedir(dir); /* skip if nothing found */ if (found == 0) continue; /* allocate memory for sorting */ listarray = (list_entry **)malloc(sizeof(list_entry *) * found); found = 0; for (curlist = list; curlist != NULL; curlist = curlist->next) listarray[found++] = curlist; /* sort the list */ qsort(listarray, found, sizeof(listarray[0]), compare_list_entries); /* rebuild the list */ list = NULL; while (--found >= 0) { listarray[found]->next = list; list = listarray[found]; } free(listarray); /* iterate through each file */ for (curlist = list; curlist != NULL && result == 0; curlist = curlist->next) { astring *srcfile; /* build the source filename */ srcfile = astring_alloc(); astring_printf(srcfile, "%s%c%s", astring_c(srcdir), PATH_SEPARATOR[0], astring_c(curlist->name)); /* if we have a file, output it */ if (entry_type == ENTTYPE_FILE) { /* make sure we care, first */ if (core_filename_ends_with(astring_c(curlist->name), ".c")) { tagmap *depend_map = tagmap_alloc(); tagmap_entry *map_entry; file_entry *file; astring *target; int taghash; /* find dependencies */ file = compute_dependencies(srcrootlen, srcfile); recurse_dependencies(file, depend_map); /* convert the target from source to object (makes assumptions about rules) */ target = astring_dup(file->name); astring_replacec(target, 0, "src/", "$(OBJ)/"); astring_replacec(target, 0, ".c", ".o"); printf("/n%s : ///n", astring_c(target)); /* iterate over the hashed dependencies and output them as well */ for (taghash = 0; taghash < TAGMAP_HASH_SIZE; taghash++) for (map_entry = depend_map->table[taghash]; map_entry != NULL; map_entry = map_entry->next) printf("/t%s ///n", astring_c((astring *)map_entry->object)); astring_free(target); tagmap_free(depend_map); }//.........这里部分代码省略.........
开发者ID:Luke-Nukem,项目名称:mame-144-vector_mod,代码行数:101,
示例7: pr8210_executestatic void pr8210_execute(const device_config *laserdisc, int command){ static const UINT8 digits[10] = { 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d, 0x03, 0x13 }; switch (command) { case CMD_SCAN_REVERSE: if (pr8210_command_buffer_in == pr8210_command_buffer_out || pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer)) { pr8210_add_command(0x1c); playing = TRUE; } break; case CMD_STEP_REVERSE: pr8210_add_command(0x12); playing = FALSE; break; case CMD_SLOW_REVERSE: pr8210_add_command(0x02); playing = TRUE; break; case CMD_FAST_REVERSE: if (pr8210_command_buffer_in == pr8210_command_buffer_out || pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer)) { pr8210_add_command(0x0c); playing = TRUE; } break; case CMD_SCAN_FORWARD: if (pr8210_command_buffer_in == pr8210_command_buffer_out || pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer)) { pr8210_add_command(0x08); playing = TRUE; } break; case CMD_STEP_FORWARD: pr8210_add_command(0x04); playing = FALSE; break; case CMD_SLOW_FORWARD: pr8210_add_command(0x18); playing = TRUE; break; case CMD_FAST_FORWARD: if (pr8210_command_buffer_in == pr8210_command_buffer_out || pr8210_command_buffer_in == (pr8210_command_buffer_out + 1) % ARRAY_LENGTH(pr8210_command_buffer)) { pr8210_add_command(0x10); playing = TRUE; } break; case CMD_PLAY: pr8210_add_command(0x14); playing = TRUE; break; case CMD_PAUSE: pr8210_add_command(0x0a); playing = FALSE; break; case CMD_FRAME_TOGGLE: pr8210_add_command(0x0b); break; case CMD_CHAPTER_TOGGLE: pr8210_add_command(0x06); break; case CMD_CH1_TOGGLE: pr8210_add_command(0x0e); break; case CMD_CH2_TOGGLE: pr8210_add_command(0x16); break; case CMD_0: case CMD_1: case CMD_2: case CMD_3: case CMD_4: case CMD_5: case CMD_6: case CMD_7: case CMD_8: case CMD_9: pr8210_add_command(digits[command - CMD_0]); break;//.........这里部分代码省略.........
开发者ID:nitrologic,项目名称:emu,代码行数:101,
示例8: PIXGetCounterInfo//==================================================================================================// PIXGetCounterInfo//==================================================================================================BOOL WINAPI PIXGetCounterInfo( DWORD* pdwReturnCounters, PIXCOUNTERINFO** ppCounterInfoList ){ *pdwReturnCounters = ARRAY_LENGTH(pixCounterSet); *ppCounterInfoList = &pixCounterSet[0]; return TRUE;}
开发者ID:KNeal,项目名称:Oculus,代码行数:9,
示例9: parse_optionsstatic int parse_options(int argc, char *argv[], options *opts){ int pending_base = FALSE; int pending_arch = FALSE; int pending_mode = FALSE; int curarch; int numrows; int arg; memset(opts, 0, sizeof(*opts)); // loop through arguments for (arg = 1; arg < argc; arg++) { char *curarg = argv[arg]; // is it a switch? if (curarg[0] == '-') { if (pending_base || pending_arch || pending_mode) goto usage; if (tolower((UINT8)curarg[1]) == 'a') pending_arch = TRUE; else if (tolower((UINT8)curarg[1]) == 'b') pending_base = TRUE; else if (tolower((UINT8)curarg[1]) == 'f') opts->flipped = TRUE; else if (tolower((UINT8)curarg[1]) == 'l') opts->lower = TRUE; else if (tolower((UINT8)curarg[1]) == 'm') pending_mode = TRUE; else if (tolower((UINT8)curarg[1]) == 'n') opts->norawbytes = TRUE; else if (tolower((UINT8)curarg[1]) == 'u') opts->upper = TRUE; else goto usage; } // base PC else if (pending_base) { int result; if (curarg[0] == '0' && curarg[1] == 'x') result = sscanf(&curarg[2], "%x", &opts->basepc); else if (curarg[0] == '$') result = sscanf(&curarg[1], "%x", &opts->basepc); else result = sscanf(&curarg[0], "%x", &opts->basepc); if (result != 1) goto usage; pending_base = FALSE; } // mode else if (pending_mode) { if (sscanf(curarg, "%d", &opts->mode) != 1) goto usage; pending_mode = FALSE; } // architecture else if (pending_arch) { for (curarch = 0; curarch < ARRAY_LENGTH(dasm_table); curarch++) if (core_stricmp(curarg, dasm_table[curarch].name) == 0) break; if (curarch == ARRAY_LENGTH(dasm_table)) goto usage; opts->dasm = &dasm_table[curarch]; pending_arch = FALSE; } // filename else if (opts->filename == NULL) opts->filename = curarg; // fail else goto usage; } // if we have a dangling option, error if (pending_base || pending_arch || pending_mode) goto usage; // if no file or no architecture, fail if (opts->filename == NULL || opts->dasm == NULL) goto usage; return 0;usage: printf("Usage: %s <filename> -arch <architecture> [-basepc <pc>] /n", argv[0]); printf(" [-mode <n>] [-norawbytes] [-flipped] [-upper] [-lower]/n"); printf("/n"); printf("Supported architectures:"); numrows = (ARRAY_LENGTH(dasm_table) + 6) / 7; for (curarch = 0; curarch < numrows * 7; curarch++)//.........这里部分代码省略.........
开发者ID:hstampfl,项目名称:mame2010-libretro,代码行数:101,
示例10: pr8210_add_commandINLINE void pr8210_add_command(UINT8 command){ pr8210_command_buffer[pr8210_command_buffer_in++ % ARRAY_LENGTH(pr8210_command_buffer)] = (command & 0x1f) | 0x20; pr8210_command_buffer[pr8210_command_buffer_in++ % ARRAY_LENGTH(pr8210_command_buffer)] = 0x00 | 0x20;}
开发者ID:nitrologic,项目名称:emu,代码行数:5,
示例11: ARRAY_LENGTH#define OP_NOP 0#define OP_VIBRATE 1#define OP_SHOW_NOTCONNECTED 2#define OP_FIND_ME 3#define OP_UNREAD_MESSAGE_COUNT 4#define OP_CURRENT_HR 5static char unread_sms_buffer[4];static char current_hr_buffer[4];static char bt_notification_delay = 0;static const uint32_t const disconnect_segments[] = { 300, 300, 300, 300, 300 };VibePattern disconnecte_pat = { .durations = disconnect_segments, .num_segments = ARRAY_LENGTH(disconnect_segments),};static void inbox_received_handler(DictionaryIterator *iterator, void *context) { // Get the first pair Tuple *t = dict_read_first(iterator); // Process all pairs present while(t != NULL) { // Process this pair's key APP_LOG(APP_LOG_LEVEL_INFO, "Got opcode: %d, value: %d", (int)t->key, (int)t->value->int32); switch(t->key) { case OP_VIBRATE: // Trigger vibration vibes_short_pulse();
开发者ID:garo,项目名称:GaroWatchface,代码行数:31,
示例12: progNamevoid TestDx::testDxCmdLineArgs(){ string progName("TestDxCmdLineArgs"); int defaultMainPort(9999); int defaultRemotePort(5555); string defaultHost("thisHost"); string defaultSciDataDir("fooDir"); string defaultSciDataPrefix("nss.p10"); bool defaultBroadcast(false); bool defaultNoUi(false); bool defaultVaryOutputData(false); string defaultDxName("dxsim33"); bool defaultRemoteMode(false); DxCmdLineArgs cmdArgs(progName, defaultMainPort, defaultRemotePort, defaultHost, defaultSciDataDir, defaultSciDataPrefix, defaultBroadcast, defaultNoUi, defaultVaryOutputData, defaultDxName, defaultRemoteMode); // test usage message output cmdArgs.usage(); cerr << endl; // check the defaults cu_assert (cmdArgs.getMainPort() == 9999); cu_assert (cmdArgs.getRemotePort() == 5555); cu_assert (cmdArgs.getHostName() == "thisHost"); cu_assert (cmdArgs.getSciDataDir() == "fooDir"); cu_assert (cmdArgs.getSciDataPrefix() == "nss.p10"); cu_assert (! cmdArgs.getBroadcast()); cu_assert (! cmdArgs.getNoUi()); cu_assert (! cmdArgs.getVaryOutputData()); cu_assert (cmdArgs.getDxName() == "dxsim33"); cu_assert (! cmdArgs.getRemoteMode()); // try setting good parameters const char *argv[] = { "ProgName", "-host", "matrix", "-mainport", "8888", "-remport", "9999", "-sddir", "../scienceData", "-sdprefix", "nss.p6", "-broadcast", "-name", "dxsim127", "-remote", "-noui", "-vary" }; const int argc = ARRAY_LENGTH(argv); // verify that everything parses cu_assert(cmdArgs.parseArgs(argc, const_cast<char **>(argv))); // check the values cu_assert (cmdArgs.getHostName() == "matrix"); cu_assert (cmdArgs.getMainPort() == 8888); cu_assert (cmdArgs.getRemotePort() == 9999); cu_assert (cmdArgs.getSciDataDir() == "../scienceData"); cu_assert (cmdArgs.getSciDataPrefix() == "nss.p6"); cu_assert (cmdArgs.getBroadcast()); cu_assert (cmdArgs.getDxName() == "dxsim127"); cu_assert (cmdArgs.getRemoteMode()); cu_assert (cmdArgs.getNoUi()); cu_assert (cmdArgs.getVaryOutputData()); cout << "Test a bad port number:" << endl; const char *argvBadPort[] = { "ProgName", "-host", "matrix", "-mainport", "badportnumber", }; const int argcBadPort = ARRAY_LENGTH(argvBadPort); cu_assert(cmdArgs.parseArgs(argcBadPort, const_cast<char **>(argvBadPort)) == false);}
开发者ID:Abhishekpatil,项目名称:SonATA,代码行数:85,
示例13: core_fgetc//.........这里部分代码省略......... else if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == 0xfe && bom[3] == 0xff) { file->text_type = TFT_UTF32BE; pos = 4; } else if (bom[0] == 0xff && bom[1] == 0xfe && bom[2] == 0x00 && bom[3] == 0x00) { file->text_type = TFT_UTF32LE; pos = 4; } else if (bom[0] == 0xfe && bom[1] == 0xff) { file->text_type = TFT_UTF16BE; pos = 2; } else if (bom[0] == 0xff && bom[1] == 0xfe) { file->text_type = TFT_UTF16LE; pos = 2; } else { file->text_type = TFT_OSD; pos = 0; } } core_fseek(file, pos, SEEK_SET); } /* fetch the next character */ switch (file->text_type) { default: case TFT_OSD: readlen = core_fread(file, default_buffer, sizeof(default_buffer)); if (readlen > 0) { charlen = osd_uchar_from_osdchar(&uchar, default_buffer, readlen / sizeof(default_buffer[0])); core_fseek(file, (INT64) (charlen * sizeof(default_buffer[0])) - readlen, SEEK_CUR); } break; case TFT_UTF8: readlen = core_fread(file, utf8_buffer, sizeof(utf8_buffer)); if (readlen > 0) { charlen = uchar_from_utf8(&uchar, utf8_buffer, readlen / sizeof(utf8_buffer[0])); core_fseek(file, (INT64) (charlen * sizeof(utf8_buffer[0])) - readlen, SEEK_CUR); } break; case TFT_UTF16BE: readlen = core_fread(file, utf16_buffer, sizeof(utf16_buffer)); if (readlen > 0) { charlen = uchar_from_utf16be(&uchar, utf16_buffer, readlen / sizeof(utf16_buffer[0])); core_fseek(file, (INT64) (charlen * sizeof(utf16_buffer[0])) - readlen, SEEK_CUR); } break; case TFT_UTF16LE: readlen = core_fread(file, utf16_buffer, sizeof(utf16_buffer)); if (readlen > 0) { charlen = uchar_from_utf16le(&uchar, utf16_buffer, readlen / sizeof(utf16_buffer[0])); core_fseek(file, (INT64) (charlen * sizeof(utf16_buffer[0])) - readlen, SEEK_CUR); } break; case TFT_UTF32BE: if (core_fread(file, &uchar, sizeof(uchar)) == sizeof(uchar)) uchar = BIG_ENDIANIZE_INT32(uchar); break; case TFT_UTF32LE: if (core_fread(file, &uchar, sizeof(uchar)) == sizeof(uchar)) uchar = LITTLE_ENDIANIZE_INT32(uchar); break; } if (uchar != ~0) { /* place the new character in the ring buffer */ file->back_char_head = 0; file->back_char_tail = utf8_from_uchar(file->back_chars, ARRAY_LENGTH(file->back_chars), uchar); /* assert(file->back_char_tail != -1);*/ } } /* now read from the ring buffer */ if (file->back_char_head != file->back_char_tail) { result = file->back_chars[file->back_char_head++]; file->back_char_head %= ARRAY_LENGTH(file->back_chars); } else result = EOF; return result;}
开发者ID:Eduardop,项目名称:mame,代码行数:101,
示例14: output_reportstatic void output_report(astring &dirname, astring &tempheader, astring &tempfooter, summary_file *filelist){ summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT]; summary_file *curfile; astring title("MAME Regressions"); astring tempname; int listnum, bucknum; core_file *indexfile; int count = 0, total; /* initialize the lists */ for (bucknum = 0; bucknum < BUCKET_COUNT; bucknum++) { buckethead[bucknum] = NULL; buckettailptr[bucknum] = &buckethead[bucknum]; } /* compute the total number of files */ total = 0; for (curfile = filelist; curfile != NULL; curfile = curfile->next) total++; /* first bucketize the games */ for (curfile = filelist; curfile != NULL; curfile = curfile->next) { int statcount[STATUS_COUNT] = { 0 }; int bucket = BUCKET_UNKNOWN; int unique_codes = 0; int first_valid; /* print status */ if (++count % 100 == 0) fprintf(stderr, "Processing file %d/%d/n", count, total); /* find the first valid entry */ for (first_valid = 0; curfile->status[first_valid] == STATUS_NOT_PRESENT; first_valid++) ; /* do we need to output anything? */ for (listnum = first_valid; listnum < list_count; listnum++) if (statcount[curfile->status[listnum]]++ == 0) unique_codes++; /* were we consistent? */ if (unique_codes == 1) { /* were we consistently ok? */ if (curfile->status[first_valid] == STATUS_SUCCESS) bucket = compare_screenshots(curfile); /* must have been consistently erroring */ else bucket = BUCKET_CONSISTENT_ERROR; } /* ok, we're not consistent; could be a number of things */ else { /* were we ok at the start and end but not in the middle? */ if (curfile->status[first_valid] == STATUS_SUCCESS && curfile->status[list_count - 1] == STATUS_SUCCESS) bucket = BUCKET_GOOD_BUT_CHANGED; /* did we go from good to bad? */ else if (curfile->status[first_valid] == STATUS_SUCCESS) bucket = BUCKET_REGRESSED; /* did we go from bad to good? */ else if (curfile->status[list_count - 1] == STATUS_SUCCESS) bucket = BUCKET_IMPROVED; /* must have had multiple errors */ else bucket = BUCKET_MULTI_ERROR; } /* add us to the appropriate list */ *buckettailptr[bucket] = curfile; buckettailptr[bucket] = &curfile->next; } /* terminate all the lists */ for (bucknum = 0; bucknum < BUCKET_COUNT; bucknum++) *buckettailptr[bucknum] = NULL; /* output header */ tempname.printf("%s" PATH_SEPARATOR "%s", dirname.cstr(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); if (indexfile == NULL) { fprintf(stderr, "Error creating file '%s'/n", tempname.cstr()); return; } /* iterate over buckets and output them */ for (bucknum = 0; bucknum < ARRAY_LENGTH(bucket_output_order); bucknum++) { int curbucket = bucket_output_order[bucknum]; if (buckethead[curbucket] != NULL) { fprintf(stderr, "Outputting bucket: %s/n", bucket_name[curbucket]);//.........这里部分代码省略.........
开发者ID:Archlogic,项目名称:libretro-mame,代码行数:101,
示例15: core_ungetcint core_ungetc(int c, core_file *file){ file->back_chars[file->back_char_tail++] = (char) c; file->back_char_tail %= ARRAY_LENGTH(file->back_chars); return c;}
开发者ID:Eduardop,项目名称:mame,代码行数:6,
示例16: MCFG_QUANTUM_TIME MCFG_QUANTUM_TIME(attotime::from_hz(60)) MCFG_MACHINE_START( c64 ) MCFG_MACHINE_RESET( c64 ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) /* not accurate */ MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) MCFG_SCREEN_UPDATE( c64 ) MCFG_PALETTE_INIT( c64 ) MCFG_PALETTE_LENGTH(ARRAY_LENGTH(c64_palette) / 3) MCFG_VIC2_ADD("vic2", c64_vic2_ntsc_intf) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("sid6581", SID6581, VIC6567_CLOCK) MCFG_SOUND_CONFIG(c64_sound_interface) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MCFG_SOUND_ADD("dac", DAC, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* quickload */ MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS) /* cassette */
开发者ID:cdenix,项目名称:psmame,代码行数:31,
示例17: handle_initvoid handle_init(void) { window = window_create(); window_stack_push(window, true /* Animated */); window_set_background_color(window, GColorBlack); Layer *window_layer = window_get_root_layer(window); // Setup weather bar Layer *weather_holder = layer_create(GRect(0, 0, 144, 50)); layer_add_child(window_layer, weather_holder); icon_layer = bitmap_layer_create(GRect(8, 0, 40, 40)); layer_add_child(weather_holder, bitmap_layer_get_layer(icon_layer)); temp_layer = text_layer_create(GRect(32, 3, 144 - 40, 28)); text_layer_set_text_color(temp_layer, GColorWhite); text_layer_set_background_color(temp_layer, GColorClear); text_layer_set_font(temp_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); text_layer_set_text_alignment(temp_layer, GTextAlignmentRight); layer_add_child(weather_holder, text_layer_get_layer(temp_layer)); // Initialize date & time text Layer *date_holder = layer_create(GRect(0, 52, 144, 94)); layer_add_child(window_layer, date_holder); ResHandle roboto_21 = resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21); text_day_layer = text_layer_create(GRect(8, 0, 144-8, 25)); text_layer_set_text_color(text_day_layer, GColorWhite); text_layer_set_background_color(text_day_layer, GColorClear); text_layer_set_font(text_day_layer, fonts_load_custom_font(roboto_21)); layer_add_child(date_holder, text_layer_get_layer(text_day_layer)); text_date_layer = text_layer_create(GRect(8, 21, 144-8, 25)); text_layer_set_text_color(text_date_layer, GColorWhite); text_layer_set_background_color(text_date_layer, GColorClear); text_layer_set_font(text_date_layer, fonts_load_custom_font(roboto_21)); layer_add_child(date_holder, text_layer_get_layer(text_date_layer)); line_layer = layer_create(GRect(8, 51, 144-16, 2)); layer_set_update_proc(line_layer, line_layer_update_callback); layer_add_child(date_holder, line_layer); ResHandle roboto_49 = resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49); text_time_layer = text_layer_create(GRect(7, 45, 144-7, 49)); text_layer_set_text_color(text_time_layer, GColorWhite); text_layer_set_background_color(text_time_layer, GColorClear); text_layer_set_font(text_time_layer, fonts_load_custom_font(roboto_49)); layer_add_child(date_holder, text_layer_get_layer(text_time_layer)); // Setup messaging const int inbound_size = 64; const int outbound_size = 64; app_message_open(inbound_size, outbound_size); Tuplet initial_values[] = { TupletInteger(WEATHER_ICON_KEY, (uint8_t) 13), TupletCString(WEATHER_TEMPERATURE_KEY, ""), TupletInteger(INVERT_COLOR_KEY, persist_read_bool(INVERT_COLOR_KEY)), }; app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values), sync_tuple_changed_callback, NULL, NULL); // FIXME testing code battery_text_layer = text_layer_create(GRect(0, 75, 144-8, 30)); text_layer_set_text_color(battery_text_layer, GColorWhite); text_layer_set_background_color(battery_text_layer, GColorClear); text_layer_set_font(battery_text_layer, fonts_load_custom_font(roboto_21)); text_layer_set_text_alignment(battery_text_layer, GTextAlignmentRight); layer_add_child(window_layer, text_layer_get_layer(battery_text_layer)); // Subscribe to notifications bluetooth_connection_service_subscribe(bluetooth_connection_changed); tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick); battery_state_service_subscribe(update_battery_state); // Update the battery on launch update_battery_state(battery_state_service_peek()); // TODO: Update display here to avoid blank display on launch?}
开发者ID:nabdallah,项目名称:simpleweather,代码行数:83,
示例18: fix_propertiesstatic voidfix_properties(const bt_bdaddr_t* remote_addr, int num_properties, bt_property_t* properties){ static const bt_uuid_t uuid_zero; /* filled with zeros */ int i; for (i = 0; i < num_properties; ++i) { if (properties[i].type == BT_PROPERTY_SERVICE_RECORD) { /* Bug 1142007: BT_PROPERTY_SERVICE_RECORD returns * * { * .uuid = 0, * .channel = SCN, * .name = "/0" * } * * for every remote service. We replace the UUID with * the one we asked for in |get_remote_service_record|. */ struct get_remote_service_record_params* params; bt_service_record_t* rec; params = fetch_get_remote_service_record_params(remote_addr); if (!params) { ALOGW("no parameters for BT_PROPERTY_SERVICE_RECORD stored"); continue; /* no params stored; send record as-is */ } rec = properties[i].val; if (memcmp(&uuid_zero, &rec->uuid, sizeof(uuid_zero))) { free_get_remote_service_record_params(params); continue; /* record contains non-zero UUID; nothing to fix */ } /* We replace the property's UUID with the one we stored * for |get_remote_service_record|. That will make Gecko * recognize the notification correctly. The channel is * left as it is. We can set an arbitrary string for the * name. * * Remote devices can create their own names for services * they provide. We have no way of knowing them, so we set * the service's name as defined by the SDP spec and use * "/0" for any other service. Applications can at least * detect this case easily and use a generic string. */ memcpy(&rec->uuid, ¶ms->uuid, sizeof(rec->uuid)); strncpy(rec->name, lookup_service_name_by_uuid16( UUID16(rec->uuid.uu[2], rec->uuid.uu[3]), ""), sizeof(rec->name)); rec->name[ARRAY_LENGTH(rec->name) - 1] = '/0'; /* always terminate */ free_get_remote_service_record_params(params); } }}
开发者ID:shes050117,项目名称:platform_system_bluetoothd,代码行数:63,
示例19: handle_init/* Initialization*/void handle_init( void ) { window = window_create(); window_stack_push( window, true ); Layer *window_layer = window_get_root_layer( window ); // Read persistent data if ( persist_exists( SETTING_STATUS_KEY ) ) { current_status = persist_read_int( SETTING_STATUS_KEY ); } else { current_status = STATUS_ON; } if ( persist_exists( SETTING_WEATHERSTATUS_KEY ) ) { weather_status = persist_read_int( SETTING_WEATHERSTATUS_KEY ); } else { weather_status = WEATHER_ON; } if ( persist_exists( SETTING_LANGUAGE_KEY ) ) { current_language = persist_read_int( SETTING_LANGUAGE_KEY ); } else { current_language = LANG_EN; } if ( persist_exists( SETTING_FORMAT_KEY ) ) { current_format = persist_read_int( SETTING_FORMAT_KEY ); } else { current_format = FORMAT_WEEK; } if ( persist_exists( SETTING_INVERT_KEY ) ) { invert_format = persist_read_int( SETTING_INVERT_KEY ); } else { invert_format = INVERT_ON; } if ( persist_exists( BLUETOOTHVIBE_KEY ) ) { bluetoothvibe_status = persist_read_int( BLUETOOTHVIBE_KEY ); } else { bluetoothvibe_status = BLUETOOTHVIBE_ON; } if ( persist_exists( HOURLYVIBE_KEY ) ) { hourlyvibe_status = persist_read_int( HOURLYVIBE_KEY ); } else { hourlyvibe_status = HOURLYVIBE_ON; } if ( persist_exists( SECS_KEY ) ) { secs_status = persist_read_int( SECS_KEY ); } else { secs_status = SECS_ON; } // Read watchface settings from persistent data or use default values current_status = persist_exists( SETTING_STATUS_KEY ) ? persist_read_int( SETTING_STATUS_KEY ) : STATUS_ON; weather_status = persist_exists( SETTING_WEATHERSTATUS_KEY ) ? persist_read_int( SETTING_WEATHERSTATUS_KEY ) : WEATHER_ON; current_language = persist_exists( SETTING_LANGUAGE_KEY ) ? persist_read_int( SETTING_LANGUAGE_KEY ) : LANG_EN; current_format = persist_exists( SETTING_FORMAT_KEY ) ? persist_read_int( SETTING_FORMAT_KEY ) : FORMAT_WEEK; invert_format = persist_exists( SETTING_INVERT_KEY ) ? persist_read_int( SETTING_INVERT_KEY ) : INVERT_ON; bluetoothvibe_status = persist_exists( BLUETOOTHVIBE_KEY ) ? persist_read_int( BLUETOOTHVIBE_KEY ) : BLUETOOTHVIBE_ON; hourlyvibe_status = persist_exists( HOURLYVIBE_KEY ) ? persist_read_int( HOURLYVIBE_KEY ) : HOURLYVIBE_ON; secs_status = persist_exists( SECS_KEY ) ? persist_read_int( SECS_KEY ) : SECS_ON; // Background image background_image = gbitmap_create_with_resource( RESOURCE_ID_IMAGE_BACKGROUND ); background_layer = bitmap_layer_create( layer_get_frame( window_layer ) ); bitmap_layer_set_bitmap( background_layer, background_image ); layer_add_child( window_layer, bitmap_layer_get_layer( background_layer ) ); // Initial settings Tuplet initial_values[] = { TupletInteger( SETTING_STATUS_KEY, current_status ) , TupletInteger( SETTING_WEATHERSTATUS_KEY, weather_status ) , TupletInteger( SETTING_LANGUAGE_KEY, current_language ) , TupletInteger( SETTING_FORMAT_KEY, current_format ) , TupletInteger( SETTING_INVERT_KEY, invert_format ) , TupletInteger( BLUETOOTHVIBE_KEY, bluetoothvibe_status ) , TupletInteger( HOURLYVIBE_KEY, hourlyvibe_status ) , TupletInteger( SECS_KEY, secs_status ) , TupletInteger( SETTING_ICON_KEY, (uint8_t) 14) , TupletCString( SETTING_TEMPERATURE_KEY, "") }; // Open AppMessage to transfers app_message_open( 256 , 256 ); // Initialize AppSync app_sync_init( &app, sync_buffer , sizeof( sync_buffer ) , initial_values , ARRAY_LENGTH( initial_values ) , tuple_changed_callback , app_error_callback , NULL ); // Perform sync app_sync_set( &app, initial_values, ARRAY_LENGTH( initial_values ) ); appStarted = true; //.........这里部分代码省略.........
开发者ID:llluis,项目名称:pebbleface-trekv3,代码行数:101,
示例20: PALETTE_INIT_MEMBERPALETTE_INIT_MEMBER(unior_state,unior){ palette.set_pen_colors(0, unior_palette, ARRAY_LENGTH(unior_palette));}
开发者ID:Fulg,项目名称:mame,代码行数:4,
示例21: window_loadstatic void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); static int row_height = 22; int it = 2; const int button_bar_width = 20; const int text_layer_width = 144 - button_bar_width; //Set up Window Action Bar up_arrow_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_UP_ARROW); down_arrow_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_DOWN_ARROW); settings_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_SETTINGS); window_action_bar = action_bar_layer_create(); action_bar_layer_add_to_window(window_action_bar, window); action_bar_layer_set_background_color(window_action_bar, GColorBlack); action_bar_layer_set_click_config_provider(window_action_bar, click_config_provider); action_bar_layer_set_icon(window_action_bar, BUTTON_ID_UP, up_arrow_icon); action_bar_layer_set_icon(window_action_bar, BUTTON_ID_DOWN, down_arrow_icon); action_bar_layer_set_icon(window_action_bar, BUTTON_ID_SELECT, settings_icon); // Area Name Layer area_name_layer = text_layer_create(GRect(0, -2, text_layer_width, 48)); text_layer_set_text_color(area_name_layer, GColorWhite); text_layer_set_background_color(area_name_layer, GColorClear); text_layer_set_font(area_name_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(area_name_layer, GTextAlignmentCenter); text_layer_set_overflow_mode(area_name_layer, GTextOverflowModeWordWrap); layer_add_child(window_layer, text_layer_get_layer(area_name_layer)); // Weather Description Layer weather_layer = text_layer_create(GRect(0, it++ * row_height, text_layer_width, row_height)); text_layer_set_text_color(weather_layer, GColorWhite); text_layer_set_background_color(weather_layer, GColorClear); text_layer_set_font(weather_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); text_layer_set_text_alignment(weather_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(weather_layer)); // Snowfall Layer snowfall_layer = text_layer_create(GRect(0, it++ * row_height, text_layer_width, row_height)); text_layer_set_text_color(snowfall_layer, GColorWhite); text_layer_set_background_color(snowfall_layer, GColorClear); text_layer_set_font(snowfall_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); text_layer_set_text_alignment(snowfall_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(snowfall_layer)); // Temperature Layer temps_layer = text_layer_create(GRect(0, it++ * row_height, text_layer_width, row_height)); text_layer_set_text_color(temps_layer, GColorWhite); text_layer_set_background_color(temps_layer, GColorClear); text_layer_set_font(temps_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); text_layer_set_text_alignment(temps_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(temps_layer)); // Wind Layer wind_layer = text_layer_create(GRect(0, it++ * row_height, text_layer_width, row_height)); text_layer_set_text_color(wind_layer, GColorWhite); text_layer_set_background_color(wind_layer, GColorClear); text_layer_set_font(wind_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); text_layer_set_text_alignment(wind_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(wind_layer)); // Update Time Layer update_layer = text_layer_create(GRect(0, it++ * row_height + 4, text_layer_width, row_height)); text_layer_set_text_color(update_layer, GColorWhite); text_layer_set_background_color(update_layer, GColorClear); text_layer_set_font(update_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); text_layer_set_text_alignment(update_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(update_layer)); Tuplet initial_values[] = { TupletInteger(INDEX_KEY, (uint8_t) 0), TupletCString(AREA_NAME_KEY, "Loading..."), TupletCString(WEATHER_DESC_KEY, "Loading..."), TupletCString(WIND_KEY, "Wind: --- @ -- ---"), TupletCString(AREA_TEMPS_KEY, "Temp(--): -- to --"), TupletCString(AREA_SNOWFALL_KEY, "Snow(24h): -- "), TupletCString(UPDATE_TIME_KEY, "Updated @ --:--"), TupletInteger(UNITS_KEY, (uint8_t) 0), }; app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values), sync_tuple_changed_callback, sync_error_callback, NULL); send_cmd();}
开发者ID:aclymer,项目名称:skireport_V0_55,代码行数:84,
示例22: test_composite/* * Composite operation with pseudorandom images */uint32_ttest_composite (int testnum, int verbose){ int i; pixman_image_t * src_img; pixman_image_t * dst_img; pixman_region16_t clip; int dst_width, dst_height; int dst_stride; int dst_x, dst_y; int dst_bpp; pixman_op_t op; uint32_t * dst_bits; uint32_t crc32; pixman_format_code_t mask_format, dst_format; pixman_trapezoid_t *traps; int src_x, src_y; int n_traps; static pixman_color_t colors[] = { { 0xffff, 0xffff, 0xffff, 0xffff }, { 0x0000, 0x0000, 0x0000, 0x0000 }, { 0xabcd, 0xabcd, 0x0000, 0xabcd }, { 0x0000, 0x0000, 0x0000, 0xffff }, { 0x0101, 0x0101, 0x0101, 0x0101 }, { 0x7777, 0x6666, 0x5555, 0x9999 }, }; FLOAT_REGS_CORRUPTION_DETECTOR_START (); lcg_srand (testnum); op = RANDOM_ELT (operators); mask_format = RANDOM_ELT (mask_formats); /* Create source image */ if (lcg_rand_n (4) == 0) { src_img = pixman_image_create_solid_fill ( &(colors[lcg_rand_n (ARRAY_LENGTH (colors))])); src_x = 10; src_y = 234; } else { pixman_format_code_t src_format = RANDOM_ELT(formats); int src_bpp = (PIXMAN_FORMAT_BPP (src_format) + 7) / 8; int src_width = lcg_rand_n (MAX_SRC_WIDTH) + 1; int src_height = lcg_rand_n (MAX_SRC_HEIGHT) + 1; int src_stride = src_width * src_bpp + lcg_rand_n (MAX_STRIDE) * src_bpp; uint32_t *bits; src_x = -(src_width / 4) + lcg_rand_n (src_width * 3 / 2); src_y = -(src_height / 4) + lcg_rand_n (src_height * 3 / 2); src_stride = (src_stride + 3) & ~3; bits = (uint32_t *)make_random_bytes (src_stride * src_height); src_img = pixman_image_create_bits ( src_format, src_width, src_height, bits, src_stride); pixman_image_set_destroy_function (src_img, destroy_bits, bits); if (lcg_rand_n (8) == 0) { pixman_box16_t clip_boxes[2]; int n = lcg_rand_n (2) + 1; for (i = 0; i < n; i++) { clip_boxes[i].x1 = lcg_rand_n (src_width); clip_boxes[i].y1 = lcg_rand_n (src_height); clip_boxes[i].x2 = clip_boxes[i].x1 + lcg_rand_n (src_width - clip_boxes[i].x1); clip_boxes[i].y2 = clip_boxes[i].y1 + lcg_rand_n (src_height - clip_boxes[i].y1); if (verbose) { printf ("source clip box: [%d,%d-%d,%d]/n", clip_boxes[i].x1, clip_boxes[i].y1, clip_boxes[i].x2, clip_boxes[i].y2); } } pixman_region_init_rects (&clip, clip_boxes, n); pixman_image_set_clip_region (src_img, &clip); pixman_image_set_source_clipping (src_img, 1); pixman_region_fini (&clip); } image_endian_swap (src_img);//.........这里部分代码省略.........
开发者ID:podain,项目名称:pixman,代码行数:101,
示例23: processvoid ui_menu_add_change_folder::handle(){ // process the menu const ui_menu_event *m_event = process(0); if (m_event != nullptr && m_event->itemref != nullptr) { if (m_event->iptkey == IPT_UI_SELECT) { int index = (FPTR)m_event->itemref - 1; const ui_menu_item &pitem = item[index]; // go up to the parent path if (!strcmp(pitem.text, "..")) { size_t first_sep = m_current_path.find_first_of(PATH_SEPARATOR[0]); size_t last_sep = m_current_path.find_last_of(PATH_SEPARATOR[0]); if (first_sep != last_sep) m_current_path.erase(++last_sep); } else { // if isn't a drive, appends the directory if (strcmp(pitem.subtext, "[DRIVE]") != 0) { if (m_current_path[m_current_path.length() - 1] == PATH_SEPARATOR[0]) m_current_path.append(pitem.text); else m_current_path.append(PATH_SEPARATOR).append(pitem.text); } else m_current_path = pitem.text; } // reset the char buffer also in this case if (m_search[0] != 0) m_search[0] = '/0'; reset(UI_MENU_RESET_SELECT_FIRST); } else if (m_event->iptkey == IPT_SPECIAL) { int buflen = strlen(m_search); bool update_selected = FALSE; // if it's a backspace and we can handle it, do so if ((m_event->unichar == 8 || m_event->unichar == 0x7f) && buflen > 0) { *(char *)utf8_previous_char(&m_search[buflen]) = 0; update_selected = TRUE; } // if it's any other key and we're not maxed out, update else if (m_event->unichar >= ' ' && m_event->unichar < 0x7f) { buflen += utf8_from_uchar(&m_search[buflen], ARRAY_LENGTH(m_search) - buflen, m_event->unichar); m_search[buflen] = 0; update_selected = TRUE; } // Tab key, save current path else if (m_event->unichar == 0x09) { std::string error_string; if (m_change) { if (machine().ui().options().exists(s_folders_entry[m_ref].option)) { machine().ui().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); } else { if (strcmp(machine().options().value(s_folders_entry[m_ref].option), m_current_path.c_str()) != 0) { machine().options().set_value(s_folders_entry[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(s_folders_entry[m_ref].option); } } machine().datfile().reset_run(); } else { std::string tmppath; if (machine().ui().options().exists(s_folders_entry[m_ref].option)) { tmppath.assign(machine().ui().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); } else { tmppath.assign(machine().options().value(s_folders_entry[m_ref].option)).append(";").append(m_current_path.c_str()); } if (machine().ui().options().exists(s_folders_entry[m_ref].option)) { machine().ui().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); } else { if (strcmp(machine().options().value(s_folders_entry[m_ref].option), tmppath.c_str()) != 0) { machine().options().set_value(s_folders_entry[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(s_folders_entry[m_ref].option); } } } ui_menu::menu_stack->parent->reset(UI_MENU_RESET_SELECT_FIRST);//.........这里部分代码省略.........
开发者ID:MazingR,项目名称:liveemu_external_fork_mame,代码行数:101,
示例24: CRaderDamageCCockpit::CCockpit(){ for(Sint32 ii=0;ii<enSwitchMax;ii++) { m_bSwitch[ii] = gxFalse; m_sAutoTimer[ii] = 0; m_bAutoSwitch[ii] = gxTrue; } m_sScore = 0; m_pMessage = NULL; m_fMessageScroll = ZERO; m_sMessageWait = 0; m_sMessagelength = 0; m_bMessageEnable = gxTrue; m_bArrow = gxFalse; m_sArrowWait = 100; m_sArrowRot = 0; m_pRaderDamage = NULL; m_pRaderControl = NULL; m_pMsgWindow = NULL; m_pStageClear = NULL; m_pBellowPoint = NULL; m_pBellowBurn = NULL; m_pRaderDamage = new CRaderDamage(); m_pRaderControl = new CRaderControl(); m_pMsgWindow = new CMsgWindow(); //バ C++ ARRAY_SIZE函数代码示例 C++ ARRAY_LEN函数代码示例
|