From: David Griffith Date: Mon, 27 Apr 2015 21:51:45 +0000 (-0700) Subject: Fix line spacing and stuff. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=c809361a6bac4517bfbced25e9266cb5b16470cd;p=liskon_frotz.git Fix line spacing and stuff. --- diff --git a/src/curses/ux_audio.c b/src/curses/ux_audio.c index df52d5b..70525e2 100644 --- a/src/curses/ux_audio.c +++ b/src/curses/ux_audio.c @@ -136,11 +136,10 @@ void os_init_sound(void) */ void os_beep (int number) { - beep(); - }/* os_beep */ + /* * os_prepare_sample * @@ -150,7 +149,6 @@ void os_beep (int number) * the same operation. This function therefore does nothing. * */ - void os_prepare_sample (int number) { return; @@ -203,16 +201,15 @@ void os_start_sample (int number, int volume, int repeats, zword eos) } else { /* Something else was presented as an audio chunk. Ignore it. */ } - }/* os_start_sample */ + /* * os_stop_sample * * Turn off the current sample. * */ - void os_stop_sample (int number) { if (bleep_playing && number == bleepnum) { @@ -221,26 +218,26 @@ void os_stop_sample (int number) return; }/* os_stop_sample */ + /* * os_finish_with_sample * * Remove the current sample from memory (if any). * */ - void os_finish_with_sample (int number) { os_stop_sample(number); }/* os_finish_with_sample */ + /* * os_wait_sample * * Stop repeating the current sample and wait until it finishes. * */ - void os_wait_sample (void) { @@ -250,8 +247,10 @@ void os_wait_sample (void) /* + ********************************************** * These functions are internal to ux_audio.c * + ********************************************** */ /* @@ -264,7 +263,6 @@ void os_wait_sample (void) * Data presented to the mixer must be floats at 44100hz * */ - static void *mixer(void *arg) { short *shortbuffer; @@ -330,7 +328,7 @@ static void floattopcm16(short *outbuf, float *inbuf, int length) /* Convert the buffer to floats. (before resampling) */ -void pcm16tofloat(float *outbuf, short *inbuf, int length) +static void pcm16tofloat(float *outbuf, short *inbuf, int length) { int count; @@ -359,6 +357,7 @@ static int mypower(int base, int exp) { } } + /* * playaiff * @@ -580,6 +579,7 @@ static int playmod(EFFECT myeffect) return(2); } + /* * getfiledata * diff --git a/src/curses/ux_blorb.c b/src/curses/ux_blorb.c index 21baa90..25d32cc 100644 --- a/src/curses/ux_blorb.c +++ b/src/curses/ux_blorb.c @@ -101,7 +101,6 @@ bb_err_t ux_blorb_init(char *filename) fclose(fp); fp = NULL; - /* Check if foo.blb is there. */ if ((blorb_fp = fopen(mystring, "rb")) == NULL) { p = rindex(mystring, '.'); @@ -140,6 +139,7 @@ bb_err_t ux_blorb_init(char *filename) return blorb_err; } + /* * ux_blorb_stop * @@ -153,7 +153,12 @@ void ux_blorb_stop(void) blorb_fp = NULL; } - +/* + ********************************************** + * These functions are internal to ux_blorb.c + * + ********************************************** + */ /* * isblorb @@ -182,6 +187,7 @@ static int isblorb(FILE *fp) return 1; } + static char *findchunk(char *data, char *string, int length) { char *mydata = data+12; diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index 075e368..dfe067a 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -82,16 +82,15 @@ static int geterrmode(char *); static void redraw(void); static FILE *pathopen(const char *, const char *, const char *, char *); + /* * os_fatal * * Display error message and exit program. * */ - void os_fatal (const char *s, ...) { - if (u_setup.curses_active) { /* Solaris 2.6's cc complains if the below cast is missing */ os_display_string((zchar *)"\n\n"); @@ -112,7 +111,6 @@ void os_fatal (const char *s, ...) fputs ("\n\n", stderr); exit (1); - }/* os_fatal */ /* extern char script_name[]; */ @@ -120,6 +118,7 @@ void os_fatal (const char *s, ...) /* extern char save_name[];*/ /*extern char auxilary_name[];*/ + /* * os_process_arguments * @@ -143,7 +142,6 @@ void os_fatal (const char *s, ...) * * */ - void os_process_arguments (int argc, char *argv[]) { int c; @@ -169,6 +167,7 @@ void os_process_arguments (int argc, char *argv[]) exit(1); } + /* * It doesn't look like Frotz can reliably be resized given its current * screen-handling code. While playing with Nitfol, I noticed that it @@ -193,7 +192,6 @@ void os_process_arguments (int argc, char *argv[]) if (signal(SIGTTOU, SIG_IGN) != SIG_IGN) signal(SIGTTOU, SIG_IGN); - /* First check for a "$HOME/.frotzrc". */ /* If not found, look for CONFIG_DIR/frotz.conf */ /* $HOME/.frotzrc overrides CONFIG_DIR/frotz.conf */ @@ -210,7 +208,6 @@ void os_process_arguments (int argc, char *argv[]) } /* Parse the options */ - do { c = zgetopt(argc, argv, "aAb:c:def:Fh:il:oOpPQqr:s:S:tu:w:xZ:"); switch(c) { @@ -313,6 +310,7 @@ void os_process_arguments (int argc, char *argv[]) }/* os_process_arguments */ + /* * os_init_screen * @@ -341,10 +339,8 @@ void os_process_arguments (int argc, char *argv[]) * ugly hacks, neener neener neener. --GH :) * */ - void os_init_screen (void) { - /*trace(TRACE_CALLS);*/ if (initscr() == NULL) { /* Set up curses */ @@ -458,25 +454,24 @@ void os_init_screen (void) os_erase_area(1, 1, h_screen_rows, h_screen_cols, 0); }/* os_init_screen */ + /* * os_reset_screen * * Reset the screen before the program stops. * */ - void os_reset_screen (void) { - os_stop_sample(0); os_set_text_style(0); print_string("[Hit any key to exit.]\n"); os_read_key(0, FALSE); scrollok(stdscr, TRUE); scroll(stdscr); refresh(); endwin(); - }/* os_reset_screen */ + /* * os_restart_game * @@ -488,11 +483,11 @@ void os_reset_screen (void) * RESTART_END - restart is complete * */ - void os_restart_game (int stage) { } + /* * os_random_seed * @@ -500,7 +495,6 @@ void os_restart_game (int stage) * 32767, possibly by using the current system time. * */ - int os_random_seed (void) { @@ -561,7 +555,6 @@ FILE *os_load_story(void) * path where the file was found in fullname. * */ - static FILE *pathopen(const char *name, const char *p, const char *mode, char *fullname) { FILE *fp; @@ -611,7 +604,6 @@ static int getconfig(char *configfile) char varname[LINELEN + 1]; char value[LINELEN + 1]; - /* * We shouldn't care if the config file is unreadable or not * present. Just use the defaults. @@ -742,7 +734,6 @@ static int getconfig(char *configfile) /* The big nasty if-else thingy is finished */ } /* while */ - return TRUE; } /* getconfig() */ @@ -856,7 +847,6 @@ static int geterrmode(char *value) * cleanly resize the window. * */ - void sigwinch_handler(int sig) { /* @@ -869,6 +859,7 @@ does nothing. } + /* * sigint_handler * Sometimes the screen will be left in a weird state if the following @@ -895,7 +886,6 @@ void redraw(void) void os_init_setup(void) { - f_setup.attribute_assignment = 0; f_setup.attribute_testing = 0; f_setup.context_lines = 0; @@ -938,8 +928,8 @@ void os_init_setup(void) } -/* A unix-like getopt, but with the names changed to avoid any problems. -*/ + +/* A unix-like getopt, but with the names changed to avoid any problems. */ static int zgetopt (int argc, char *argv[], const char *options) { static int pos = 1; @@ -973,4 +963,3 @@ error: fputc ('\n', stderr); return '?'; }/* zgetopt */ - diff --git a/src/curses/ux_input.c b/src/curses/ux_input.c index 441e00a..0680bb7 100644 --- a/src/curses/ux_input.c +++ b/src/curses/ux_input.c @@ -66,7 +66,6 @@ extern int completion (const zchar *, zchar *); * equals global_timeout, boom. * */ - static void unix_set_global_timeout(int timeout) { if (!timeout) global_timeout.tv_sec = 0; @@ -82,7 +81,11 @@ static void unix_set_global_timeout(int timeout) return; } -/* This returns the number of milliseconds until the input timeout + +/* + * timeout_to_ms + * + * This returns the number of milliseconds until the input timeout * elapses or zero if it has already elapsed. -1 is returned if no * timeout is in effect, otherwise the return value is non-negative. */ @@ -105,6 +108,7 @@ static int timeout_to_ms() return diff.tv_sec * 1000 + diff.tv_usec / 1000; } + /* * unix_read_char * @@ -227,7 +231,7 @@ static int unix_read_char(int extkeys) case MOD_META | 'd': return ZC_HKEY_DEBUG; case MOD_META | 'h': return ZC_HKEY_HELP; -/* these are the emacs-editing characters */ + /* these are the emacs-editing characters */ case MOD_CTRL ^ 'B': return ZC_ARROW_LEFT; case MOD_CTRL ^ 'F': return ZC_ARROW_RIGHT; case MOD_CTRL ^ 'P': return ZC_ARROW_UP; @@ -263,7 +267,6 @@ static int unix_read_char(int extkeys) * Add the given string to the next available history buffer slot. * */ - static void unix_add_to_history(zchar *str) { @@ -277,6 +280,7 @@ static void unix_add_to_history(zchar *str) return; } + /* * unix_history_back * @@ -302,6 +306,7 @@ static int unix_history_back(zchar *str, int searchlen, int maxlen) return 1; } + /* * unix_history_forward * @@ -326,13 +331,13 @@ static int unix_history_forward(zchar *str, int searchlen, int maxlen) return 1; } + /* * scrnmove * * In the row of the cursor, move n characters starting at src to dest. * */ - static void scrnmove(int dest, int src, int n) { int col, x, y; @@ -354,13 +359,13 @@ static void scrnmove(int dest, int src, int n) return; } + /* * scrnset * * In the row of the cursor, set n characters starting at start to c. * */ - static void scrnset(int start, int c, int n) { int y, x; @@ -372,6 +377,7 @@ static void scrnset(int start, int c, int n) return; } + /* * os_read_line * @@ -417,7 +423,6 @@ static void scrnset(int start, int c, int n) * to implement word completion (similar to tcsh under Unix). * */ - zchar os_read_line (int max, zchar *buf, int timeout, int width, int continued) { int ch, y, x, len = strlen( (char *)buf); @@ -564,6 +569,7 @@ zchar os_read_line (int max, zchar *buf, int timeout, int width, int continued) } }/* os_read_line */ + /* * os_read_key * @@ -571,7 +577,6 @@ zchar os_read_line (int max, zchar *buf, int timeout, int width, int continued) * return it. Input aborts after timeout/10 seconds. * */ - zchar os_read_key (int timeout, int cursor) { zchar c; @@ -587,6 +592,7 @@ zchar os_read_key (int timeout, int cursor) }/* os_read_key */ + /* * os_read_file_name * diff --git a/src/curses/ux_pic.c b/src/curses/ux_pic.c index 0bae85c..8869da1 100644 --- a/src/curses/ux_pic.c +++ b/src/curses/ux_pic.c @@ -51,16 +51,19 @@ static struct { } *pict_info; static int num_pictures = 0; + static unsigned char lookupb(unsigned char *p, int n) { return p[n]; } + static unsigned short lookupw(unsigned char *p, int n) { return (p[n + 1] << 8) | p[n]; } + /* * Do a rounding division, rounding to even if fraction part is 1/2. * We assume x and y are nonnegative. @@ -149,6 +152,7 @@ bool unix_init_pictures (void) return success; } + /* Convert a Z picture number to an index into pict_info. */ static int z_num_to_index(int n) { @@ -159,6 +163,7 @@ static int z_num_to_index(int n) return -1; } + /* * os_picture_data * @@ -187,6 +192,7 @@ int os_picture_data(int num, int *height, int *width) return TRUE; } + /* * Do a mvaddch if the coordinates aren't too large. * @@ -197,6 +203,7 @@ static void safe_mvaddch(int y, int x, int ch) mvaddch(y, x, ch); } + /* * Set n chars starting at (x, y), doing bounds checking. * @@ -212,18 +219,17 @@ static void safe_scrnset(int y, int x, int ch, int n) } } + /* * os_draw_picture * * Display a picture at the given coordinates. Top left is (1,1). * */ - /* TODO: handle truncation correctly. Spec 8.8.3 says all graphics should * be clipped to the current window. To do that, we should probably * modify z_draw_picture in the frotz core to pass some extra parameters. */ - void os_draw_picture (int num, int row, int col) { int width, height, r, c; @@ -269,11 +275,6 @@ void os_draw_picture (int num, int row, int col) * v */ - - - - - if ((height == 1) && (width == 1)) safe_mvaddch(row, col, plus); else if (height == 1) { @@ -308,6 +309,7 @@ void os_draw_picture (int num, int row, int col) move(saved_y, saved_x); } + /* * os_peek_colour * @@ -322,7 +324,6 @@ void os_draw_picture (int num, int row, int col) * instead. * */ - int os_peek_colour (void) { if (u_setup.color_enabled) { diff --git a/src/curses/ux_resource.c b/src/curses/ux_resource.c index 10cdcb1..0880fee 100644 --- a/src/curses/ux_resource.c +++ b/src/curses/ux_resource.c @@ -8,6 +8,7 @@ bb_map_t *blorb_map; + /* * ux_getresource * @@ -44,13 +45,13 @@ int ux_getresource( int num, int ispic, int method, myresource * res) return st; } + /* * ux_freeresource * * Destroys a myresource struct and returns the memory to the heap. * */ - int ux_freeresource(myresource *res) { if (res == NULL) diff --git a/src/curses/ux_screen.c b/src/curses/ux_screen.c index c736e13..63029fa 100644 --- a/src/curses/ux_screen.c +++ b/src/curses/ux_screen.c @@ -32,6 +32,7 @@ #include "ux_frotz.h" + /* * os_erase_area * @@ -43,7 +44,6 @@ * being erased. This is not relevant for the curses interface. * */ - void os_erase_area (int top, int left, int bottom, int right, int win) { int y, x, i, j; @@ -77,6 +77,7 @@ void os_erase_area (int top, int left, int bottom, int right, int win) } }/* os_erase_area */ + /* * os_scroll_area * @@ -85,7 +86,6 @@ void os_erase_area (int top, int left, int bottom, int right, int win) * colour. Top left coordinates are (1,1). The cursor stays put. * */ - void os_scroll_area (int top, int left, int bottom, int right, int units) { top--; left--; bottom--; right--; diff --git a/src/curses/ux_text.c b/src/curses/ux_text.c index bdce7dc..858ba83 100644 --- a/src/curses/ux_text.c +++ b/src/curses/ux_text.c @@ -50,6 +50,8 @@ static char latin1_to_ascii[] = "Th N O O O O Oe * O U U U Ue Y Th ss " "a a a a ae a ae c e e e e i i i i " "th n o o o o oe : o u u u ue y th y "; + + /* * os_font_data * @@ -65,7 +67,6 @@ static char latin1_to_ascii[] = * be changed. * */ - int os_font_data (int font, int *height, int *width) { @@ -76,6 +77,7 @@ int os_font_data (int font, int *height, int *width) }/* os_font_data */ + #ifdef COLOR_SUPPORT /* * unix_convert @@ -83,7 +85,6 @@ int os_font_data (int font, int *height, int *width) * Converts frotz's (and Infocom's) color values to ncurses color values. * */ - static int unix_convert(int color) { switch(color) { @@ -100,6 +101,7 @@ static int unix_convert(int color) } #endif + /* * os_set_colour * @@ -129,7 +131,6 @@ static int unix_convert(int color) * remarks on os_peek_colour. * */ - void os_set_colour (int new_foreground, int new_background) { if (new_foreground == 1) new_foreground = h_default_foreground; @@ -153,6 +154,7 @@ void os_set_colour (int new_foreground, int new_background) os_set_text_style(u_setup.current_text_style); }/* os_set_colour */ + /* * os_set_text_style * @@ -164,7 +166,6 @@ void os_set_colour (int new_foreground, int new_background) * FIXED_WIDTH_STYLE * */ - void os_set_text_style (int new_style) { int temp = 0; @@ -176,6 +177,7 @@ void os_set_text_style (int new_style) attrset(temp ^ u_setup.current_color); }/* os_set_text_style */ + /* * os_set_font * @@ -183,7 +185,6 @@ void os_set_text_style (int new_style) * choose fonts which aren't supported by the interface. * */ - void os_set_font (int new_font) { @@ -191,6 +192,7 @@ void os_set_font (int new_font) }/* os_set_font */ + /* * os_display_char * @@ -202,10 +204,8 @@ void os_set_font (int new_font) * bottom right corner. * */ - void os_display_char (zchar c) { - if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX) { if (u_setup.plain_ascii) { @@ -237,19 +237,17 @@ void os_display_char (zchar c) addch(' '); addch(' '); return; } - }/* os_display_char */ + /* * os_display_string * * Pass a string of characters to os_display_char. * */ - void os_display_string (const zchar *s) { - zchar c; while ((c = (unsigned char) *s++) != 0) @@ -267,16 +265,15 @@ void os_display_string (const zchar *s) }/* os_display_string */ + /* * os_char_width * * Return the width of the character in screen units. * */ - int os_char_width (zchar c) { - if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX && u_setup.plain_ascii) { int width = 0; @@ -299,6 +296,7 @@ int os_char_width (zchar c) }/* os_char_width*/ + /* * os_string_width * @@ -309,7 +307,6 @@ int os_char_width (zchar c) * NEW_FONT - next character is a new font * */ - int os_string_width (const zchar *s) { int width = 0; @@ -325,16 +322,15 @@ int os_string_width (const zchar *s) } else width += os_char_width(c); return width; - }/* os_string_width */ + /* * os_set_cursor * * Place the text cursor at the given coordinates. Top left is (1,1). * */ - void os_set_cursor (int y, int x) { @@ -343,6 +339,7 @@ void os_set_cursor (int y, int x) }/* os_set_cursor */ + /* * os_more_prompt * @@ -350,7 +347,6 @@ void os_set_cursor (int y, int x) * prompt from the screen. * */ - void os_more_prompt (void) { int saved_style, saved_x, saved_y;