int main(int argc, char *argv[]) { int i; int j; setup(); for (i = 0; i < KALEID_N_STATES; i++) { printf("Kaleidoscope state set to %d\n", i); kaleidoscope_set_state(&kg, i); BUG_ON(!kaleidoscope_exists(&perm.kt_kh)); for (j = 0; j < KALEID_N_STATES; j++) BUG_ON(!!kaleidoscope_exists(&states[j].kt_kh) != (j == i)); } synchronize_rcu(); synchronize_rcu(); dump_all(); printf("\n"); setup(); printf("Kaleidoscope commit to state 0\n"); kaleidoscope_set_state(&kg, 0); kaleidoscope_commit(&kg); BUG_ON(!kaleidoscope_exists(&perm.kt_kh)); BUG_ON(!kaleidoscope_exists(&states[0].kt_kh)); for (i = 1; i < KALEID_N_STATES; i++) BUG_ON(kaleidoscope_exists(&states[i].kt_kh) != (i == 0)); synchronize_rcu(); synchronize_rcu(); dump_all(); return 0; }
static int rgz_out_bvcmd_paint(rgz_t *rgz, rgz_out_params_t *params) { int rv = 0; unsigned int i; (void)rgz; rgz_blts_init(&blts); if (params->data.bvc.clrdst) { rgz_out_clrdst(rgz, params); } for (i = 0; i < rgz->layerno; i++) { hwc_layer_1_t *l = &rgz->layers[i]; if (l->compositionType != HWC_OVERLAY) continue; rv = rgz_hwc_layer_blit(l, NULL, params->data.bvc.dstgeom, params->data.bvc.noblend, rgz->layersbuf[i]); if (rv) { OUTE("bvcmd_paint: error in layer %d: %d", i, rv); dump_all(rgz->layers, rgz->layerno, i); rgz_blts_free(&blts); return rv; } } params->data.bvc.cmdp = blts.bvcmds; params->data.bvc.cmdlen = blts.idx; //rgz_blts_free(&blts); return rv; }
static int rgz_out_bvdirect_paint(rgz_t *rgz, rgz_out_params_t *params) { int rv = 0; unsigned int i; (void)rgz; rgz_blts_init(&blts); for (i = 0; i < rgz->layerno; i++) { hwc_layer_1_t *l = &rgz->layers[i]; if (l->compositionType != HWC_OVERLAY) continue; rv = rgz_hwc_layer_blit(l, params->data.bv.dstdesc, params->data.bv.dstgeom, params->data.bv.noblend, -1); if (rv) { OUTE("bvdirect_paint: error in layer %d: %d", i, rv); dump_all(rgz->layers, rgz->layerno, i); rgz_blts_free(&blts); return rv; } } rgz_blts_bvdirect(rgz, &blts, params); rgz_blts_free(&blts); return rv; }
int main(int argc, char *argv[]) { int i, j, nfn, fd, ret; u_int mask; ds_ioctl_arg_t arg; #if (!defined(__BEOS__) && !defined(__ANTARES__)) major = lookup_dev("pcmcia"); if (major < 0) { fprintf(stderr, "no pcmcia driver in /proc/devices\n"); exit(EXIT_FAILURE); } #endif for (i = 0; i < MAX_SOCKS; i++) { fd = open_sock(i); if (fd < 0) break; arg.tuple.TupleDataMax = sizeof(arg.tuple_parse.data); arg.tuple.Attributes = TUPLE_RETURN_COMMON; arg.tuple.DesiredTuple = CISTPL_LONGLINK_MFC; arg.tuple.TupleOffset = 0; if (ioctl(fd, DS_GET_FIRST_TUPLE, &arg) == 0) { ioctl(fd, DS_GET_TUPLE_DATA, &arg); ioctl(fd, DS_PARSE_TUPLE, &arg); nfn = arg.tuple_parse.parse.longlink_mfc.nfn; } else { nfn = 1; arg.tuple.DesiredTuple = CISTPL_DEVICE; ret = ioctl(fd, DS_GET_FIRST_TUPLE, &arg); if (ret != 0) { if (errno != ENODEV) perror("ioctl()"); continue; } } arg.tuple.DesiredTuple = CISTPL_CONFIG; for (j = 0; j < nfn; j++) { printf("Socket %d function %d:\n", i, j); if (ioctl(fd, DS_GET_NEXT_TUPLE, &arg) != 0) { printf(" no config tuple: %s\n\n", strerror(errno)); continue; } ioctl(fd, DS_GET_TUPLE_DATA, &arg); ioctl(fd, DS_PARSE_TUPLE, &arg); printf(" Config register base = %#4.4x, mask = %#4.4x\n", arg.tuple_parse.parse.config.base, arg.tuple_parse.parse.config.rmask[0]); mask = arg.tuple_parse.parse.config.rmask[0]; dump_all(fd, j, (nfn > 1), mask); } } return 0; }
int main() { PTable pt; Record rec, *prec; int i, total = 3; pt = pit_table_initialize(sizeof(Record), TABLE_HAS_ID | TABLE_HAS_TIMESTAMPS); for(i = 0; i < total; i++) { rec.id = 0; rec.value = 0x11223344 + i + 1; strcpy(rec.name, "test"); rec.created_at = rec.updated_at = (time_t)0; prec = (Record *)pit_table_insert(pt, (char *)&rec); dump(prec); } prec = (Record *)pit_table_find(pt, total - 1); pit_table_mark(pt, prec->id); printf("current: %d\n", pt->current); printf("Deleting %d\n", 1); prec = (Record *)pit_table_delete(pt, 1); printf("current: %d\n", pt->current); dump_all(pt); FILE *file = fopen("/tmp/.pit", "w"); pit_table_save(file, pt); fclose(file); file = fopen("/tmp/.pit", "r"); pt = pit_table_load(file); dump_all(pt); printf("current: %d\n", pt->current); fclose(file); pit_table_free(pt); printf("OK\n"); return 0; }
/* Invocation */ int radau5_solve ( double startx, double endx, double* starty, RadauRHS rhs, RadauOut out ) { int ii; int N = (int) N_VARS; /* initialise */ x = startx; xend = endx; /* client can pass a NULL y if initialising elsewhere (or indeed if happy with all ys starting at 0 */ if ( starty ) { for ( ii = 0; ii < N_VARS; ++ii ) y[ii] = starty[ii]; } /* we may need to clear out some leftovers from a previous run (the bounds on these loops have been identified empirically) */ for ( ii = 7; ii < 20; ++ii ) work[ii] = 0; for ( ii = 6; ii < 20; ++ii ) iwork[ii] = 0; if ( ! rhs ) rhs = dummy_RHS; if ( ! out ) out = dummy_out; #ifdef RADAU_DEBUG printf("\n*** RADUA5_SOLVE ***\n"); dump_all(); printf("\n"); #endif #ifdef RADAU_SUPER_DEBUG super_dump_all( startx, endx ); #endif RADAU5 ( &N, rhs, &x, y, &xend, &h, rtol, atoler, &itol, dummy_jac, &ijac, &mljac, &mujac, DIAGONAL ? diag_mass : full_mass, &imas, &mlmas, &mumas, out, &iout, work, &lwork, iwork, &liwork, rpar, ipar, &idid ); return idid; }
int main (int argc, char **argv) { g_type_init (); g_assert (argc <= 2); if (argc > 1 && !g_strcmp0 (argv[1], "--fake")) nm_fake_platform_setup (); else nm_linux_platform_setup (); dump_all (); return EXIT_SUCCESS; }
void* event_loop(void* args) { struct hash_list hash; while (1) { char command[256]; // sprintf( command, "grep VmSize /proc/%d/status", getpid() ); // system( command ); int i; for (i=0;i<received_data_queue_tail;++i) { char t; memcpy(&t,&received_data_queue[received_data_queue_head++],512); t_split *directives = ksplit(&t," "); if (strcmp(directives->splited_ary[0],"GET") == 0) { char *datagram; *datagram = search(directives->splited_ary[1]); //memcpy(&send_data_queue[send_data_queue_tail++],datagram,strsize(datagram)); strcpy(&send_data_queue[send_data_queue_tail++],datagram); if (send_data_queue_tail > MAX_SEND_QUEUE) send_data_queue_tail = 0; } else if (strcmp(directives->splited_ary[0],"SET") == 0) { create_hashstruct(&hash,directives->splited_ary[1],directives->splited_ary[2]); insert(&hash); } else { printf("purge is not implemented."); } dump_all(); printf("%d : %d : %s\n",received_data_queue_head,received_data_queue_tail,&t); if (received_data_queue_head>MAX_RECEIVE_QUEUE) received_data_queue_head = 0; } received_data_queue_head = received_data_queue_tail = 0; usleep(1); } }
static int rgz_blts_bvdirect(rgz_t *rgz, struct rgz_blts *blts, rgz_out_params_t *params) { struct bvbatch *batch = NULL; int rv = -1; int idx = 0; while (idx < blts->idx) { struct rgz_blt_entry *e = &blts->bvcmds[idx]; if (e->bp.flags & BVFLAG_BATCH_MASK) e->bp.batch = batch; rv = bv_blt(&e->bp); if (rv) { OUTE("BV_BLT failed: %d", rv); BVDUMP("bv_blt:", " ", &e->bp); dump_all(rgz->layers, rgz->layerno, -1); return -1; } if (e->bp.flags & BVFLAG_BATCH_BEGIN) batch = e->bp.batch; idx++; } return rv; }
void delete_plugins () { dump_all (PluginDiscoverRemove); discovered = False; started = False; interfaceTable.clear (); HashTableHandleIterator it; PluginStruct *ps (0); while (pluginTable.get_prev (it, ps)) { ps->delete_plugin (); } it.reset (); ps = 0; while (pluginTable.get_prev (it, ps)) { ps->unload_plugin (); } pluginTable.empty (); externTable.clear (); delete_list (levelsHead); //if (levelsHead) { delete levelsHead; levelsHead = 0; } levelsTail = 0; maxLevel = 1; }
int main(int argc, char **argv) { printf("\nDCPU-16 emulator (CPU spec 1.7) - Reid Horuff\n"); init_dcpu(); init_hardware(); init_disassembler(); if(argc > 1) { if(!open_file( argv[1] )){ printf("Error opening file\n"); } else if( argc > 2 && !strcmp(argv[2], "-d")){ init_disassembler(); dump_all(); exit(0); } } init_gui(argc, argv); return 0; }
int main ( int argc, char** argv ) { double startY[6] = { 1.2, 3.1, 2.1, 10.6, 8.8, 5.6 }; double startX = 0; double endX = 10; unsigned int nDEs = 4; unsigned int nAlg = 2; int diag = 1; int reqMass = 0; int nDbl = 10; int nInt = 10; int err = 0; printf( "Initialising interface with nDiffEq=4, nAlgebraic=2\n" ); err = radau5_alloc ( nDEs, nAlg, diag, reqMass, nDbl, nInt ); if ( err ) { printf( "Initialisation failed with code: %d\n", err ); return err; } dump_all(); printf( "Invoking RADAU5\n" ); err = radau5_solve ( startX, endX, startY, NULL, NULL ); printf( "RADAU5 finished with return code: %d\n", err ); printf( "Deallocating interface\n" ); radau5_dealloc(); return 0; }
int main(int argc, char **argv) { LoadDBCStores("/opt/mangos_335/share/dbc"); dump_all(sAchievementStore); dump_all(sAchievementCriteriaStore); dump_all(sGemPropertiesStore); dump_all(sItemStore, true); dump_all(sItemExtendedCostStore); dump_all(sSpellStore, true); dump_all(sSpellCastTimesStore); dump_all(sSpellDifficultyStore); dump_all(sSpellDurationStore); dump_all(sSpellItemEnchantmentStore); dump_all(sSpellRadiusStore); dump_all(sSpellRangeStore); dump_all(sSpellShapeshiftStore); dump_all(sSummonPropertiesStore); return 0; }
void QUrlQueueServer::dispatch(msgpack::rpc::request req) { try { std::string method; req.method().convert(&method); if(method == "push") { msgpack::type::tuple<int, std::string, std::string> params; req.params().convert(¶ms); push_url(req, params.get<0>(), params.get<1>(), params.get<2>()); } else if(method == "pop") { pop_url(req); } else if(method == "push_url_front") { msgpack::type::tuple<int, std::string, std::string> params; req.params().convert(¶ms); push_url_front(req, params.get<0>(), params.get<1>(), params.get<2>()); } else if(method == "start_dump_all") { start_dump_all(req); } else if(method == "dump_all") { dump_all(req); } else if(method == "stats") { stats(req); } else if(method == "set_default_interval") { msgpack::type::tuple<int> params; req.params().convert(¶ms); set_default_interval(req, params.get<0>()); } else if(method == "set_site_interval") { msgpack::type::tuple<std::string, int> params; req.params().convert(¶ms); set_site_interval(req, params.get<0>(), params.get<1>()); } else if(method == "stat_site") { msgpack::type::tuple<std::string> params; req.params().convert(¶ms); stat_site(req, params.get<0>()); } else if(method == "dump_ordered_site") { msgpack::type::tuple<int> params; req.params().convert(¶ms); dump_ordered_site(req, params.get<0>()); } else if(method == "start_all") { start_all(req); } else if(method == "stop_all") { stop_all(req); } else if(method == "start_site") { msgpack::type::tuple<std::string> params; req.params().convert(¶ms); start_site(req, params.get<0>()); } else if(method == "stop_site") { msgpack::type::tuple<std::string> params; req.params().convert(¶ms); stop_site(req, params.get<0>()); } else if(method == "clear_site") { msgpack::type::tuple<std::string> params; req.params().convert(¶ms); clear_site(req, params.get<0>()); } else if(method == "start_dump_site") { msgpack::type::tuple<std::string> params; req.params().convert(¶ms); start_dump_site(req, params.get<0>()); } else if(method == "dump_site") { msgpack::type::tuple<std::string> params; req.params().convert(¶ms); dump_site(req, params.get<0>()); } else if(method == "clear_empty_site") { clear_empty_site(req); } else { req.error(msgpack::rpc::NO_METHOD_ERROR); } } catch (msgpack::type_error& e) { req.error(msgpack::rpc::ARGUMENT_ERROR); return; } catch (std::exception& e) { req.error(std::string(e.what())); return; } }
INT_PTR CALLBACK DlgProc(HWND hdlg, UINT wmsg, WPARAM wparam, LPARAM lparam){ HANDLE phandle; ULONG index; OPENFILENAME ofn; HICON icon; switch (wmsg){ case WM_INITDIALOG: GlobalList = GetDlgItem(hdlg, IDC_LIST1); icon = ::LoadIconA(GetModuleHandleA(0), (LPSTR)IDI_ICON1); SendMessageA(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)icon); SendMessageA(GlobalList, LB_RESETCONTENT, 0,0); ::EnumProcesses(pids, 4096 * sizeof(DWORD), &needed); num_of_processes = needed / sizeof(DWORD); for (DWORD i = 0; i < num_of_processes; i++){ phandle = ::OpenProcess(PROCESS_ALL_ACCESS, false, pids[i]); if (!phandle){ wsprintf(buffer, "%.04X - process can't be opened", pids[i]); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); continue; } if (!EnumProcessModules(phandle, modules, 4096 * sizeof(HMODULE), &needed)){ ::CloseHandle(phandle); wsprintfA(buffer, "%.04X - can't obtain name", pids[i]); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); continue; } if (!::GetModuleFileNameExA(phandle, modules[0], proc_name, 4096)){ ::CloseHandle(phandle); wsprintfA(buffer, "%.04X - can't obtain name", pids[i]); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); continue; } wsprintfA(buffer, "%.04X - %s", pids[i], proc_name); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); ::CloseHandle(phandle); } return 1; case WM_CLOSE: EndDialog(hdlg, 0); return 1; case WM_COMMAND: if (wparam == ID_DUMP){ index = SendMessageA(GlobalList, LB_GETCURSEL, 0,0); if (index == LB_ERR){ MessageBoxA(hdlg, "select process for dumping...", 0, 0); return 1; } mym(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.lpstrFilter = "Anyfile\0*.*\0\0"; ofn.lpstrFile = (LPSTR)x_alloc(MAX_PATH); ofn.nMaxFile = MAX_PATH; ofn.hwndOwner = hdlg; if (!GetSaveFileNameA(&ofn)){ MessageBoxA(hdlg, "select some file...", 0, 0); x_free(ofn.lpstrFile); return 1; } char *dir_name = ofn.lpstrFile + ::lstrlenA(ofn.lpstrFile) + 1; while (*dir_name != '\\') dir_name--; dir_name[0] = 0; dump_all(pids[index], ofn.lpstrFile); MessageBoxA(hdlg, "duming done...", "success", 0); x_free(ofn.lpstrFile); return 1; } if (wparam == ID_REFRESH){ SendMessageA(GlobalList, LB_RESETCONTENT, 0,0); ::EnumProcesses(pids, 4096 * sizeof(DWORD), &needed); num_of_processes = needed / sizeof(DWORD); for (DWORD i = 0; i < num_of_processes; i++){ phandle = ::OpenProcess(PROCESS_ALL_ACCESS, false, pids[i]); if (!phandle){ wsprintf(buffer, "%.04X - process can't be opened", pids[i]); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); continue; } if (!EnumProcessModules(phandle, modules, 4096 * sizeof(HMODULE), &needed)){ ::CloseHandle(phandle); wsprintfA(buffer, "%.04X - can't obtain name", pids[i]); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); continue; } if (!::GetModuleFileNameExA(phandle, modules[0], proc_name, 4096)){ ::CloseHandle(phandle); wsprintfA(buffer, "%.04X - can't obtain name", pids[i]); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); continue; } wsprintfA(buffer, "%.04X - %s", pids[i], proc_name); SendMessageA(GlobalList, LB_ADDSTRING, 0, (LPARAM)buffer); ::CloseHandle(phandle); } return 1; } default: return 0; } return 0; }
int main(int argc, char *argv[]) { #else int gstat_main(int argc, char *argv[]) { #endif DATA **data = NULL, *valdata = NULL; /* * initialise some global variables: */ atexit(close_gstat_log_file); init_userio(1); init_global_variables(); argv0 = argv[0]; /* * register command line arguments on command_line: */ command_line = store_argv(argc, argv); parse_gstatrc(); /* * INPUT: command line options; */ parse_options(argc, argv); /* exits on -e options */ /* * start with program heading: */ printlog("%s: %s version %s\n", GSTAT_NAME, GSTAT_OS, VERSION); printlog("%s\n", GSTAT_CR); gstat_start(); /* * INPUT: Parse command files: */ if (optind == argc) { /* there's no command file name left */ if (get_method() != UIF) { /* -i or -m command line option */ /* no arguments */ printlog("Updates, manuals and source code: %s\n", GSTAT_HOME); printlog("%s\n", USAGE); ErrMsg(ER_NOCMD, ""); } else { start_ui(); exit(0); } } else { /* we have a command file to be read */ for ( ; optind < argc; optind++) { command_file_name = argv[optind]; parse_file(command_file_name); if (logfile_name != NULL) set_gstat_log_file(efopen(logfile_name, "w")); /* * get global variables locally: */ data = get_gstat_data(); valdata = get_dataval(); set_seed(gl_seed); /* * check variable settings and next * INPUT: read data values from file: */ read_all_data(data, valdata, get_n_vars()); if (get_method() == NSP) /* Still no answer to this: choose default */ set_method(get_default_method()); set_mode(); check_global_variables(); setup_meschach_error_handler(); if (DEBUG_DUMP) dump_all(); if (get_method() != NSP) printlog("[%s]\n", method_string(get_method())); if (check_only) set_method(NSP); /* * start calculations && OUTPUT routines: */ switch (get_method()) { case UIF: start_ui(); break; case NSP: break; case COV: case SEM: do_variogram(get_n_vars(), get_method()); break; case POLY: setup_poly_method(); /*FALLTHROUGH*/ default: if (gl_xvalid) /* validation/cross validation */ cross_valid(data); else predict_all(data); /* or prediction: */ break; } /* switch get_method() */ remove_all(); /* free all data etc. */ init_global_variables(); /* re-init for next round */ } } if (DEBUG_DUMP) atexit(print_file_record); if (get_method() != UIF) elapsed(); /* * file closing & data freeing time: */ if (plotfile != NULL) efclose(plotfile); exit(0); } /* end of main() */