int main(int argc, char *argv[]) { int sz; extern void calculate_rc(void); calculate_rc(); printf("tot = %d\n", tot); if (argc > 1) sz = atoi(argv[1]); else sz = 200; glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE); glutInitWindowPosition(200, 0); glutInitWindowSize(sz, sz); glutCreateWindow("Roller coaster"); glNewList(1, GL_COMPILE); do_display(); glEndList(); glutDisplayFunc(display); glutKeyboardFunc(parsekey); glutSpecialFunc(parsekey_special); glutReshapeFunc(myReshape); glutIdleFunc(Animate); myinit(); glutSwapBuffers(); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ }
ENTRYPOINT void init_bubble3d(ModeInfo * mi) { Display *display = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); int screen = MI_SCREEN(mi); struct context *c; if (contexts == 0) { contexts = (struct context *) calloc(sizeof (struct context), MI_NUM_SCREENS(mi)); if (contexts == 0) return; } c = &contexts[screen]; c->glx_context = init_GL(mi); init_colors(mi); if (c->glx_context != 0) { init(c); reshape_bubble3d(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); do_display(c); glFinish(); glXSwapBuffers(display, window); } else MI_CLEARWINDOW(mi); }
// Key handling function static void handle_key(char c) { switch (c) { case 'i': bucket_width /= 2; break; case 'o': bucket_width *= 2; break; case 'a': bucket_width = 0; break; case '+': refresh_rate *= 2; break; case '-': refresh_rate = MAX(refresh_rate/2, 1000); break; case '?': case 'h': case 'H': display_help ^= 1; break; case 'q': if (display_help) { display_help = false; } else { term_fini(); _exit(0); } break; case '\n': if (display_help) { display_help = false; } break; } if (display_help) do_display_help(); else do_display(&last_display); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SetCamera(); switch(GetStyle()) { case FTGL_BITMAP: case FTGL_PIXMAP: glRasterPos2i((long)(w_win / 2 + OX), (long)(h_win / 2 + OY)); glTranslatef(w_win / 2 + OX, h_win / 2 + OY, 0.0); break; case FTGL_OUTLINE: case FTGL_POLYGON: case FTGL_EXTRUDE: case FTGL_TEXTURE: glTranslatef(OX, OY, 0); tbMatrix(); break; } glPushMatrix(); do_display(); glPopMatrix(); glutSwapBuffers(); }
void do_controller_buffer_code(int idx, const char *postfix, int buf_len, int rows) { int display_idx; char s[1024]; sprintf(s, "u8g2_m_%s_%d_%s", strlowercase(controller_list[idx].name), controller_list[idx].tile_width, postfix); if ( str_exists(s) == 0 ) { str_add(s); //FILE *fp = stdout; fprintf(buf_code_fp, "uint8_t *%s(uint8_t *page_cnt)\n", s); fprintf(buf_code_fp, "{\n"); fprintf(buf_code_fp, " static uint8_t buf[%d];\n", buf_len); fprintf(buf_code_fp, " *page_cnt = %d;\n", rows); fprintf(buf_code_fp, " return buf;\n"); fprintf(buf_code_fp, "}\n"); fprintf(buf_header_fp, "uint8_t *%s(uint8_t *page_cnt);\n", s); } display_idx = 0; fprintf(setup_code_fp, "/* %s %s */\n", controller_list[idx].name, postfix); while( controller_list[idx].display_list[display_idx].name != NULL ) { do_display(idx, display_idx, postfix); display_idx++; } }
ENTRYPOINT void draw_bubble3d(ModeInfo * mi) { struct context *c = &contexts[MI_SCREEN(mi)]; Display *display = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); MI_IS_DRAWN(mi) = True; if (!c->glx_context) return; glXMakeCurrent(display, window, *(c->glx_context)); glb_config.polygon_count = 0; glPushMatrix(); glRotatef(current_device_rotation(), 0, 0, 1); do_display(c); glPopMatrix(); mi->polygon_count = glb_config.polygon_count; if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(display, window); }
static void try_display(struct timeval const *now) { if (timeval_is_set(&last_display) && timeval_sub(now, &last_display) < refresh_rate) return; last_display = *now; do_display(now); dup_reset(); }
void display(void) { #ifdef STEREO /* select both left and right back buffers to be cleared in stereo mode */ glDrawBuffer(GL_BACK); #endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); do_display(); }
int main(int argc, char ** argv) { /**** In Defaults.h ****/ struct global_t global; struct const_t constant; struct stats_t stats; struct display_t dpy; /***********************/ /***************** In Initialize.h *****************/ init(&global, &constant, &stats, &dpy, &argc, &argv); /***************************************************/ // Each process starts a loop to run the simulation // for the specified number of days for(global.current_day = 0; global.current_day <= constant.total_number_of_days; global.current_day++) { /****** In Infection.h ******/ find_infected(&global); /****************************/ /**************** In Display.h *****************/ #if defined(X_DISPLAY) || defined(TEXT_DISPLAY) do_display(&global, &constant, &dpy); throttle(&constant); #endif /***********************************************/ /************** In Core.h *************/ move(&global, &constant); susceptible(&global, &constant, &stats); infected(&global, &constant, &stats); update_days_infected(&global, &constant); /**************************************/ } /******** In Finialize.h ********/ show_results(&global, &stats); cleanup(&global, &constant, &dpy); /********************************/ exit(EXIT_SUCCESS); }
int main(int argc, char *argv[]) { if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) help(); f = open("/dev/rtnet", O_RDWR); if (f < 0) { perror("/dev/rtnet"); exit(1); } if (argc == 1) do_display(PRINT_FLAG_ALL); if (strcmp(argv[1], "-a") == 0) { if (argc == 3) { strncpy(cmd.head.if_name, argv[2], IFNAMSIZ); do_display(PRINT_FLAG_INACTIVE); } else do_display(PRINT_FLAG_INACTIVE | PRINT_FLAG_ALL); } else strncpy(cmd.head.if_name, argv[1], IFNAMSIZ); if (argc < 3) do_display(0); if (strcmp(argv[2], "up") == 0) do_up(argc,argv); if (strcmp(argv[2], "down") == 0) do_down(argc,argv); help(); return 0; }
void chat_command_handler::do_ignore() { if (get_arg(1).empty()) { do_display(); } else { utils::string_map symbols; symbols["nick"] = get_arg(1); if (preferences::add_acquaintance(get_arg(1), "ignore", get_data(2))) { print(_("ignores list"), VGETTEXT("Added to ignore list: $nick", symbols)); chat_handler_.user_relation_changed(get_arg(1)); } else { command_failed(VGETTEXT("Invalid username: $nick", symbols)); } } }
/* Fm-Index Search MAIN */ int main(int argc, char *argv[]) { char * program_name = argv[0]; char * filename, * extfilename = NULL; void *index; uchar * pattern; ulong nchars, position = 0; int unbuild, count, locate, extract, display, error; nchars = 10; count = locate = extract = unbuild = display = 0; int next_option; const char* short_options = "hlce:s:d:n:"; const struct option long_options[] = { {"help" , 0, NULL, 'h'}, {"locate", 0, NULL, 'l'}, {"count", 0, NULL, 'c'}, {"extract", 1, NULL, 'e'}, {"display", 1, NULL, 's'}, {"unbuild", 1, NULL, 'd'}, {"numchars", 1, NULL, 'n'}, {NULL, 0, NULL, 0} }; if(argc<3) print_usage(program_name); do { next_option = getopt_long(argc, argv, short_options, long_options, NULL); switch (next_option) { case 'l': /* report position */ locate = 1; break; case 's': /* display len chars sourronding each occ */ display = 1; nchars = (ulong) atol(optarg); break; case 'd': /* unbuild */ unbuild = 1; extfilename = (char *) optarg; break; case 'e': /* extract */ extract = 1; position = (ulong) atol(optarg); break; case 'c': /* count */ count = 1; break; case 'n': /* numchars for extract function */ extract = 1; nchars = (ulong) atol(optarg); break; case '?': /* The user specified an invalid option. */ fprintf(stderr,"Unknown option.\n"); print_usage(program_name); break; case -1: /* Done with options. */ break; default: print_usage(program_name); } } while (next_option != -1); if (optind == argc) { fprintf(stderr,"You must supply a pattern and a .fmi filename\n\n"); print_usage(program_name); exit(1); } /* priorita' extract display locate count */ if(!(extract || unbuild)) /* pattern */ pattern = (uchar *) argv[optind++]; else pattern = NULL; if (optind == argc) { fprintf(stderr,"You must supply a pattern and a .fmi filename\n\n"); print_usage(program_name); exit(1); } filename = argv[optind]; error = load_index (filename, &index); IFERROR (error); if (unbuild==1) do_unbuild(index, extfilename); if (extract==1) do_extract(index, position, nchars); if (display==1) do_display(index, pattern, nchars); if (locate==1) do_locate(index, pattern); do_count(index, pattern); exit(0); }
Screen &display(std::ostream &os) { do_display(os); return *this; }
int main(int argc, char *argv[]) { char *env_top; char **preset_argv; int preset_argc = 0; void *mask; int need_mini = 1; struct statics statics; globalstate *gstate; /* get our name */ if (argc > 0) { if ((myname = strrchr(argv[0], '/')) == 0) { myname = argv[0]; } else { myname++; } } /* binary compatibility check */ #ifdef HAVE_UNAME { struct utsname uts; if (uname(&uts) == 0) { if (strcmp(uts.machine, UNAME_HARDWARE) != 0) { fprintf(stderr, "%s: incompatible hardware platform\n", myname); exit(EX_UNAVAILABLE); } } } #endif /* initialization */ gstate = (globalstate *)calloc(1, sizeof(globalstate)); gstate->statics = &statics; time_mark(NULL); /* preset defaults for various options */ gstate->show_usernames = Yes; gstate->topn = DEFAULT_TOPN; gstate->delay = DEFAULT_DELAY; gstate->fulldraw = Yes; gstate->use_color = Yes; gstate->interactive = Maybe; /* preset defaults for process selection */ gstate->pselect.idle = Yes; gstate->pselect.system = No; gstate->pselect.fullcmd = No; gstate->pselect.command = NULL; gstate->pselect.uid = -1; gstate->pselect.mode = 0; /* use a large buffer for stdout */ #ifdef HAVE_SETVBUF setvbuf(stdout, stdoutbuf, _IOFBF, BUFFERSIZE); #else #ifdef HAVE_SETBUFFER setbuffer(stdout, stdoutbuf, BUFFERSIZE); #endif #endif /* get preset options from the environment */ if ((env_top = getenv("TOP")) != NULL) { preset_argv = argparse(env_top, &preset_argc); preset_argv[0] = myname; do_arguments(gstate, preset_argc, preset_argv); } /* process arguments */ do_arguments(gstate, argc, argv); #ifdef ENABLE_COLOR /* If colour has been turned on read in the settings. */ env_top = getenv("TOPCOLOURS"); if (!env_top) { env_top = getenv("TOPCOLORS"); } /* must do something about error messages */ color_env_parse(env_top); color_activate(gstate->use_color); #endif /* in order to support forward compatability, we have to ensure that the entire statics structure is set to a known value before we call machine_init. This way fields that a module does not know about will retain their default values */ memzero((void *)&statics, sizeof(statics)); statics.boottime = -1; /* call the platform-specific init */ if (machine_init(&statics) == -1) { exit(EX_SOFTWARE); } /* create a helper list of sort order names */ gstate->order_namelist = string_list(statics.order_names); /* look up chosen sorting order */ if (gstate->order_name != NULL) { int i; if (statics.order_names == NULL) { message_error(" This platform does not support arbitrary ordering"); } else if ((i = string_index(gstate->order_name, statics.order_names)) == -1) { message_error(" Sort order `%s' not recognized", gstate->order_name); message_error(" Recognized sort orders: %s", gstate->order_namelist); } else { gstate->order_index = i; } } /* initialize extensions */ init_username(); /* initialize termcap */ gstate->smart_terminal = screen_readtermcap(gstate->interactive); /* determine interactive state */ if (gstate->interactive == Maybe) { gstate->interactive = smart_terminal; } /* if displays were not specified, choose an appropriate default */ if (gstate->displays == 0) { gstate->displays = gstate->smart_terminal ? Infinity: 1; } /* we don't need a mini display when delay is less than 2 seconds or when we are not on a smart terminal */ if (gstate->delay <= 1 || !smart_terminal) { need_mini = 0; } /* set constants for username/uid display */ if (gstate->show_usernames) { gstate->header_text = format_header("USERNAME"); gstate->get_userid = username; } else { gstate->header_text = format_header(" UID "); gstate->get_userid = itoa7; } gstate->pselect.usernames = gstate->show_usernames; /* initialize display */ if ((gstate->max_topn = display_init(&statics)) == -1) { fprintf(stderr, "%s: can't allocate sufficient memory\n", myname); exit(EX_OSERR); } /* check for infinity and for overflowed screen */ if (gstate->topn == Infinity) { gstate->topn = INT_MAX; } else if (gstate->topn > gstate->max_topn) { #if 0 message_error(" This terminal can only display %d processes", gstate->max_topn); #endif } #ifdef ENABLE_COLOR /* producing a list of color tags is easy */ if (gstate->show_tags) { color_dump(stdout); exit(EX_OK); } #endif /* hold all signals while we initialize the screen */ mask = hold_signals(); screen_init(); /* set the signal handlers */ set_signals(); /* longjmp re-entry point */ /* set the jump buffer for long jumps out of signal handlers */ if (setjmp(jmp_int) != 0) { /* this is where we end up after processing sigwinch or sigtstp */ /* tell display to resize its buffers, and get the new length */ if ((gstate->max_topn = display_resize()) == -1) { /* thats bad */ quit(EX_OSERR); /*NOTREACHED*/ } /* set up for a full redraw, and get the current line count */ gstate->fulldraw = Yes; /* safe to release the signals now */ release_signals(mask); } else { /* release the signals */ release_signals(mask); /* some systems require a warmup */ /* always do a warmup for batch mode */ if (gstate->interactive == 0 || statics.flags.warmup) { struct system_info system_info; struct timeval timeout; time_mark(&(gstate->now)); get_system_info(&system_info); (void)get_process_info(&system_info, &gstate->pselect, 0); timeout.tv_sec = 1; timeout.tv_usec = 0; select(0, NULL, NULL, NULL, &timeout); /* if we've warmed up, then we can show good states too */ gstate->show_cpustates = Yes; need_mini = 0; } } /* main loop */ while ((gstate->displays == -1) || (--gstate->displays > 0)) { do_display(gstate); if (gstate->interactive) { if (need_mini) { do_minidisplay(gstate); need_mini = 0; } do_command(gstate); } else { do_wait(gstate); } } /* do one last display */ do_display(gstate); quit(EX_OK); /* NOTREACHED */ return 1; /* Keep compiler quiet. */ }
void View::display() { do_display(); }
inline const Screen &Screen::display(std::ostream &os) const { do_display(os); return *this; }
inline Screen &Screen::display(std::ostream &os) { do_display(os); return *this; }
Screen &Screen::display(std::ostream &out) { do_display(out); return *this; }