From: David Griffith Date: Mon, 1 May 2023 15:42:32 +0000 (-0700) Subject: Added function name comment to end of each function in src/curses/. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=2a96e0eebbd7963466f698dbc0e413324458762b;p=liskon_frotz.git Added function name comment to end of each function in src/curses/. This is part of a larger project to better document things in the SDL interface and make the code more consistent with that in the other interfaces. --- diff --git a/src/curses/ux_audio.c b/src/curses/ux_audio.c index 67f3ce7..924dafa 100644 --- a/src/curses/ux_audio.c +++ b/src/curses/ux_audio.c @@ -210,14 +210,14 @@ getfiledata(FILE *fp, long *size) fread(data, *size, sizeof(char), fp); fseek(fp, offset, SEEK_SET); return(data); -} +} /* getfiledata */ static int32_t make_id(uint8_t a, uint8_t b, uint8_t c, uint8_t d) { return (a << 24) | (b << 16) | (c << 8) | d; -} +} /* make_id */ static int @@ -231,7 +231,7 @@ get_type(int magic) if (magic == make_id('O','G','G','V')) return OGGV; return -1; -} +} /* get_type */ static float @@ -240,7 +240,7 @@ limit(float mn, float mx, float v) if (vmx) return mx; return v; -} +} /* limit */ /********************************************************************** @@ -275,7 +275,9 @@ resampler_init(int sample_rate_input) rsmp->src_data.end_of_input = 0; return rsmp; -} +} /* resampler_init */ + + static void resampler_cleanup(resampler_t *rsmp) { @@ -283,7 +285,7 @@ resampler_cleanup(resampler_t *rsmp) free(rsmp->input); free(rsmp->output); free(rsmp->scratch); -} +} /* resampler_cleanup */ /*0 done running, 1 run again with more data*/ @@ -318,7 +320,7 @@ resampler_step(resampler_t *rsmp, float *block) if (rsmp->src_data.output_frames == 0) return 0; return 1; -} +} /* resampler_step */ static void @@ -326,7 +328,7 @@ resampler_consume(resampler_t *rsmp) { rsmp->src_data.data_out = rsmp->output; rsmp->src_data.output_frames = frotz_audio.buffer_size; -} +} /* resampler_consume */ /********************************************************************** @@ -356,7 +358,8 @@ process_mod(sound_stream_t *self_, float *outl, float *outr, unsigned samples) return 0; return 1; -} +} /* process_mod */ + static void cleanup_mod(sound_stream_t *s) @@ -365,7 +368,7 @@ cleanup_mod(sound_stream_t *s) ModPlug_Unload(self->mod); free(self->shortbuffer); free(self->filedata); -} +} /* cleanup_mod */ /*file, data start, id, volume*/ @@ -410,7 +413,8 @@ load_mod(FILE *fp, long startpos, int id, float volume) stream->shortbuffer = (int16_t*)calloc(frotz_audio.buffer_size, sizeof(short) * 2); return (sound_stream_t*)stream; -} +} /* load_mod */ + /********************************************************************** * AIFF/OGG * @@ -500,7 +504,7 @@ process_aiff(sound_stream_t *self_, float *outl, float *outr, unsigned samples) } return 1; -} +} /* process_aiff */ static void @@ -513,7 +517,7 @@ cleanup_aiff(sound_stream_t *s) free(self->rsmp); sf_close(self->sndfile); free(self->floatbuffer); -} +} /* cleanup_aiff */ static sf_count_t @@ -536,7 +540,7 @@ mem_snd_read(void *ptr_, sf_count_t size, void* datasource) to_read -= did_read; } return read_total; -} +} /* mem_snd_read */ static sf_count_t @@ -556,14 +560,14 @@ mem_snd_seek(sf_count_t offset, int whence, void *datasource) { fr->pos = pos; return 0; -} +} /* mem_snd_seek */ static long mem_tell(void *datasource) { file_reader_t *fr = (file_reader_t*)datasource; return fr->pos; -} +} /* mem_tell */ static sf_count_t @@ -571,7 +575,7 @@ mem_get_filelen(void *datasource) { file_reader_t *fr = (file_reader_t*)datasource; return fr->len; -} +} /* mem_get_filelen */ static sound_stream_t * @@ -610,7 +614,7 @@ load_aiff(FILE *fp, long startpos, long length, int id, float volume, int repeat aiff->sf_info.channels * sizeof(float)); return (sound_stream_t*) aiff; -} +} /* load_aiff */ @@ -675,7 +679,7 @@ process_engine(sound_engine_t *e) } } } -} +} /* process_engine */ static void* @@ -709,7 +713,7 @@ audio_loop(void*v) ao_play(device, (char*)buf, outsize); } return 0; -} +} /* audio_loop */ static void @@ -725,7 +729,7 @@ sound_halt_aiff(void) free(s); } } -} +} /* sound_halt_aiff */ static void @@ -741,7 +745,7 @@ sound_halt_mod(void) free(s); } } -} +} /* sound_halt_mod */ static void @@ -757,7 +761,7 @@ sound_halt_ogg(void) free(s); } } -} +} /* sound_halt_ogg */ static sound_stream_t *load_mod(FILE *fp, long startpos, int id, float volume); @@ -771,7 +775,7 @@ sound_stop_id(int id) frotz_audio.event.type = EVENT_STOP_STREAM; frotz_audio.event.data.i = id; ux_sem_post(&frotz_audio.ev_pending); -} +} /* sound_stop_id */ static void @@ -787,7 +791,7 @@ sound_stop_id_real(sound_engine_t *e, int id) free(s); } } -} +} /* sound_stop_id_real */ static void @@ -797,7 +801,7 @@ sound_enqueue(sound_stream_t *s) frotz_audio.event.type = EVENT_START_STREAM; frotz_audio.event.data.e = s; ux_sem_post(&frotz_audio.ev_pending); -} +} /* sound_enqueue */ static void @@ -828,7 +832,7 @@ sound_enqueue_real(sound_engine_t *e, sound_stream_t *s) e->voices[i].repid = 0; break; } -} +} /* sound_enqueue_real */ static float @@ -840,7 +844,7 @@ volume_factor(int vol) if (vol > 8) vol = 8; return lut[vol-1]; /* return powf(2, vol - 8); */ -} +} /* volume_factor */ /********************************************************************** @@ -884,7 +888,7 @@ os_init_sound(void) fprintf(stderr, "Can't create audio thread :[%s]", strerror(err)); os_quit(EXIT_FAILURE); } -} +} /* os_init_sound */ /* @@ -945,7 +949,7 @@ os_start_sample(int number, int volume, int repeats, zword eos) if (s) sound_enqueue(s); -} +} /* os_start_sample */ void os_beep(int bv) @@ -956,7 +960,7 @@ void os_beep(int bv) /* low frequency for bv=2 */ /* fprintf(audio_log, "os_beep(%d)...\n", bv); */ beep(); -} +} /* os_beep */ void os_prepare_sample(int id) @@ -964,7 +968,7 @@ void os_prepare_sample(int id) (void) id; /* Currently not implemented */ /* fprintf(audio_log, "os_prepare_sample(%d)...\n", id); */ -} +} /* os_prepare_sample */ void os_stop_sample(int id) @@ -972,12 +976,13 @@ void os_stop_sample(int id) /* fprintf(audio_log, "os_stop_sample(%d)...\n", id); */ if (!f_setup.sound) return; sound_stop_id(id); -} +} /* os_stop_sample */ + void os_finish_with_sample(int id) { /* fprintf(audio_log, "os_finish_with_sample(%d)...\n", id); */ os_stop_sample(id); -} +} /* os_finish_with_sample */ #endif /* NO_SOUND */ diff --git a/src/curses/ux_audio_oss.c b/src/curses/ux_audio_oss.c index fd322dd..a4fac72 100644 --- a/src/curses/ux_audio_oss.c +++ b/src/curses/ux_audio_oss.c @@ -79,11 +79,13 @@ static void sigterm_handler(int signal) { if (mixer_fd >= 0) ioctl(mixer_fd, SOUND_MIXER_WRITE_VOLUME, &old_volume); _exit(EXIT_SUCCESS); -} +} /* sigterm_handler */ + static void oss_sigint_handler(int signal) { num_repeats = 1; -} +} /* oss_sigint_handler */ + static void play_sound(int volume, int repeats) { struct sigaction sa; @@ -166,7 +168,7 @@ finish: if (mixer_fd >= 0) ioctl(mixer_fd, SOUND_MIXER_WRITE_VOLUME, &old_volume); _exit(EXIT_SUCCESS); -} +} /* play_sound */ /* @@ -176,7 +178,6 @@ finish: * or low-pitched (number == 2). * */ - void os_beep (int number) { /* This should later be expanded to support high and low beeps. */ @@ -191,7 +192,6 @@ void os_beep (int number) * Load the sample from the disk. * */ - void os_prepare_sample (int number) { FILE *samples; @@ -276,7 +276,7 @@ static void sigchld_handler(int signal) { sa.sa_flags = 0; sigaction(SIGCHLD, &sa, NULL); end_of_sound(); -} +} /* sigchld_handler */ /* @@ -290,7 +290,6 @@ static void sigchld_handler(int signal) { * as the sound finishes. * */ - void os_start_sample (int number, int volume, int repeats, zword eos) { /* INCOMPLETE */ @@ -351,7 +350,7 @@ static void stop_player(int signal) { sigaction(SIGCHLD, &sa, NULL); sigprocmask(SIG_UNBLOCK, &sigchld_mask, NULL); -} +} /* stop_player */ /* @@ -374,7 +373,6 @@ void os_stop_sample (int number) * Remove the current sample from memory (if any). * */ - void os_finish_with_sample (int number) { /* INCOMPLETE */ @@ -390,7 +388,6 @@ void os_finish_with_sample (int number) * Stop repeating the current sample and wait until it finishes. * */ - void os_wait_sample (void) { stop_player(SIGINT); diff --git a/src/curses/ux_blorb.c b/src/curses/ux_blorb.c index d642c6d..a23947f 100644 --- a/src/curses/ux_blorb.c +++ b/src/curses/ux_blorb.c @@ -141,7 +141,7 @@ bb_err_t ux_blorb_init(char *filename) } return blorb_err; -} +} /* ux_blorb_init */ #endif @@ -162,7 +162,7 @@ void ux_blorb_stop(void) #else return; #endif -} +} /* ux_blorb_stop */ /* @@ -197,5 +197,5 @@ static int isblorb(FILE *fp) return FALSE; return TRUE; -} +} /* isblorb */ #endif diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index cad4549..8affb6a 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -707,7 +707,7 @@ FILE *os_path_open(const char *name, const char *mode) return fp; } return NULL; /* give up */ -} /* os_path_open() */ +} /* os_path_open */ /* @@ -1041,7 +1041,7 @@ static int getemph(char *value) return EMPHASIS_NONE; return EMPHASIS_ITALIC; -} +} /* getemph */ /* @@ -1145,7 +1145,7 @@ static int geterrmode(char *value) return ERR_REPORT_FATAL; return ERR_DEFAULT_REPORT_MODE; -} /* geterrmode() */ +} /* geterrmode */ /* @@ -1160,7 +1160,7 @@ static void sigwinch_handler(int UNUSED(sig)) { terminal_resized = 1; signal(SIGWINCH, sigwinch_handler); -} +} /* sigwinch_handler */ /* @@ -1224,6 +1224,7 @@ char *my_strrchr(const char *s, int c) } /* my_strrchr */ #endif /* NO_STRRCHR */ + static void usage(void) { printf("FROTZ V%s - Curses interface. ", VERSION); @@ -1235,7 +1236,8 @@ static void usage(void) puts(INFORMATION); puts(INFO2); return; -} +} /* usage */ + static void print_version(void) { diff --git a/src/curses/ux_screen.c b/src/curses/ux_screen.c index 950d34d..c3f6ffb 100644 --- a/src/curses/ux_screen.c +++ b/src/curses/ux_screen.c @@ -192,7 +192,7 @@ void unix_suspend_program(void) save_screen(); raise(SIGTSTP); resize_restore_screen(); -} +} /* unix_suspend_program */ /** @@ -252,13 +252,15 @@ zlong RGB5ToTrue(zword w) _g = (_g << 3) | (_g >> 2); _b = (_b << 3) | (_b >> 2); return (zlong) (_r | (_g << 8) | (_b << 16)); -} +} /* RGB5ToTrue */ + + /* Move to a static inline in ux_frotz.h later */ zword TrueToRGB5(zlong u) { return (zword) (((u >> 3) & 0x001f) | ((u >> 6) & 0x03e0) | ((u >> 9) & 0x7c00)); -} +} /* TrueToRGB5 */ /* @@ -294,7 +296,7 @@ int os_from_true_colour(zword colour) default: return 1; /* Can't happen */ } } -} +} /* os_from_true_colour */ /* @@ -323,4 +325,4 @@ zword os_to_true_colour(int index) case 12: return 0x2D6B; default: return 0x0000; } -} +} /* os_to_true_colour */ diff --git a/src/curses/ux_text.c b/src/curses/ux_text.c index bbf9204..157a22d 100644 --- a/src/curses/ux_text.c +++ b/src/curses/ux_text.c @@ -322,7 +322,7 @@ int os_check_unicode(int UNUSED(font), zchar UNUSED(c)) { /* Assume full input and output. */ return 3; -} +} /* os_check_unicode */ /*