Added function name comment to end of each function in src/dumb/.
authorDavid Griffith <dave@661.org>
Thu, 4 May 2023 05:45:58 +0000 (22:45 -0700)
committerDavid Griffith <dave@661.org>
Thu, 4 May 2023 06:13:15 +0000 (23:13 -0700)
src/dumb/dblorb.c
src/dumb/dinit.c
src/dumb/dinput.c
src/dumb/doutput.c
src/dumb/dpic.c

index b9ba653cf0fc29a77a7002ce183b0a40cfe9dbc4..fb44ca2e364d62743061f5cbfb14ee6e88ec4f8c 100644 (file)
@@ -130,7 +130,7 @@ bb_err_t dumb_blorb_init(char *filename)
        }
 
        return blorb_err;
-}
+} /* dumb_blorb_init */
 
 
 /*
@@ -157,6 +157,6 @@ static int isblorb(FILE *fp)
                return 0;
 
        return 1;
-}
+} /* isblorb */
 
 #endif /* NO_BLORB */
index e6b7faba21d7b27451d28f8e0d0a1dcaee548efd..6aa3dfa3198a5b21afd74301e8ea4661831450cd 100644 (file)
@@ -264,7 +264,7 @@ void os_process_arguments(int argc, char *argv[])
        f_setup.aux_name = malloc((strlen(f_setup.story_name) + strlen(EXT_AUX) + 1) * sizeof(char));
        memcpy(f_setup.aux_name, f_setup.story_name, (strlen(f_setup.story_name) + strlen(EXT_AUX)) * sizeof(char));
        strncat(f_setup.aux_name, EXT_AUX, strlen(EXT_AUX) + 1);
-}
+} /* os_process_arguments */
 
 
 void os_init_screen(void)
@@ -291,7 +291,7 @@ void os_init_screen(void)
        dumb_init_input();
        dumb_init_output();
        dumb_init_pictures();
-}
+} /* os_init_screen */
 
 
 int os_random_seed (void)
@@ -299,7 +299,7 @@ int os_random_seed (void)
        if (user_random_seed == -1)     /* Use the epoch as seed value */
                return (time(0) & 0x7fff);
        return user_random_seed;
-}
+} /* os_random_seed */
 
 
 /*
@@ -311,7 +311,7 @@ int os_random_seed (void)
 void os_quit(int status)
 {
        exit(status);
-}
+} /* os_quit */
 
 
 void os_restart_game (int UNUSED (stage)) {}
@@ -339,7 +339,7 @@ void os_warn (const char *s, ...)
        fprintf(stderr, "\n");
        os_set_text_style(style);
        return;
-}
+} /* os_warn */
 
 
 /*
@@ -388,7 +388,7 @@ FILE *os_load_story(void)
 #else
        return fopen(f_setup.story_file, "rb");
 #endif
-}
+} /* os_load_story */
 
 
 /*
@@ -418,7 +418,7 @@ int os_storyfile_seek(FILE * fp, long offset, int whence)
 #else
        return fseek(fp, offset, whence);
 #endif
-}
+} /* os_storyfile_seek */
 
 
 /*
@@ -436,13 +436,14 @@ int os_storyfile_tell(FILE * fp)
 #else
        return ftell(fp);
 #endif
-}
+} /* os_storyfile_tell */
 
 
 void os_init_setup(void)
 {
        /* Nothing here */
-}
+} /* os_init_setup */
+
 
 static void usage(void)
 {
@@ -450,7 +451,8 @@ static void usage(void)
        puts(INFORMATION);
        puts(INFO2);
        return;
-}
+} /* usage */
+
 
 static void print_version(void)
 {
@@ -467,4 +469,4 @@ static void print_version(void)
        printf("  The core and dumb port are maintained by David Griffith.\n");
        printf("  Frotz's homepage is https://661.org/proj/if/frotz.\n\n");
        return;
-}
+} /* print_version */
index 9018117bcce619de8ce5251383ce4b50478cfe75..b9fa828080c1fea7a9d87c147f1a4ec41d57d610 100644 (file)
@@ -104,7 +104,7 @@ static int xgetchar(void)
 #endif
        }
        return c;
-}
+} /* xgetchar */
 
 
 /* Read one line, including the newline, into s.  Safely avoids buffer
@@ -125,7 +125,7 @@ static void dumb_getline(char *s)
        while ((c = xgetchar()) != '\n')
                ;
        printf("Line too long, truncated to %s\n", s - INPUT_BUFFER_SIZE);
-}
+} /* dumb_getline */
 
 
 /* Translate in place all the escape characters in s.  */
@@ -175,7 +175,7 @@ static void translate_special_chars(char *s)
                        }
                }
        *dest = '\0';
-}
+} /* translate_special_chars */
 
 
 /* The time in tenths of seconds that the user is ahead of z time.  */
@@ -192,14 +192,14 @@ static bool check_timeout(int timeout)
        else
                time_ahead -= timeout;
        return time_ahead != 0;
-}
+} /* check_timeout */
 
 
 /* If val is '0' or '1', set *var accordingly, otherwise toggle it.  */
 static void toggle(bool *var, char val)
 {
        *var = val == '1' || (val != '0' && !*var);
-}
+} /* toggle */
 
 
 /* Handle input-related user settings and call dumb_output_handle_setting.  */
@@ -220,7 +220,7 @@ bool dumb_handle_setting(const char *setting, bool show_cursor, bool startup)
                return dumb_output_handle_setting(setting, show_cursor, startup);
        }
        return TRUE;
-}
+} /* dumb_handle_setting */
 
 
 /* Read a line, processing commands (lines that start with a backslash
@@ -330,7 +330,7 @@ static bool dumb_read_line(char *s, char *prompt, bool show_cursor,
                        fprintf(stderr, "Enter \\help to see the list of commands\n");
                }
        }
-}
+} /* dumb_read_line */
 
 
 /* Read a line that is not part of z-machine input (more prompts and
@@ -340,7 +340,7 @@ static void dumb_read_misc_line(char *s, char *prompt)
        dumb_read_line(s, prompt, 0, 0, 0, 0);
        /* Remove terminating newline */
        s[strlen(s) - 1] = '\0';
-}
+} /* dumb_read_misc_line */
 
 
 /* For allowing the user to input in a single line keys to be returned
@@ -382,7 +382,7 @@ error:
        }
        *out = ch;
        return idx;
-}
+} /* utf8_to_zchar */
 #endif
 
 
@@ -420,7 +420,7 @@ zchar os_read_key (int timeout, bool show_cursor)
        /* TODO: error messages for invalid special chars.  */
 
        return c;
-}
+} /* os_read_key */
 
 
 zchar os_read_line (int UNUSED (max), zchar *buf, int timeout, int UNUSED(width), int continued)
@@ -494,7 +494,8 @@ zchar os_read_line (int UNUSED (max), zchar *buf, int timeout, int UNUSED(width)
 
        timed_out_last_time = FALSE;
        return terminator;
-}
+} /* os_read_line */
+
 
 /*
  * os_read_file_name
@@ -601,7 +602,7 @@ char *os_read_file_name (const char *default_name, int flag)
                        return NULL;
        }
        return strdup(file_name);
-}
+} /* os_read_file_name */
 
 
 void os_more_prompt (void)
@@ -611,7 +612,7 @@ void os_more_prompt (void)
                dumb_read_misc_line(buf, "***MORE***");
        } else
                dumb_elide_more_prompt();
-}
+} /* os_more_prompt */
 
 
 void dumb_init_input(void)
@@ -621,16 +622,16 @@ void dumb_init_input(void)
 
        if (z_header.version >= V5)
                z_header.flags &= ~(MOUSE_FLAG | MENU_FLAG);
-}
+} /* dumb_init_input */
 
 
 zword os_read_mouse(void)
 {
        /* NOT IMPLEMENTED */
        return 0;
-}
+} /* os_read_mouse */
 
 void os_tick(void)
 {
        /* Nothing here yet */
-}
+} /* os_tick */
index f8214b288b2d554774e395e18b90859914b1c55b..01f1e5ebd2048b4acd569a2c3e5e16ad1cabedc4 100644 (file)
@@ -114,16 +114,17 @@ void zputchar(zchar c)
        } else {
                putchar(c);
        }
-}
+} /* zputchar */
 #else
 #define zputchar(x) putchar(x)
 #endif
 
+
 /* if val is '0' or '1', set *var accordingly, else toggle it.  */
 static void toggle(bool *var, char val)
 {
        *var = val == '1' || (val != '0' && !*var);
-}
+} /* toggle */
 
 
 /* Print a cell to stdout using IRC formatting codes.  */
@@ -184,7 +185,8 @@ static void show_cell_irc(cell_t cel)
 
        lastfg = fg;
        lastbg = bg;
-}
+} /* show_cell_irc */
+
 
 static void show_cell_ansi(cell_t cel)
 {
@@ -257,7 +259,8 @@ static void show_cell_ansi(cell_t cel)
                zputchar(show_pictures ? cel.c : ' ');
        else
                zputchar(cel.c);
-}
+} /* show_cell_ansi */
+
 
 static void show_cell_bbcode(cell_t cel)
 {
@@ -351,7 +354,7 @@ static void show_cell_bbcode(cell_t cel)
                printf("&nbsp;");
        else
                zputchar(cel.c);
-}
+} /* show_cell_bbcode */
 #endif /* DISABLE_FORMATS */
 
 
@@ -388,7 +391,7 @@ static void show_cell_normal(cell_t cel)
                zputchar(show_pictures ? cel.c : ' ');
        else    /* Only NORMAL_STYLE and FIXED_WIDTH_STYLE are left. */
                zputchar(cel.c);
-}
+} /* show_cell_normal */
 
 
 static void show_cell(cell_t cel)
@@ -403,7 +406,7 @@ static void show_cell(cell_t cel)
        else
 #endif
                show_cell_normal(cel);
-}
+} /* show_cell */
 
 
 static bool will_print_blank(cell_t c)
@@ -416,7 +419,7 @@ static bool will_print_blank(cell_t c)
                || ((c.c == ' ')
                && ((c.style != REVERSE_STYLE)
                || (*rv_blank_str == ' '))));
-}
+} /* will_print_blank */
 
 
 static cell_t make_cell(int style, short fg, short bg, zchar c)
@@ -431,7 +434,7 @@ static cell_t make_cell(int style, short fg, short bg, zchar c)
                cel.fg = fg;
        }
        return cel;
-}
+} /* make_cell */
 
 
 static void show_line_prefix(int row, char c)
@@ -454,13 +457,13 @@ static void show_line_prefix(int row, char c)
        /* Add a separator char (unless there's nothing to separate).  */
        if (show_line_numbers || show_line_types)
                show_cell(make_cell(0, DEFAULT_DUMB_COLOUR, DEFAULT_DUMB_COLOUR, ' '));
-}
+} /* show_line_prefix */
 
 
 static cell_t *dumb_row(int r)
 {
        return screen_data + r * z_header.screen_cols;
-}
+} /* dumb_row */
 
 
 /* Print a row to stdout.  */
@@ -483,13 +486,13 @@ static void show_row(int r)
                        show_cell(dumb_row(r)[c]);
        }
        show_cell(make_cell (0, DEFAULT_DUMB_COLOUR, DEFAULT_DUMB_COLOUR, '\n'));
-}
+} /* show_row */
 
 
 static char *dumb_changes_row(int r)
 {
        return screen_changes + r * z_header.screen_cols;
-}
+} /* dumb_changes_row */
 
 
 /* Set a cell and update screen_changes.  */
@@ -509,7 +512,7 @@ static void dumb_set_cell(int row, int col, cell_t c)
 
        dumb_changes_row(row)[col] = (!result);
        dumb_row(row)[col] = c;
-}
+} /* dumb_set_cell */
 
 
 /* put a character in the cell at the cursor and advance the cursor.  */
@@ -524,13 +527,13 @@ static void dumb_display_char(zchar c)
                        cursor_col = 0;
                }
        }
-}
+} /* dumb_display_char */
 
 
 static void mark_all_unchanged(void)
 {
        memset(screen_changes, 0, screen_cells);
-}
+} /* mark_all_unchanged */
 
 
 /* Check if a cell is a blank or will display as one.
@@ -539,7 +542,7 @@ static bool is_blank(cell_t c)
 {
        return ((c.c == ' ')
                || ((c.style == PICTURE_STYLE) && !show_pictures));
-}
+} /* is_blank */
 
 
 static void dumb_copy_cell(int dest_row, int dest_col,
@@ -547,7 +550,7 @@ static void dumb_copy_cell(int dest_row, int dest_col,
 {
        dumb_row(dest_row)[dest_col] = dumb_row(src_row)[src_col];
        dumb_changes_row(dest_row)[dest_col] = dumb_changes_row(src_row)[src_col];
-}
+} /* dumb_copy_cell */
 
 
 
@@ -575,7 +578,7 @@ void os_display_char (zchar c)
                dumb_display_char(' ');
        }
        return;
-}
+} /* os_display_char */
 
 
 /* Haxor your boxor? */
@@ -592,7 +595,7 @@ void os_display_string (const zchar *s)
                        os_display_char (c);
                }
        }
-}
+} /* os_display_string */
 
 
 void os_erase_area (int top, int left, int bottom, int right, int UNUSED (win))
@@ -603,7 +606,7 @@ void os_erase_area (int top, int left, int bottom, int right, int UNUSED (win))
                for (col = left; col <= right; col++)
                        dumb_set_cell(row, col, make_cell(current_style, current_fg, current_bg, ' '));
        }
-}
+} /* os_erase_area */
 
 
 void os_scroll_area (int top, int left, int bottom, int right, int units)
@@ -626,7 +629,7 @@ void os_scroll_area (int top, int left, int bottom, int right, int units)
                }
                os_erase_area(top + 1, left + 1, top - units, right + 1 , -1);
        }
-}
+} /* os_scroll_area */
 
 
 int os_font_data(int font, int *height, int *width)
@@ -637,20 +640,20 @@ int os_font_data(int font, int *height, int *width)
                return 1;
        }
        return 0;
-}
+} /* os_font_data */
 
 
 void os_set_colour (int newfg, int newbg)
 {
        current_fg = frotz_to_dumb[newfg];
        current_bg = frotz_to_dumb[newbg];
-}
+} /* os_set_colour */
 
 
 void os_reset_screen(void)
 {
        dumb_show_screen(FALSE);
-}
+} /* os_reset_screen */
 
 
 void os_beep (int volume)
@@ -659,7 +662,7 @@ void os_beep (int volume)
                printf("[%s-PITCHED BEEP]\n", (volume == 1) ? "HIGH" : "LOW");
        else
                putchar('\a'); /* so much for dumb.  */
-}
+} /* os_beep */
 
 
 /* To make the common code happy */
@@ -674,7 +677,7 @@ int os_check_unicode(int font, zchar c)
 {
        /* Only UTF-8 output, no input yet.  */
        return 1;
-}
+} /* os_check_unicode */
 
 
 int os_char_width (zchar z)
@@ -684,7 +687,7 @@ int os_char_width (zchar z)
                return strchr(p, ' ') - p;
        }
        return 1;
-}
+} /* os_char_width */
 
 
 int os_string_width (const zchar *s)
@@ -699,7 +702,7 @@ int os_string_width (const zchar *s)
                        width += os_char_width(c);
        }
        return width;
-}
+} /* os_string_width */
 
 
 void os_set_cursor(int row, int col)
@@ -707,7 +710,7 @@ void os_set_cursor(int row, int col)
        cursor_row = row - 1; cursor_col = col - 1;
        if (cursor_row >= z_header.screen_rows)
                cursor_row = z_header.screen_rows - 1;
-}
+} /* os_set_cursor */
 
 
 bool os_repaint_window(int UNUSED(win), int UNUSED(ypos_old),
@@ -715,7 +718,7 @@ bool os_repaint_window(int UNUSED(win), int UNUSED(ypos_old),
                        int UNUSED(ysize), int UNUSED(xsize))
 {
        return FALSE;
-}
+} /* os_repaint_window */
 
 
 /*
@@ -732,7 +735,7 @@ bool os_repaint_window(int UNUSED(win), int UNUSED(ypos_old),
 int os_get_text_style(void)
 {
        return current_style;
-}
+} /* os_get_text_style */
 
 
 /*
@@ -749,7 +752,7 @@ int os_get_text_style(void)
 void os_set_text_style(int x)
 {
        current_style = x;
-}
+} /* os_set_text_style */
 
 
 /*
@@ -762,7 +765,8 @@ int os_from_true_colour(zword colour)
 {
        /* Nothing here yet */
        return 0;
-}
+} /* os_from_true_colour */
+
 
 /*
  * os_to_true_colour
@@ -774,7 +778,7 @@ zword os_to_true_colour(int index)
 {
        /* Nothing here yet */
        return 0;
-}
+} /* os_to_true_colour */
 
 
 /*
@@ -783,7 +787,7 @@ zword os_to_true_colour(int index)
 void dumb_set_picture_cell(int row, int col, zchar c)
 {
        dumb_set_cell(row, col, make_cell(current_style | PICTURE_STYLE, current_fg, current_bg, c));
-}
+} /* dumb_set_picture_cell */
 
 
 void dumb_init_output(void)
@@ -871,7 +875,7 @@ void dumb_init_output(void)
        screen_changes = malloc(screen_cells);
        os_erase_area(1, 1, z_header.screen_rows, z_header.screen_cols, -2);
        memset(screen_changes, 0, screen_cells);
-}
+} /* dumb_init_output */
 
 
 void dumb_display_user_input(char *s)
@@ -879,7 +883,7 @@ void dumb_display_user_input(char *s)
        /* copy to screen without marking it as a change.  */
        while (*s)
                dumb_row(cursor_row)[cursor_col++] = make_cell(0, DEFAULT_DUMB_COLOUR, DEFAULT_DUMB_COLOUR, *s++);
-}
+} /* dumb_display_user_input */
 
 
 void dumb_discard_old_input(int num_chars)
@@ -893,7 +897,7 @@ void dumb_discard_old_input(int num_chars)
                cursor_col = 0;
        os_erase_area(cursor_row + 1, cursor_col + 1,
        cursor_row + 1, cursor_col + num_chars, -1);
-}
+} /* dumb_discard_old_input */
 
 
 /* Print the part of the cursor row before the cursor.  */
@@ -905,7 +909,7 @@ void dumb_show_prompt(bool show_cursor, char line_type)
                for (i = 0; i < cursor_col; i++)
                        show_cell(dumb_row(cursor_row)[i]);
        }
-}
+} /* dumb_show_prompt */
 
 
 /* Show the current screen contents, or what's changed since the last
@@ -979,7 +983,7 @@ void dumb_show_screen(bool show_cursor)
                        show_row((cursor_row == last + 2) ? (last + 1) : -1);
        }
        mark_all_unchanged();
-}
+} /* dumb_show_screen */
 
 
 /* Unconditionally show whole screen.  For \s user command.  */
@@ -988,7 +992,7 @@ void dumb_dump_screen(void)
        int r;
        for (r = 0; r < z_header.screen_height; r++)
                show_row(r);
-}
+} /* dumb_dump_screen */
 
 
 /* Called when it's time for a more prompt but user has them turned off.  */
@@ -998,7 +1002,7 @@ void dumb_elide_more_prompt(void)
     if (compression_mode == COMPRESSION_SPANS && hide_lines == 0) {
        show_row(-1);
     }
-}
+} /* dumb_elide_more_prompt */
 
 
 bool dumb_output_handle_setting(const char *setting, bool show_cursor,
@@ -1079,6 +1083,6 @@ bool dumb_output_handle_setting(const char *setting, bool show_cursor,
        } else
                return FALSE;
        return TRUE;
-}
+} /* dumb_output_handle_setting */
 
 
index e9d478adbb57f557b1107627d9ac39c9f0e0a0e1..665b1b2b5d25d35123853fe238600906d00b172f 100644 (file)
@@ -47,7 +47,7 @@ static int round_div(int x, int y)
        if ((dblremain > y) || ((dblremain == y) && (quotient & 1)))
                quotient++;
        return quotient;
-}
+} /* round_div */
 #endif /* NO_BLORB */
 
 
@@ -157,7 +157,7 @@ bool dumb_init_pictures (void)
 #else
        return FALSE;
 #endif
-}
+} /* dumb_init_pictures */
 
 
 /* Convert a Z picture number to an index into pict_info.  */
@@ -170,7 +170,7 @@ static int z_num_to_index(int n)
                        return i;
        }
        return -1;
-}
+} /* z_num_to_index */
 #endif
 
 
@@ -192,7 +192,7 @@ bool os_picture_data(int num, int *height, int *width)
        *width = pict_info[index].width;
 #endif
        return TRUE;
-}
+} /* os_picture_data */
 
 
 void os_draw_picture (int num, int row, int col)
@@ -227,7 +227,7 @@ void os_draw_picture (int num, int row, int col)
                        dumb_set_picture_cell(row + height - 2, c, num ? (num % 10 + '0') : ':');
        }
 #endif
-}
+} /* os_draw_picture */
 
 
 int os_peek_colour (void) {return BLACK_COLOUR; }