const std::string WiredTigerEngine::Stats() { std::string info; int major_v, minor_v, patch; (void) wiredtiger_version(&major_v, &minor_v, &patch); info.append("WiredTiger version:").append(stringfromll(major_v)).append(".").append(stringfromll(minor_v)).append( ".").append(stringfromll(patch)).append("\r\n"); info.append("WiredTiger Init Options:").append(m_cfg.init_options).append("\r\n"); info.append("WiredTiger Table Init Options:").append(m_cfg.init_table_options).append("\r\n"); ContextHolder& holder = m_context.GetValue(); WT_SESSION* session = holder.session; if (NULL == session) { return info; } WT_CURSOR *cursor; int ret; /*! [statistics database function] */ if ((ret = session->open_cursor(session, "statistics:", NULL, NULL, &cursor)) == 0) { print_cursor(cursor, info); cursor->close(cursor); } if ((ret = session->open_cursor(session, "statistics:table:ardb", NULL, NULL, &cursor)) == 0) { print_cursor(cursor, info); cursor->close(cursor); } return info; }
void print_join_cursor_stats(WT_SESSION *session) { WT_CURSOR *idx_cursor, *join_cursor, *stat_cursor; error_check(session->create( session, "index:access:idx", "columns=(v)")); error_check(session->open_cursor( session, "index:access:idx", NULL, NULL, &idx_cursor)); error_check(idx_cursor->next(idx_cursor)); error_check(session->open_cursor( session, "join:table:access", NULL, NULL, &join_cursor)); error_check(session->join( session, join_cursor, idx_cursor, "compare=gt")); print_cursor(join_cursor); /*! [statistics join cursor function] */ error_check(session->open_cursor(session, "statistics:join", join_cursor, NULL, &stat_cursor)); print_cursor(stat_cursor); error_check(stat_cursor->close(stat_cursor)); /*! [statistics join cursor function] */ error_check(join_cursor->close(join_cursor)); error_check(idx_cursor->close(idx_cursor)); }
void deplace_term(int sigwinch) { if (ig_good_size(get_size_x(), get_size_y(), get_long_work(CS), CS->size)) { tputs(tgoto(tgetstr("cm", NULL), 0, 0), FD, tputs_putchar); tputs(tgetstr("cd", NULL), FD, tputs_putchar); print_length(CS, get_size_y()); print_cursor(KEYUP); print_cursor(KEYDOWN); } else small_size(); (void)sigwinch; }
void prompt_print(t_prompt *prompt, int show_cursor) { int i; size_t j; i = 0; reset_prompt(prompt); j = 3; while (prompt->cmd[i]) { tputs(tgetstr("me", NULL), 1, ft_putchar_int); if (i == prompt->i && show_cursor == 1) tputs(tgetstr("mr", NULL), 1, ft_putchar_int); if (prompt->copy_mode == 1 && i >= prompt->cursor_start && i <= prompt->cursor_end) tputs(tgetstr("mr", NULL), 1, ft_putchar_int); ft_putchar(prompt->cmd[i]); j++; if (j >= prompt->win_size) { ft_putendl(""); tputs(tgetstr("cr", NULL), 1, ft_putchar_int); j = 0; } i++; } print_cursor(prompt, show_cursor, i); }
int read_user(t_list *head) { char read_char[4] = {0}; while (42) { tputs(tgetstr("cl", NULL), 1, ft_putschar); so_printed(head); print_cursor(head); ft_strclr(read_char); read(0, read_char, 3); head = is_key(head, read_char); head = is_spc(head, read_char); if (read_char[0] == 10 && read_char[1] == 0) return (0); else if ((KEYDEL) || (KEYSUP)) { head->slc = -1; head = head->next; if (head->next == head && head->slc == -1) return (-1); } else if (read_char[0] == 27 && read_char[1] == 0) return (-1); } return (0); }
int main(int argc, char **argv) { if (argc < 3) usage(); struct ddb *db = open_discodb(argv[1]); if (!strcmp(argv[2], "-info")) print_info(db); else if (!strcmp(argv[2], "-keys")) print_cursor(db, ddb_keys(db)); else if (!strcmp(argv[2], "-values")) print_cursor(db, ddb_values(db)); else if (!strcmp(argv[2], "-uvalues")) print_cursor(db, ddb_unique_values(db)); else if (!strcmp(argv[2], "-item")){ if (argc < 4){ fprintf(stderr, "Specify query\n"); exit(1); } struct ddb_entry e; e.data = argv[3]; e.length = strlen(argv[3]); print_cursor(db, ddb_getitem(db, &e)); }else if (!strcmp(argv[2], "-cnf")){ if (argc < 4){ fprintf(stderr, "Specify query\n"); exit(1); } int num_q = 0; struct ddb_query_clause *q = parse_cnf(&argv[3], argc - 3, &num_q); print_cursor(db, ddb_query(db, q, num_q)); free(q[0].terms); free(q); }else usage(); ddb_free(db); return 0; }
void menu_main(void) { static uint8_t main_cursor = LINE0; // These are now static so as to remember the main menu position static uint8_t main_temp = 0; static uint8_t old_menu = 0; button = NONE; // Wait until user's finger is off button 1 Wait_BUTTON1(); while(button != BACK) { // Clear buffer before each update clear_buffer(buffer); // Print menu print_menu_frame(0); // Frame for (uint8_t i = 0; i < 4; i++) { LCD_Display_Text(main_top+i,(const unsigned char*)Verdana8,ITEMOFFSET,(uint8_t)pgm_read_byte(&lines[i])); // Lines } print_cursor(main_cursor); // Cursor write_buffer(buffer,1); // Poll buttons when idle poll_buttons(true); // Handle menu changes update_menu(MAINITEMS, MAINSTART, 0, button, &main_cursor, &main_top, &main_temp); // If main menu item has changed, reset sub-menu positions // and flag to sub-menus that positions need to be reset if (main_temp != old_menu) { cursor = LINE0; menu_temp = 0; old_menu = main_temp; menu_flag = 1; } // If ENTER pressed, jump to menu if (button == ENTER) { do_main_menu_item(main_temp); button = NONE; // Wait until user's finger is off button 1 Wait_BUTTON1(); } } }
void print_file_stats(WT_SESSION *session) { WT_CURSOR *cursor; /*! [statistics table function] */ error_check(session->open_cursor( session, "statistics:table:access", NULL, NULL, &cursor)); print_cursor(cursor); error_check(cursor->close(cursor)); /*! [statistics table function] */ }
int print_file_stats(WT_SESSION *session) { WT_CURSOR *cursor; int ret; /*! [statistics file function] */ if ((ret = session->open_cursor(session, "statistics:file:access.wt", NULL, NULL, &cursor)) != 0) return (ret); return (print_cursor(cursor)); /*! [statistics file function] */ }
int print_database_stats(WT_SESSION *session) { WT_CURSOR *cursor; int ret; /*! [statistics database function] */ if ((ret = session->open_cursor(session, "statistics:", NULL, NULL, &cursor)) != 0) return (ret); return (print_cursor(cursor)); /*! [statistics database function] */ }
int print_file_stats(WT_SESSION *session) { WT_CURSOR *cursor; int ret; /*! [statistics table function] */ if ((ret = session->open_cursor(session, "statistics:table:access", NULL, NULL, &cursor)) != 0) return (ret); ret = print_cursor(cursor); ret = cursor->close(cursor); /*! [statistics table function] */ return (ret); }
//********************************************************************** // Print menu items primary subroutine // // Usage: // top = position in submenu list // start = start of submenu text list. (top - start) gives the offset into the list. // values = pointer to array of values to change // multiplier = display/actual if type = 2, otherwise defaults to 1 // menu_ranges = pointer to array of min/max/inc/style/defaults // rangetype = unique (0) all values are different, copied (1) all values are the same // MenuOffsets = originally an array, now just a fixed horizontal offset for the value text // text_link = pointer to the text list for the values if not numeric // cursor = cursor position //********************************************************************** void print_menu_items(uint8_t top, uint8_t start, int8_t values[], uint8_t mult, prog_uchar* menu_ranges, uint8_t rangetype, uint8_t MenuOffsets, prog_uchar* text_link, uint8_t cursor) { menu_range_t range1; uint8_t multiplier; // Clear buffer before each update clear_buffer(buffer); print_menu_frame(0); // Print each line for (uint8_t i = 0; i < 4; i++) { LCD_Display_Text(top+i,(prog_uchar*)Verdana8,ITEMOFFSET,(uint8_t)pgm_read_byte(&lines[i])); // Handle unique or copied ranges (to reduce space) if (rangetype == 0) { // Use each unique entry memcpy_P(&range1, &menu_ranges[(top+i - start)* sizeof(range1)], sizeof(range1)); } else { // Use just the first entry in array for all memcpy_P(&range1, &menu_ranges[0], sizeof(range1)); } if (range1.style == 2) { multiplier = mult; } else { multiplier = 1; } print_menu_text((values[top+i - start] * multiplier), range1.style, (pgm_read_byte(&text_link[top+i - start]) + values[top+i - start]), MenuOffsets, (uint8_t)pgm_read_byte(&lines[i])); } print_cursor(cursor); // Cursor write_buffer(buffer,1); poll_buttons(true); }
void menu_main(void) { static uint8_t cursor = LINE0; // These are now static so as to remember the menu position static uint8_t top = MAINSTART; static uint8_t temp = 0; button = NONE; // Wait until user's finger is off button 1 while(BUTTON1 == 0) { _delay_ms(50); } while(button != BACK) { // Clear buffer before each update clear_buffer(buffer); // Print menu print_menu_frame(0); // Frame LCD_Display_Text(top,(prog_uchar*)Verdana8,ITEMOFFSET,LINE0); // First line LCD_Display_Text(top+1,(prog_uchar*)Verdana8,ITEMOFFSET,LINE1); // Second line LCD_Display_Text(top+2,(prog_uchar*)Verdana8,ITEMOFFSET,LINE2); // Third line LCD_Display_Text(top+3,(prog_uchar*)Verdana8,ITEMOFFSET,LINE3); // Fourth line print_cursor(cursor); // Cursor write_buffer(buffer,1); // Poll buttons when idle poll_buttons(); // Handle menu changes update_menu(MAINITEMS, MAINSTART, button, &cursor, &top, &temp); if (button == ENTER) { do_main_menu_item(temp); button = NONE; } } menu_beep(1); _delay_ms(200); }
static void _gdk_input_wintab_init_check (GdkDeviceManagerWin32 *device_manager) { static gboolean wintab_initialized = FALSE; GdkDeviceWintab *device; GdkWindowAttr wa; WORD specversion; HCTX *hctx; UINT ndevices, ncursors, ncsrtypes, firstcsr, hardware; BOOL active; DWORD physid; AXIS axis_x, axis_y, axis_npressure, axis_or[3]; int i, devix, cursorix, num_axes = 0; wchar_t devname[100], csrname[100]; gchar *devname_utf8, *csrname_utf8, *device_name; BOOL defcontext_done; HMODULE wintab32; char *wintab32_dll_path; char dummy; int n, k; if (wintab_initialized) return; wintab_initialized = TRUE; wintab_contexts = NULL; if (_gdk_input_ignore_wintab) return; n = GetSystemDirectory (&dummy, 0); if (n <= 0) return; wintab32_dll_path = g_malloc (n + 1 + strlen (WINTAB32_DLL)); k = GetSystemDirectory (wintab32_dll_path, n); if (k == 0 || k > n) { g_free (wintab32_dll_path); return; } if (!G_IS_DIR_SEPARATOR (wintab32_dll_path[strlen (wintab32_dll_path) -1])) strcat (wintab32_dll_path, G_DIR_SEPARATOR_S); strcat (wintab32_dll_path, WINTAB32_DLL); if ((wintab32 = LoadLibrary (wintab32_dll_path)) == NULL) return; if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL) return; if ((p_WTInfoW = (t_WTInfoW) GetProcAddress (wintab32, "WTInfoW")) == NULL) return; if ((p_WTEnable = (t_WTEnable) GetProcAddress (wintab32, "WTEnable")) == NULL) return; if ((p_WTOpenA = (t_WTOpenA) GetProcAddress (wintab32, "WTOpenA")) == NULL) return; if ((p_WTOverlap = (t_WTOverlap) GetProcAddress (wintab32, "WTOverlap")) == NULL) return; if ((p_WTPacket = (t_WTPacket) GetProcAddress (wintab32, "WTPacket")) == NULL) return; if ((p_WTQueueSizeSet = (t_WTQueueSizeSet) GetProcAddress (wintab32, "WTQueueSizeSet")) == NULL) return; if (!(*p_WTInfoA) (0, 0, NULL)) return; (*p_WTInfoA) (WTI_INTERFACE, IFC_SPECVERSION, &specversion); GDK_NOTE (INPUT, g_print ("Wintab interface version %d.%d\n", HIBYTE (specversion), LOBYTE (specversion))); (*p_WTInfoA) (WTI_INTERFACE, IFC_NDEVICES, &ndevices); (*p_WTInfoA) (WTI_INTERFACE, IFC_NCURSORS, &ncursors); #if DEBUG_WINTAB GDK_NOTE (INPUT, g_print ("NDEVICES: %d, NCURSORS: %d\n", ndevices, ncursors)); #endif /* Create a dummy window to receive wintab events */ wa.wclass = GDK_INPUT_OUTPUT; wa.event_mask = GDK_ALL_EVENTS_MASK; wa.width = 2; wa.height = 2; wa.x = -100; wa.y = -100; wa.window_type = GDK_WINDOW_TOPLEVEL; if ((wintab_window = gdk_window_new (NULL, &wa, GDK_WA_X|GDK_WA_Y)) == NULL) { g_warning ("gdk_input_wintab_init: gdk_window_new failed"); return; } g_object_ref (wintab_window); for (devix = 0; devix < ndevices; devix++) { LOGCONTEXT lc; /* We open the Wintab device (hmm, what if there are several, or * can there even be several, probably not?) as a system * pointing device, i.e. it controls the normal Windows * cursor. This seems much more natural. */ (*p_WTInfoW) (WTI_DEVICES + devix, DVC_NAME, devname); devname_utf8 = g_utf16_to_utf8 (devname, -1, NULL, NULL, NULL); #ifdef DEBUG_WINTAB GDK_NOTE (INPUT, (g_print("Device %d: %s\n", devix, devname_utf8))); #endif (*p_WTInfoA) (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_HARDWARE, &hardware); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_X, &axis_x); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_Y, &axis_y); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure); (*p_WTInfoA) (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or); defcontext_done = FALSE; if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1) { /* Try to get device-specific default context */ /* Some drivers, e.g. Aiptek, don't provide this info */ if ((*p_WTInfoA) (WTI_DSCTXS + devix, 0, &lc) > 0) defcontext_done = TRUE; #if DEBUG_WINTAB if (defcontext_done) GDK_NOTE (INPUT, (g_print("Using device-specific default context\n"))); else GDK_NOTE (INPUT, (g_print("Note: Driver did not provide device specific default context info despite claiming to support version 1.1\n"))); #endif } if (!defcontext_done) (*p_WTInfoA) (WTI_DEFSYSCTX, 0, &lc); #if DEBUG_WINTAB GDK_NOTE (INPUT, (g_print("Default context:\n"), print_lc(&lc))); #endif lc.lcOptions |= CXO_MESSAGES; lc.lcStatus = 0; lc.lcMsgBase = WT_DEFBASE; lc.lcPktRate = 0; lc.lcPktData = PACKETDATA; lc.lcPktMode = PACKETMODE; lc.lcMoveMask = PACKETDATA; lc.lcBtnUpMask = lc.lcBtnDnMask = ~0; lc.lcOutOrgX = axis_x.axMin; lc.lcOutOrgY = axis_y.axMin; lc.lcOutExtX = axis_x.axMax - axis_x.axMin; lc.lcOutExtY = axis_y.axMax - axis_y.axMin; lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */ #if DEBUG_WINTAB GDK_NOTE (INPUT, (g_print("context for device %d:\n", devix), print_lc(&lc))); #endif hctx = g_new (HCTX, 1); if ((*hctx = (*p_WTOpenA) (GDK_WINDOW_HWND (wintab_window), &lc, TRUE)) == NULL) { g_warning ("gdk_input_wintab_init: WTOpen failed"); return; } GDK_NOTE (INPUT, g_print ("opened Wintab device %d %p\n", devix, *hctx)); wintab_contexts = g_list_append (wintab_contexts, hctx); #if 0 (*p_WTEnable) (*hctx, TRUE); #endif (*p_WTOverlap) (*hctx, TRUE); #if DEBUG_WINTAB GDK_NOTE (INPUT, (g_print("context for device %d after WTOpen:\n", devix), print_lc(&lc))); #endif /* Increase packet queue size to reduce the risk of lost packets. * According to the specs, if the function fails we must try again * with a smaller queue size. */ GDK_NOTE (INPUT, g_print("Attempting to increase queue size\n")); for (i = 32; i >= 1; i >>= 1) { if ((*p_WTQueueSizeSet) (*hctx, i)) { GDK_NOTE (INPUT, g_print("Queue size set to %d\n", i)); break; } } if (!i) GDK_NOTE (INPUT, g_print("Whoops, no queue size could be set\n")); for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++) { #ifdef DEBUG_WINTAB GDK_NOTE (INPUT, (g_print("Cursor %d:\n", cursorix), print_cursor (cursorix))); #endif active = FALSE; (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_ACTIVE, &active); if (!active) continue; /* Wacom tablets seem to report cursors corresponding to * nonexistent pens or pucks. At least my ArtPad II reports * six cursors: a puck, pressure stylus and eraser stylus, * and then the same three again. I only have a * pressure-sensitive pen. The puck instances, and the * second instances of the styluses report physid zero. So * at least for Wacom, skip cursors with physid zero. */ (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PHYSID, &physid); if (wcscmp (devname, L"WACOM Tablet") == 0 && physid == 0) continue; (*p_WTInfoW) (WTI_CURSORS + cursorix, CSR_NAME, csrname); csrname_utf8 = g_utf16_to_utf8 (csrname, -1, NULL, NULL, NULL); device_name = g_strconcat (devname_utf8, " ", csrname_utf8, NULL); device = g_object_new (GDK_TYPE_DEVICE_WINTAB, "name", device_name, "type", GDK_DEVICE_TYPE_SLAVE, "source", GDK_SOURCE_PEN, "mode", GDK_MODE_SCREEN, "has-cursor", FALSE, "display", _gdk_display, "device-manager", device_manager, NULL); g_free (csrname_utf8); device->hctx = *hctx; device->cursor = cursorix; (*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PKTDATA, &device->pktdata); if (device->pktdata & PK_X) { _gdk_device_add_axis (GDK_DEVICE (device), GDK_NONE, GDK_AXIS_X, axis_x.axMin, axis_x.axMax, axis_x.axResolution / 65535); num_axes++; } if (device->pktdata & PK_Y) { _gdk_device_add_axis (GDK_DEVICE (device), GDK_NONE, GDK_AXIS_Y, axis_y.axMin, axis_y.axMax, axis_y.axResolution / 65535); num_axes++; } if (device->pktdata & PK_NORMAL_PRESSURE) { _gdk_device_add_axis (GDK_DEVICE (device), GDK_NONE, GDK_AXIS_PRESSURE, axis_npressure.axMin, axis_npressure.axMax, axis_npressure.axResolution / 65535); num_axes++; } /* The wintab driver for the Wacom ArtPad II reports * PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't * actually sense tilt. Catch this by noticing that the * orientation axis's azimuth resolution is zero. */ if ((device->pktdata & PK_ORIENTATION) && axis_or[0].axResolution == 0) { device->orientation_axes[0] = axis_or[0]; device->orientation_axes[1] = axis_or[1]; /* Wintab gives us aximuth and altitude, which * we convert to x and y tilt in the -1000..1000 range */ _gdk_device_add_axis (GDK_DEVICE (device), GDK_NONE, GDK_AXIS_XTILT, -1000, 1000, 1000); _gdk_device_add_axis (GDK_DEVICE (device), GDK_NONE, GDK_AXIS_YTILT, -1000, 1000, 1000); num_axes += 2; } device->last_axis_data = g_new (gint, num_axes); GDK_NOTE (INPUT, g_print ("device: (%d) %s axes: %d\n", cursorix, device_name, num_axes)); #if 0 for (i = 0; i < gdkdev->info.num_axes; i++) GDK_NOTE (INPUT, g_print ("... axis %d: %d--%d@%d\n", i, gdkdev->axes[i].min_value, gdkdev->axes[i].max_value, gdkdev->axes[i].resolution)); #endif device_manager->wintab_devices = g_list_append (device_manager->wintab_devices, device); g_free (device_name); } g_free (devname_utf8); } }
int main(int argc, char * argv[]) { WINDOW * win = init_screen(); #ifdef ENABLE_CURSOR MEVENT event; #endif /* predefined patterns */ struct pattern patterns[] = { {3, 3, (uint8_t *) start}, {3, 3, (uint8_t *) glider}, {5, 4, (uint8_t *) segler}, {3, 7, (uint8_t *) buffer}, {8, 4, (uint8_t *) kreuz}, {6, 6, (uint8_t *) ship} }; struct cursor cur = {0, 0}; struct config cfg; int generation = 0, input, framerate = 17; uint8_t width, height; uint8_t ** worlds[2], ** world; #if defined(RANDOM_SPAWNS) int idle_gens = 0; srand(time(NULL)); #endif memset(&cfg, '\0', sizeof(struct config)); /* initialize world */ world = init_world(win, worlds, &width, &height); /* make the world real */ inhabit_world(patterns[3], width/2, height/2, worlds[0], width, height); /* simulation loop */ while(!cfg.quit) { if (!cfg.paused) { /* calc next generation */ usleep(1 / (float) framerate * 1000000); /* sleep */ calc_next_gen(world, worlds[++generation % 2], width, height); world = worlds[generation % 2]; /* new world */ } /* handle events */ switch (input = getch()) { #ifdef ENABLE_HOTKEYS case '+': /* increase framerate */ framerate++; break; case '-': /* decrease framerate */ if (framerate > 1) framerate--; break; case 'q': /* quit */ cfg.quit = 1; break; #if defined(RANDOM_SPAWNS) case 'd': /* disable random spawn */ rnd_spawns = ~rnd_spawns; break; #endif case 'p': /* pause */ cfg.paused ^= 1; break; case 'c': /* clean world */ clean_world(world, width, height); generation = 0; break; #endif #if defined(ENABLE_HOTKEYS) || defined(ENABLE_CURSOR) case '0': /* insert pattern */ case '1': case '2': case '3': case '4': case '5': inhabit_world(patterns[input - '0'], cur.x, cur.y, world, width, height); break; #endif #ifdef ENABLE_CURSOR case ' ': /* toggle cell at cursor position */ world[cur.x][cur.y] = (world[cur.x][cur.y]) ? 0 : 1; break; case KEY_MOUSE: /* move cursor to mouse posititon */ if (getmouse(&event) == OK && event.bstate & BUTTON1_PRESSED) { cur.x = event.x; cur.y = event.y; if (cur.x >= width) cur.x = width - 1; if (cur.y >= height) cur.y = height - 1; world[cur.x][cur.y] = (world[cur.x][cur.y]) ? 0 : 1; } break; case KEY_UP: if (cur.y > 0) { cur.y--; } break; case KEY_DOWN: if (cur.y < height-1) { cur.y++; } break; case KEY_LEFT: if (cur.x > 0) { cur.x--; } break; case KEY_RIGHT: if (cur.x < width-1) { cur.x++; } break; case KEY_RESIZE: world = resized(win, worlds, &width, &height); break; #endif } #if defined(RANDOM_SPAWNS) if (rnd_spawns) { /* spawn a new pattern at a random position, if nothing happens */ idle_gens++; if (idle_gens >= RANDOM_SPAWNS && !cfg.paused) { idle_gens = 0; inhabit_world(patterns[rand() % (sizeof(patterns)/sizeof(patterns[0]))], rand() % (width - 1), rand() % (height - 1), world, width, height); } } #endif /* update screen */ print_world(world, width, height); #ifdef ENABLE_CURSOR print_cursor(world, cur); #endif #ifdef ENABLE_STATUS attron(COLOR_PAIR(1)); for (int i = 0; i < width; i++) mvprintw(0, width - i, " "); mvprintw(0, 0, "[generation:%4d] [cells:%3d] [fps:%2d] [width:%d] [height:%d] [cursor:%2d|%2d]", generation, calc_cell_count(world, width, height), framerate, width, height, cur.x, cur.y); if (cfg .paused) mvprintw(0, width-6, "PAUSED"); attroff(COLOR_PAIR(1)); #endif #ifdef ENABLE_HOTKEYS if (cfg.paused) { print_menu(width, height); usleep(1); } #endif refresh(); } free_all(worlds, width, height); delwin(win); endwin(); /* exit ncurses mode */ return (EXIT_SUCCESS); }