- char * f_name = "init_win()";
- struct Win * w = try_malloc(sizeof(struct Win), f_name);
- w->prev = 0;
- w->next = 0;
- w->winmapsize.y = 0;
- w->winmapsize.x = 0;
- w->winmap = NULL;
- w->title = try_malloc(strlen(title) + 1, f_name);
- sprintf(w->title, "%s", title);
- w->draw = func;
- w->center.y = 0;
- w->center.x = 0;
- w->framesize.y = world.wmeta.padsize.y - 1;
- if (0 < height && height <= world.wmeta.padsize.y - 1)
- {
- w->framesize.y = height;
- }
- else if (0 > height && world.wmeta.padsize.y + (height - 1) > 0)
- {
- w->framesize.y = world.wmeta.padsize.y + (height - 1);
- }
- w->framesize.x = world.wmeta.padsize.x;
- if (0 < width)
- {
- w->framesize.x = width;
+ char * f_name = "read_order_wins_visible_active()";
+ char win_order[linemax + 1];
+ try_fgets(win_order, linemax + 1, file, f_name);
+ win_order[strlen(win_order) - 1] = '\0';
+ world.windb.order = try_malloc(strlen(win_order) + 1, f_name);
+ sprintf(world.windb.order, "%s", win_order);
+ int char_or_eof = try_fgetc(file, f_name);
+ char * err_eof = "fgetc() unexpectedly hitting EOF";
+ exit_trouble(EOF == char_or_eof, f_name, err_eof);
+ world.windb.active = (uint8_t) char_or_eof;
+ exit_trouble(EOF == try_fgetc(file, f_name), f_name, err_eof);
+ try_fgets(line, linemax + 1, file, f_name);
+}
+
+
+
+extern void write_order_wins_visible_active(FILE * file, char * delim)
+{
+ char * f_name = "write_order_wins_visible_active()";
+ try_fwrite(world.windb.order, strlen(world.windb.order), 1, file, f_name);
+ try_fputc('\n', file, f_name);
+ try_fputc(world.windb.active, file, f_name);
+ try_fputc('\n', file, f_name);
+ try_fwrite(delim, strlen(delim), 1, file, f_name);
+}
+
+
+
+extern void make_v_screen_and_init_win_sizes()
+{
+ char * f_name = "make_v_screen_and_init_win_sizes()";
+ char * err_s = "creating an illegaly large virtual screen";
+ char * err_m = "triggering a memory allocation error via newpad()";
+ uint32_t maxy_test = getmaxy(world.windb.t_screen);
+ uint32_t maxx_test = getmaxx(world.windb.t_screen);
+ exit_trouble(maxy_test>UINT16_MAX || maxx_test>UINT16_MAX, f_name, err_s);
+ world.windb.v_screen_size.y = maxy_test;
+ world.windb.v_screen_size.x = maxx_test;
+ world.windb.v_screen = newpad(world.windb.v_screen_size.y, 1);
+ exit_trouble(NULL == world.windb.v_screen, f_name, err_m);
+ char id;
+ while (0 != (id = get_next_win_id()))
+ {
+ init_win_size_from_winconf_and_v_screen_size(id);