+ char * f_name = "write_winconf_of_id_to_file()";
+ struct Win * wc = get_win_by_id(c);
+ uint8_t size = strlen(wc->title) + 2;
+ if (size < 7) /* Ensure that at least 5 + 2 char fit into line so that */
+ { /* the digit representation of any uint16_t may be stored. */
+ size = 7;
+ }
+ char line[size];
+ sprintf(line, "%c\n", wc->id);
+ try_fwrite(line, sizeof(char), strlen(line), file, f_name);
+ sprintf(line, "%s\n", wc->title);
+ try_fwrite(line, sizeof(char), strlen(line), file, f_name);
+ sprintf(line, "%d\n", wc->target_height);
+ try_fwrite(line, sizeof(char), strlen(line), file, f_name);
+ sprintf(line, "%d\n", wc->target_width);
+ try_fwrite(line, sizeof(char), strlen(line), file, f_name);
+ write_keybindings_to_file(file, &wc->kb, delim);
+}
+
+
+
+extern void read_order_wins_visible_active(char * line, uint32_t linemax,
+ FILE * file)
+{
+ 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);