SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_leg) { switch_channel_t *other_channel = NULL; init_vars(); if (a_leg && a_leg->session) { other_channel = switch_core_session_get_channel(a_leg->session); } if (!strchr(nuuid, '/') && (session = switch_core_session_force_locate(nuuid))) { uuid = strdup(nuuid); channel = switch_core_session_get_channel(session); allocated = 1; } else { cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS) { channel = switch_core_session_get_channel(session); allocated = 1; switch_set_flag(this, S_HUP); uuid = strdup(switch_core_session_get_uuid(session)); switch_channel_set_state(switch_core_session_get_channel(session), CS_SOFT_EXECUTE); switch_channel_wait_for_state(channel, other_channel, CS_SOFT_EXECUTE); } } }
int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *darea; init_vars(); gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); darea = gtk_drawing_area_new(); gtk_container_add(GTK_CONTAINER(window), darea); g_signal_connect(G_OBJECT(darea), "draw", G_CALLBACK(on_draw_event), NULL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), 325, 250); gtk_window_set_title(GTK_WINDOW(window), "Spectrum"); g_timeout_add(400, (GSourceFunc) time_handler, (gpointer) window); gtk_widget_show_all(window); gtk_main(); cairo_surface_destroy(glob.image); cairo_surface_destroy(glob.surface); return 0; }
int main(int argc, char **argv) { // // variables // struct fab_vars v; init_vars(&v); // // command line args // if (argc != 3) { printf("command line: array_states_png.c in.array out.png\n"); exit(-1); } // // read array // fab_read_array(&v,argv[1]); // // shade states // fab_shade_states(&v); // // write PNG // fab_write_png(&v,argv[2]); }
// set up default entries and initialise variables void corn_init() { // set "constants" INBUF_START = (address)(memory_start + sizeof(struct sys_const) + sizeof(struct sys_var)); INBUF_END = INBUF_START + INBUF_BYTES; DSTACK_START = INBUF_END; DSTACK_END = DSTACK_START + DSTACK_WORDS * WORDSIZE; RSTACK_START = DSTACK_END; RSTACK_END = RSTACK_START + RSTACK_WORDS * WORDSIZE; SCRATCH_START = RSTACK_END; SCRATCH_END = SCRATCH_START + SCRATCH_BYTES; POOL_START = SCRATCH_END; POOL_END = POOL_START + POOL_BYTES; // set "variables" HEAP_NEXT = POOL_START; POOL_HEAD = 0; DICT_HEAD = 0; // Add dummy entry to heap padd(INBUF_START,0); reset_working_data(); init_vars(); init_prims(); init_defs(); reset_working_data(); }
long my_ferry_start() { //Handle if ferry gets a start request after already starting if(ferry_active == 1) { printk("%s: Ferry has already been started\n", __FUNCTION__); return 1; } printk("%s: Ferry started!\n", __FUNCTION__); //Initialize mutex mutex_init(&lock); //Initialize all variables init_vars(); //Initialize proc entry proc_entry = create_proc_entry(PROC_NAME, 0444, NULL); //begin ferry thread ferry_thread = kthread_run(begin_ferry, NULL, "ferry_thread"); return 0; }
int main (int argc, char ** argv) { int err; MPI_Init (&argc, &argv); MPI_Comm_rank (comm, &rank); MPI_Comm_size (comm, &size); init_vars(); adios_init_noxml (comm); err = adios_read_init_method(ADIOS_READ_METHOD_BP, comm, "verbose=2"); if (err) { printE ("%s\n", adios_errmsg()); } if (!err) err = declare_group (); if (!err) err = write_file ("reuse_dim.bp"); if (!err) err = read_file ("reuse_dim.bp"); adios_finalize (rank); fini_vars(); MPI_Finalize (); return err; }
int main(int argc, char **argv) { // // variables // struct fab_vars v; init_vars(&v); int threshold; // // command line args // if (argc != 4) { printf("command line: array_slice in.array out.array threshold\n"); exit(-1); } // // read lattice // fab_read_array(&v,argv[1]); // // threshold // sscanf(argv[3],"%d",&threshold); fab_threshold(&v,threshold); // // write state slice // fab_write_array(&v,argv[2]); }
void my_sort_list(t_list **begin, int (*cmp)(), int w) { t_list *prev; t_list *next; t_list *curr; t_list *first; int c; c = my_list_size(*begin); while (c != 0) { init_vars(&curr, begin , &prev); while (curr->next != NULL) { next = curr->next; if (cmp((w == 0) ? curr->fword : curr->wword, (w == 0) ? next->fword : next->wword ) > 0) { curr->next = next->next; next->next = curr; save_back(&prev, &next); curr = next; } (prev == NULL) ? savFirst(&first, &curr, 1) : savFirst(&first, &curr, 0); prev = curr; curr = curr->next; } *begin = first; c--; } }
static int quickdnr(VideoFilter *f, VideoFrame *frame, int field) { (void)field; ThisFilter *tf = (ThisFilter *)f; int thr1[3], thr2[3], height[3]; uint8_t *avg[3], *buf[3]; int i, y; TF_VARS; TF_START; if (!init_avg(tf, frame)) return 0; init_vars(tf, frame, thr1, thr2, height, avg, buf); for (i = 0; i < 3; i++) { int sz = height[i] * frame->pitches[i]; for (y = 0; y < sz; y++) { if (abs(avg[i][y] - buf[i][y]) < thr1[i]) buf[i][y] = avg[i][y] = (avg[i][y] + buf[i][y]) >> 1; else avg[i][y] = buf[i][y]; } }
void show_tab(int *tab, int tab_size) { t_vars v; int nline; nline = 1; v.space = tab_size + 2; init_vars(&v); while (v.i < tab_size) { v.j = 0; my_put_nbr(nline++); my_putchar('.'); v.k = (nline > 10) ? 1 : 0; while (v.k++ < v.space) my_putchar(' '); while (v.j < tab[v.i]) { my_putchar('|'); v.j++; } my_putchar('\n'); v.i++; v.space--; } }
main(int argc, char **argv) { // // local vars // struct fab_vars v; init_vars(&v); // // command line args // if ((argc < 3) || (argc > 3)) { printf("command line: png_drl in.png out.drl\n"); printf(" in.png = input PNG file\n"); printf(" out.drl = output Excellon file\n"); exit(-1); } // // read PNG // fab_read_png(&v,argv[1]); // // copy image to array // fab_png_array(&v); // // write array to Excellon // fab_write_drl(&v,argv[2]); // // exit // exit(0); }
int main(int argc, char *argv[]) { CATCHALL(die); setlocale(LC_ALL, ""); initscr(); /* * We use COLOR_GREEN because COLOR_BLACK is wired to the wrong thing. */ start_color(); init_pair(RED_ON_WHITE, COLOR_RED, COLOR_WHITE); init_pair(BLUE_ON_WHITE, COLOR_BLUE, COLOR_WHITE); init_pair(BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE); #ifndef COLOR_PAIR letters[0] = OR_COLORS('h', RED_ON_WHITE); /* hearts */ letters[1] = OR_COLORS('s', BLACK_ON_WHITE); /* spades */ letters[2] = OR_COLORS('d', RED_ON_WHITE); /* diamonds */ letters[3] = OR_COLORS('c', BLACK_ON_WHITE); /* clubs */ #if USE_CP437 glyphs[0] = PC_COLORS('\003', RED_ON_WHITE); /* hearts */ glyphs[1] = PC_COLORS('\006', BLACK_ON_WHITE); /* spades */ glyphs[2] = PC_COLORS('\004', RED_ON_WHITE); /* diamonds */ glyphs[3] = PC_COLORS('\005', BLACK_ON_WHITE); /* clubs */ #endif #endif #if USE_CP437 if (tigetstr("smpch")) suits = glyphs; #endif /* USE_CP437 */ cbreak(); if (argc == 2) srand((unsigned) atoi(argv[1])); else srand((unsigned) time((time_t *) 0)); init_vars(); do { deal_number++; shuffle(deck_size); deal_cards(); display_cards(deal_number); play_game(); } while ((deck_size = collect_discards()) != 0); game_finished(deal_number); die(SIGINT); /*NOTREACHED */ }
const char* request_get_url_path() { if (!path) init_vars(); return path; }
const char* request_get_path_variable(const char* key) { if (!varTable) init_vars(); return g_hash_table_lookup(varTable, key); }
int main(int argc, char *argv[]) { (void) signal(SIGINT, die); initscr(); /* * We use COLOR_GREEN because COLOR_BLACK is wired to the wrong thing. */ start_color(); init_pair(RED_ON_WHITE, COLOR_RED, COLOR_WHITE); init_pair(BLUE_ON_WHITE, COLOR_BLUE, COLOR_WHITE); init_pair(BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE); #ifndef COLOR_PAIR letters[0] = 'h' | COLOR_PAIR(RED_ON_WHITE); /* hearts */ letters[1] = 's' | COLOR_PAIR(BLACK_ON_WHITE); /* spades */ letters[2] = 'd' | COLOR_PAIR(RED_ON_WHITE); /* diamonds */ letters[3] = 'c' | COLOR_PAIR(BLACK_ON_WHITE); /* clubs */ #if defined(__i386__) && defined(A_ALTCHARSET) glyphs[0] = '\003' | A_ALTCHARSET | COLOR_PAIR(RED_ON_WHITE); /* hearts */ glyphs[1] = '\006' | A_ALTCHARSET | COLOR_PAIR(BLACK_ON_WHITE); /* spades */ glyphs[2] = '\004' | A_ALTCHARSET | COLOR_PAIR(RED_ON_WHITE); /* diamonds */ glyphs[3] = '\005' | A_ALTCHARSET | COLOR_PAIR(BLACK_ON_WHITE); /* clubs */ #endif #endif #if defined(__i386__) && defined(A_ALTCHARSET) if (tigetstr("smpch")) suits = glyphs; #endif /* __i386__ && A_ALTCHARSET */ cbreak(); if (argc == 2) srand((unsigned)atoi(argv[1])); else srand((unsigned)time((time_t *)0)); init_vars(); do{ deal_number++; shuffle(deck_size); deal_cards(); display_cards(deal_number); play_game(); } while ((deck_size=collect_discards()) != 0); game_finished(deal_number); die(SIGINT); /*NOTREACHED*/ }
void run_ecc_tests() { int i = 0; init_vars(); while(ecc_functions[i] != NULL) { (*ecc_functions[i])(); printf("OK\n"); i++; numTests++; } }
uni::uni(int i_size) { init_vars(); //init unicode member if (i_size > 0) { //LogMsg("Created string of %d bytes.",i_size); this->us_data = (unsigned short*) malloc(2*i_size); memset(us_data,0,2*i_size); } }
SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(switch_core_session_t *new_session) { init_vars(); if (new_session) { session = new_session; channel = switch_core_session_get_channel(session); allocated = 1; switch_core_session_read_lock_hangup(session); uuid = strdup(switch_core_session_get_uuid(session)); } }
void camera_init(int *fd, camera_buffer *camera_buffers, int camera_count){ int i; const char *dev_names[MAX_DEV_COUNT]={"/dev/video0","/dev/video4","/dev/video2","/dev/video3"}; if(camera_count>MAX_DEV_COUNT){ fprintf(stderr,"error: camera_count must equal or less than %d\n",MAX_DEV_COUNT); exit(EXIT_FAILURE); } init_vars(fd,camera_buffers,camera_count); for (i=0;i<camera_count;i++){ open_device(&fd[i],dev_names[i]); init_device(fd[i],&camera_buffers[i],dev_names[i]); start_capturing(fd[i],&camera_buffers[i]); } }
int main(int argc, char *argv[], char *envp[]) { (void) envp; // TODO bring in good malloc/free and implement sbrk()! //static char arena[1024*1024]; //init_malloc( arena, sizeof(arena) ); printf("Phantom Simple Unix Box Shell is running, pid %d\n", getpid()); #if 0 printf("ac = %d\n", argc ); char **avp = argv; while( *avp ) { printf("arg = %p\n", *avp ); printf("arg = '%s'\n", *avp++ ); } #endif init_vars(); init_statements(); init_arguments(argc,argv); if(af_script_file_name != NULL) { run_script(af_script_file_name); if(af_exit_after_script) exit(0); } setvbuf( stdin, 0, _IONBF, 0 ); //setvbuf( stdout, 0, _IONBF, 0 ); char buf[1024]; for(;;) { printf("> "); getline(buf, sizeof(buf)); if(strlen(buf) > 0) { parse_string(buf); } buf[0] = '\0'; } return 0; }
uni::uni(const char st_source[]) { init_vars(); //convert source to unicode set(st_source); //let's also store a copy in our own st_data for no good reason if (st_source) { st_data = (CHAR*) malloc(strlen(st_source)+1); strcpy(st_data, st_source); } }
main(int argc, char **argv) { // // local vars // struct fab_vars v; init_vars(&v); float xmin,ymin,force,velocity; // // command line args // if (!((argc == 3) || (argc == 4) || (argc == 5) || (argc == 7))) { printf("command line: path_camm in.path out.camm [force [velocity [xmin ymin]]]\n"); printf(" in.path = input path file\n"); printf(" out.camm = output Roland vinylcutter file\n"); printf(" force = cutting force (optional, grams, default 45)\n"); printf(" velocity = cutting speed (optional, cm/s, default 2)\n"); printf(" xmin = left position (optional, mm, default path value)\n"); printf(" ymin = bottom position (optional, mm, default path value)\n"); exit(-1); } if (argc == 3) { force = 45; velocity = 2; } else if (argc == 4) { sscanf(argv[3],"%f",&force); velocity = 2; } else if (argc == 5) { sscanf(argv[3],"%f",&force); sscanf(argv[4],"%f",&velocity); } // // read path // fab_read_path(&v,argv[1]); // // origin // if (argc == 7) { sscanf(argv[5],"%lf",&v.xmin); sscanf(argv[6],"%lf",&v.ymin); } // // write .epi // fab_write_camm(&v,argv[2],force,velocity); }
// 08111368 void flashback_2() { prev_quest_mode = 1; init_vars(); bag_809A2DC(); sub_809A2A4(); if (questlog_active_at_cursor()) { sub_8111274(flashback_cursor, 0); hm_phase_1 = &hmp1_8111038; set_callback2(&c2_080572A8); } else { sub_8111274(flashback_cursor, 1); warp_in_metadata(); hm_phase_1 = &hmp1_8111000; set_callback2(&c2_0805726C); } }
int main(int argc, char **argv) { // // local vars // struct fab_vars v; init_vars(&v); float units,resolution; // // command line args // if (!((argc == 3) || (argc == 4) || (argc == 5))) { printf("command line: stl_path in.stl out.path [units [resolution]]]\n"); printf(" in.stl = input binary STL file\n"); printf(" out.png = output PNG file\n"); printf(" units = file units (optional, mm/unit, default 1)\n"); printf(" resolution = image resolution (optional, pixels/mm, default 10)\n"); exit(-1); } if (argc == 3) { units = 1; resolution = 10; } else if (argc == 4) { sscanf(argv[3],"%f",&units); resolution = 10; } else if (argc == 5) { sscanf(argv[3],"%f",&units); sscanf(argv[4],"%f",&resolution); } // // read .stl // fab_read_stl(&v,argv[1]); // // convert mesh to path // fab_mesh_path(&v,units,resolution); // // write .path // fab_write_path(&v,argv[2]); // // return // return(0); }
int main(int argc, char **argv) #endif { #ifdef MEMORY_DEBUG elm_init(); #endif //MEMORY_DEBUG gargc=argc; gargv=argv; // do basic initialization #ifdef OLC olc_init(); #endif //OLC init_logging("log"); check_log_level_on_command_line(); create_tcp_out_mutex(); init_translatables(); #ifdef FSAA init_fsaa_modes(); #endif /* FSAA */ init_vars(); ENTER_DEBUG_MARK("init stuff"); init_stuff(); LEAVE_DEBUG_MARK("init stuff"); start_rendering(); #ifdef MEMORY_DEBUG elm_cleanup(); #endif //MEMORY_DEBUG #ifdef OLC olc_shutdown(); #endif //OLC #ifndef WINDOWS // attempt to restart if requested if(restart_required > 0){ LOG_INFO("Restarting %s\n", *argv); execv(*argv, argv); } #endif //WINDOWS return 0; }
int main(int argc, char *argv[]) { GSList *words, *letters, *constraints, *ll; GPtrArray *dictionary; gchar *grid; struct wordvar *w; if (argc != 3) { printf("usage: %s grid dictionary\n", argv[0]); exit (-1); } words = letters = constraints = NULL; grid = read_grid(argv[1], &words, &letters, &constraints); dictionary = read_words(argv[2]); init_vars(words, letters, dictionary); printf("%s\n", grid); w = words->data; printf("Initial %d\n", w->possible_values->len); for (ll = constraints; ll != NULL; ll = ll->next) { struct constraint *c = ll->data; put_constraint_on_queue(c); } run_constraints(); printf("First %d\n", w->possible_values->len); for (ll = constraints; ll != NULL; ll = ll->next) { struct constraint *c = ll->data; put_constraint_on_queue(c); } total = 0; find_solution(words, letters, grid, 0); printf("total %d\n", total); return (0); }
/*!***************************************************************************** ******************************************************************************* \note go_cart_target_wait \date \remarks go to the given cartesian target ******************************************************************************* Function Parameters: [in]=input,[out]=output \param[in] ctar : cartesian states \param[in] stat : 1/0 for active target or not \param[in] mt : movement time ******************************************************************************/ int go_cart_target_wait(SL_Cstate *ctar,int *stat, double mt) { int i,j; double last_time; double last_draw_time; double aux; special_flag = TRUE; /* initialize some variables */ init_vars(); /* assign the target variables */ for (i=1; i<=n_endeffs; ++i) { for (j= _X_; j<= _Z_; ++j) { cstatus[(i-1)*6+j] = stat[(i-1)*6+j]; aux = ctar[i].x[j]; ctarget[i].x[j] = aux; } } /* the movement time */ tau = mt; if (!setTaskByName("Goto Cart Task")) { special_flag = FALSE; return FALSE; } last_time = last_draw_time = task_servo_time; while (strcmp(current_task_name,NO_TASK) != 0) { if (task_servo_time - last_time > 2*mt) { printf("time out in go_cart_target_wait\n"); special_flag = FALSE; return FALSE; } taskDelay(ns2ticks(10000000)); // wait 10ms } return TRUE; }
t_env *init_glfw_env(void) { t_env *e; if (!(e = (t_env*)malloc(sizeof(t_env)))) return (NULL); init_vars(e); glfwSetErrorCallback(error_callback); if (!glfwInit()) return (NULL); e->window = glfwCreateWindow(640, 480, "Arkanoid", NULL, NULL); if (!e->window) { glfwTerminate(); return (NULL); } glfwMakeContextCurrent(e->window); return (e); }
int main(int argc, char *argv[]) { (void) signal(SIGINT, die); initscr(); /* * We use COLOR_GREEN because COLOR_BLACK is wired to the wrong thing. */ start_color(); init_pair(COLOR_RED, COLOR_RED, COLOR_WHITE); init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_WHITE); init_pair(COLOR_GREEN, COLOR_BLACK, COLOR_WHITE); #if defined(__i386__) && defined(A_ALTCHARSET) if (tigetstr("smpch")) suits = glyphs; #endif /* __i386__ && A_ALTCHARSET */ cbreak(); if (argc == 2) srand((unsigned)atoi(argv[1])); else srand((unsigned)time((time_t *)0)); init_vars(); do{ deal_number++; shuffle(deck_size); deal_cards(); display_cards(deal_number); play_game(); } while ((deck_size=collect_discards()) != 0); game_finished(deal_number); die(SIGINT); /*NOTREACHED*/ return 1; }
int redir_left(t_vars *v) { t_vars *redir; t_redir *r_l; int exe; r_l = my_xmalloc(sizeof(*r_l)); redir = my_xmalloc(sizeof(*redir)); init_vars(redir); init_redir_simp(v, r_l, '<'); if (!check_nb(r_l) || !check_redir_left(redir, r_l)) { redir = free_t_vars(redir); r_l = free_redirs_vars(r_l); return (EXIT_FAILURE); } exe = do_r_l(redir, r_l); redir = free_t_vars(redir); r_l = free_redirs_vars(r_l); return (exe); }