From: David Griffith Date: Sun, 30 Apr 2023 23:12:08 +0000 (-0700) Subject: Added function name comment to end of each function in src/sdl/. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=4af454a1ea1bb7119eef3110e9023b6d8161c5cc;p=liskon_frotz.git Added function name comment to end of each function in src/sdl/. 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/sdl/generic.c b/src/sdl/generic.c index e2e1f18..01ef498 100644 --- a/src/sdl/generic.c +++ b/src/sdl/generic.c @@ -64,7 +64,7 @@ static int isblorb(FILE * fp) return 0; return 1; -} +} /* isblorb */ /* @@ -152,7 +152,7 @@ bb_err_t gen_blorb_init(char *filename) } return blorb_err; -} +} /* gen_blorb_init */ /* @@ -193,7 +193,7 @@ FILE *os_load_story(void) fseek(fp, blorb_res.data.startpos, SEEK_SET); return fp; -} +} /* os_load_story */ /* @@ -225,7 +225,7 @@ int os_storyfile_seek(FILE * fp, long offset, int whence) } else { return fseek(fp, offset, whence); } -} +} /* os_storyfile_seek */ /* @@ -243,7 +243,7 @@ int os_storyfile_tell(FILE * fp) } else { return ftell(fp); } -} +} /* os_storyfile_tell */ static void print_c_string(const char *s) @@ -253,7 +253,7 @@ static void print_c_string(const char *s) while ((c = *s++) != 0) { os_display_char(c); } -} +} /* print_c_string */ /* @@ -289,7 +289,7 @@ void os_warn(const char *s, ...) print_c_string("(truncated)\n"); new_line(); os_set_text_style(style); -} +} /* os_warn */ size_t zcharstrlen(zchar * str) @@ -300,7 +300,7 @@ size_t zcharstrlen(zchar * str) ret++; } return ret; -} +} /* zcharstrlen */ zchar *zcharstrcpy(zchar * dest, zchar * src) @@ -312,7 +312,7 @@ zchar *zcharstrcpy(zchar * dest, zchar * src) dest[i] = 0; return dest; -} +} /* zcharstrcpy */ int zcharstrncmp(zchar * s1, zchar * s2, size_t n) @@ -327,7 +327,7 @@ int zcharstrncmp(zchar * s1, zchar * s2, size_t n) return 0; } return 0; -} +} /* zcharstrncmp */ zchar *zcharstrdup(zchar * src) @@ -336,7 +336,7 @@ zchar *zcharstrdup(zchar * src) if (dest) zcharstrcpy(dest, src); return dest; -} +} /* zcharstrdup */ /* These are useful for circular buffers. @@ -363,7 +363,7 @@ void gen_add_to_history(zchar * str) history_view = history_next; /* Reset user frame after each line */ return; -} +} /* gen_add_to_history */ /** @@ -372,7 +372,7 @@ void gen_add_to_history(zchar * str) void gen_history_reset() { history_view = history_next; -} +} /* gen_history_reset */ /** @@ -397,7 +397,7 @@ int gen_history_back(zchar * str, int searchlen, int maxlen) && zcharstrncmp(str, *history_view, searchlen))); zcharstrcpy(str + searchlen, *history_view + searchlen); return 1; -} +} /* gen_history_back */ /** @@ -421,4 +421,4 @@ int gen_history_forward(zchar * str, int searchlen, int maxlen) && zcharstrncmp(str, *history_view, searchlen))); zcharstrcpy(str + searchlen, *history_view + searchlen); return 1; -} +} /* gen_history_forward */ diff --git a/src/sdl/sf_font3.c b/src/sdl/sf_font3.c index 9d7f988..a3e6bfe 100644 --- a/src/sdl/sf_font3.c +++ b/src/sdl/sf_font3.c @@ -151,7 +151,7 @@ static SF_glyph * mygetglyph(SFONT *s, zword c, int allowdef) memmove(&(myglyph.bitmap[0]),src,8); myglyph.h = 8; return (SF_glyph *)&myglyph; -} +} /* mygetglyph */ static SFONT myfont3 = { @@ -189,7 +189,7 @@ static SF_glyph * mygetglyph2(SFONT *s, zword c, int allowdef) } myglyph.h = 16; return (SF_glyph *)&myglyph; -} +} /* mygetglyph2 */ static SFONT myfont3dbl = { diff --git a/src/sdl/sf_ftype.c b/src/sdl/sf_ftype.c index 0c28238..4ed6032 100644 --- a/src/sdl/sf_ftype.c +++ b/src/sdl/sf_ftype.c @@ -58,7 +58,7 @@ static void bdestroy(SFONT * s) FT_Done_Face(f->face); free(s); } -} +} /* bdestroy */ static int bheight(SFONT * s) @@ -66,7 +66,7 @@ static int bheight(SFONT * s) if (s) return ((MYFONT *) s)->height; return 0; -} +} /* bheight */ static int bascent(SFONT * s) @@ -74,7 +74,7 @@ static int bascent(SFONT * s) if (s) return ((MYFONT *) s)->ascent; return 0; -} +} /* bascent */ static int bdescent(SFONT * s) @@ -82,7 +82,7 @@ static int bdescent(SFONT * s) if (s) return ((MYFONT *) s)->descent; return 0; -} +} /* bdescent */ static int bminchar(SFONT * s) @@ -90,7 +90,7 @@ static int bminchar(SFONT * s) if (s) return ((MYFONT *) s)->minchar; return 0; -} +} /* bminchar */ static int bmaxchar(SFONT * s) @@ -98,7 +98,7 @@ static int bmaxchar(SFONT * s) if (s) return ((MYFONT *) s)->maxchar; return 0; -} +} /* bmaxchar */ static void setglyph(MYFONT * f, FT_Face face, int ch); @@ -118,13 +118,13 @@ static SF_glyph *getglyph(SFONT * s, zword c, int allowdef) return f->glyphs[c]; } return NULL; -} +} /* getglyph */ static int hasglyph(SFONT * fo, zword c, int allowdef) { return (getglyph(fo, c, allowdef) != NULL); -} +} /* hasglyph */ static int inited = 0, initerr = 0; @@ -136,7 +136,7 @@ static void libfinish() return; FT_Done_FreeType(library); inited = 0; -} +} /* libfinish */ static void libinit() @@ -153,7 +153,7 @@ static void libinit() inited = 1; atexit(libfinish); } -} +} /* libinit */ static MYFONT *makefont(int totglyphs) @@ -178,7 +178,7 @@ static MYFONT *makefont(int totglyphs) res->totglyphs = totglyphs; res->maxchar = totglyphs - 1; return res; -} +} /* makefont */ #define MAXUNI 0xffff @@ -226,7 +226,7 @@ static void setglyph(MYFONT * f, FT_Face face, int ch) res->yof = slot->bitmap_top - bitmap->rows + 1; f->glyphs[ch] = res; -} +} /* setglyph */ static SFONT *loadftype(char *fname, int size, SFONT * like, int *err) @@ -295,7 +295,7 @@ static SFONT *loadftype(char *fname, int size, SFONT * like, int *err) setglyph(res, face, 0x153); return (SFONT *) res; -} +} /* loadftype */ #ifdef WIN32 @@ -336,11 +336,11 @@ SFONT *sf_loadftype(char *fspec, SFONT * like, int *err) return NULL; return loadftype(fn, size, like, err); -} +} /* sf_loadftype */ /****************************************/ void sf_initloader() { ttfontloader = sf_loadftype; -} +} /* sf_initloader */ diff --git a/src/sdl/sf_images.c b/src/sdl/sf_images.c index 0a5deea..819a2e0 100644 --- a/src/sdl/sf_images.c +++ b/src/sdl/sf_images.c @@ -54,7 +54,7 @@ zlong sf_blend(int a, zlong s, zlong d) [(toLinear[s & 0xff] * a + toLinear[d & 0xff] * (256 - a)) >> 8]) << 16; return r; -} +} /* sf_blend */ /* Set the screen gamma and build gamma correction tables */ @@ -68,7 +68,7 @@ void sf_setgamma(double gamma) gamma = 1.0 / gamma; for (i = 0; i < 256; i++) fromLinear[i] = (int)((pow(i / 255.0, gamma) * 255.0) + 0.5); -} +} /* sf_setgamma */ /**************************************************************************** * Loader for PNG images @@ -86,7 +86,7 @@ static void readPNGData(png_structp png_ptr, png_bytep data, png_size_t length) PNGData *pngData = (PNGData *) png_get_io_ptr(png_ptr); memmove(data, pngData->gfxData + pngData->offset, length); pngData->offset += length; -} +} /* readPNGData */ static int loadpng(zbyte * data, int length, sf_picture * graphic) @@ -227,7 +227,8 @@ static int loadpng(zbyte * data, int length, sf_picture * graphic) free(rowPointers); return 1; -} /* loadpng */ +} /* loadpng * / + /**************************************************************************** * Loader for JPEG images @@ -248,27 +249,27 @@ static void errorJPEGExit(j_common_ptr cinfo) struct JPEGErrorInfo *error = (struct JPEGErrorInfo *)cinfo->err; (*cinfo->err->output_message) (cinfo); longjmp(error->errorJump, 1); -} +} /* errorJPEGExit */ static void outputJPEGMessage(j_common_ptr cinfo) { char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) (cinfo, buffer); -} +} /* outputJPEGMessage */ /* Memory Data Source */ static void memJPEGInit(j_decompress_ptr unused) { /* Nothing here */ -} +} /* memJPEGInit */ static int memJPEGFillInput(j_decompress_ptr unused) { return 0; -} +} /* memJPEGFillInput */ static void memJPEGSkipInput(j_decompress_ptr cinfo, long num_bytes) @@ -280,13 +281,13 @@ static void memJPEGSkipInput(j_decompress_ptr cinfo, long num_bytes) cinfo->src->next_input_byte += num_bytes; cinfo->src->bytes_in_buffer -= num_bytes; } -} +} /* memJPEGSkipInput */ static void memJPEGTerm(j_decompress_ptr unused) { /* Nothing here */ -} +} /* memJPEGTerm */ static int loadjpeg(zbyte * data, int length, sf_picture * graphic) @@ -360,7 +361,7 @@ static int loadjpeg(zbyte * data, int length, sf_picture * graphic) jpeg_destroy_decompress(&info); return 1; -} +} /* loadjpeg */ /**************************************************************************** * Loader for simple rectangles @@ -375,7 +376,7 @@ static int loadrect(zbyte * data, int length, sf_picture * graphic) (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7]; graphic->pixels = NULL; return 1; -} +} /* loadrect */ /*****************************/ @@ -433,7 +434,7 @@ static void cacheflush() cached[i].pixels = NULL; } cacheinited = 0; -} +} /* cacheflush */ static void cacheinit() @@ -447,7 +448,7 @@ static void cacheinit() cached[i].pixels = NULL; } cacheinited = 1; -} +} /* cacheinit */ static sf_picture *cachefind(int n) @@ -464,7 +465,7 @@ static sf_picture *cachefind(int n) return (cached + 0); } return NULL; -} +} /* cachefind */ sf_picture *sf_getpic(int num) @@ -479,4 +480,4 @@ sf_picture *sf_getpic(int num) if (sf_loadpic(num, res)) return res; return NULL; -} +} /* sf_getpic */ diff --git a/src/sdl/sf_msg_en.c b/src/sdl/sf_msg_en.c index 060c2f9..96b15ea 100644 --- a/src/sdl/sf_msg_en.c +++ b/src/sdl/sf_msg_en.c @@ -93,4 +93,4 @@ const char *sf_msgstring(int id) } return p; -} +} /* sf_msgstring */ diff --git a/src/sdl/sf_osfdlg.c b/src/sdl/sf_osfdlg.c index c2910a8..6b10af1 100644 --- a/src/sdl/sf_osfdlg.c +++ b/src/sdl/sf_osfdlg.c @@ -70,7 +70,7 @@ STATIC void updatelist() First = 0; selected = NULL; drawlist(); -} +} /* updatelist */ STATIC void goright(); STATIC void goleft(); @@ -87,7 +87,7 @@ STATIC void goup() updatelist(); } else strcat(lastdir, "/"); -} +} /* goup */ typedef struct { int x, y, w, h; /* internal */ @@ -132,7 +132,7 @@ STATIC void frame_upframe(int x, int y, int w, int h) v = O_GRAY1; sf_chline(x, y + h, v, w--); sf_cvline(x + w, y, v, h); -} +} /* frame_upframe */ STATIC void frame_downframe(int x, int y, int w, int h) @@ -151,7 +151,7 @@ STATIC void frame_downframe(int x, int y, int w, int h) v = O_GRAY3; sf_chline(x, y + h, v, w--); sf_cvline(x + w, y, v, h); -} +} /* frame_downframe */ /* internal coords */ STATIC int addarea(int x, int y, int w, int h, zword(*click) (int, int)) @@ -164,14 +164,14 @@ STATIC int addarea(int x, int y, int w, int h, zword(*click) (int, int)) a->click = click; a->back = O_GRAY2; return nbareas++; -} +} /* addarea */ STATIC void clarea(int n) { BAREA *a = bareas + n; sf_fillrect(a->back, a->x, a->y, a->w, a->h); -} +} /* clarea */ #ifdef USE_UTF8 @@ -204,7 +204,7 @@ error: } *out = ch; return idx; -} +} /* utf8_to_zchar */ STATIC size_t utf8_len(const char *str) @@ -215,7 +215,7 @@ STATIC size_t utf8_len(const char *str) ret++; } return ret; -} +} /* utf8_len */ #endif /* USE_UTF8 */ @@ -254,7 +254,7 @@ STATIC void writetext(zlong color, const char *s, int x, int y, int w, } #endif sf_setclip(ox, oy, ow, oh); -} +} /* writetext */ STATIC int addbutton(int x, int y, int w, int h, char *text, @@ -267,7 +267,7 @@ STATIC int addbutton(int x, int y, int w, int h, char *text, if (text) writetext(0, text, x, y, w, 1); return b; -} +} /* addbutton */ static int B_up, B_ok, B_cancel; static int A_dir, A_filter, A_entry, A_list; @@ -285,7 +285,7 @@ STATIC void showfilename(int pos) os_font_data(0, &height, &width); sf_cvline(a->x + width * pos, a->y, O_BLACK, height); } -} +} /* showfilename */ STATIC void clicked(BAREA * a) @@ -295,7 +295,7 @@ STATIC void clicked(BAREA * a) sf_sleep(100); frame_upframe(a->x - 2, a->y - 2, a->w + 4, a->h + 4); sf_flushdisplay(); -} +} /* clicked */ STATIC zword checkmouse(int i0) @@ -314,26 +314,26 @@ STATIC zword checkmouse(int i0) } } return 0; -} +} /* checkmouse */ STATIC zword Zup(int x, int y) { goup(); return 0; -} +} /* Zup */ STATIC zword Zok(int x, int y) { return ZC_RETURN; -} +} /* Zok */ STATIC zword Zcanc(int x, int y) { return ZC_ESCAPE; -} +} /* Zcanc */ STATIC zword Zselect(int x, int y); STATIC zword yesnoover(int xc, int yc); @@ -358,7 +358,7 @@ STATIC zword inputkey(bool text) } } return c; -} +} /* inputkey */ int (*sf_sysdialog)(bool existing, const char *def, const char *filt, const char *tit, char **res) = NULL; @@ -533,13 +533,13 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt, } return SF_NOTIMP; -} +} /* myosdialog */ void sf_setdialog(void) { sf_osdialog = myosdialog; -} +} /* sf_setdialog */ /*********************************/ @@ -576,7 +576,7 @@ STATIC int myfnmatch(const char *pattern, const char *p, int dummy) if (lp < lpat) return 1; /* too short */ return strcmp(pattern, p + lp - lpat); -} +} /* myfnmatch */ STATIC void cleanlist(ENTRY * t) @@ -588,7 +588,7 @@ STATIC void cleanlist(ENTRY * t) free(t); t = n; } -} +} /* cleanlist */ STATIC ENTRY *newentry(char *s) @@ -603,7 +603,7 @@ STATIC ENTRY *newentry(char *s) } } return r; -} +} /* newentry */ STATIC void addentry(char *s, ENTRY ** ae) @@ -633,7 +633,7 @@ STATIC void addentry(char *s, ENTRY ** ae) } } } -} +} /* addentry */ STATIC char *resolvedir(char *dir, char *res, int size) @@ -658,7 +658,7 @@ STATIC char *resolvedir(char *dir, char *res, int size) } } return p; -} +} /* resolvedir */ static void exhaust(ENTRY * e, ENTRY ** resp, int *n) @@ -670,7 +670,7 @@ static void exhaust(ENTRY * e, ENTRY ** resp, int *n) *resp = e; (*n)++; exhaust(e->right, resp, n); -} +} /* exhaust */ STATIC ENTRY *dodir(char *dirname, char *pattern, char *resdir, int size, @@ -736,7 +736,7 @@ STATIC ENTRY *dodir(char *dirname, char *pattern, char *resdir, int size, } return res; -} +} /* dodir */ #ifdef USE_UTF8 @@ -752,7 +752,7 @@ STATIC int utf8_char_pos(char *s, int pos) idx++; } return cpos; -} +} /* utf8_char_pos */ #endif @@ -876,7 +876,7 @@ STATIC void drawit(int x, int y, ENTRY * e, int w, int issub) } else color = O_BLACK; writetext(color, s, x, y, w, 0); -} +} /* drawit */ static int Nrows, Ncols, Ewid, Fh; @@ -926,7 +926,7 @@ STATIC void drawnames(int x, int y, int w, int h, ENTRY * files, int first, ewid, i < nsub); files = files->right; } -} +} /* drawnames */ STATIC void drawlist() @@ -938,7 +938,7 @@ STATIC void drawlist() drawnames(a->x, a->y, a->w, a->h, curdir, First, Numdirs, Numtot, 21 * 8); -} +} /* drawlist */ STATIC void goright() @@ -947,7 +947,7 @@ STATIC void goright() return; First += Nrows; drawlist(); -} +} /* goright */ STATIC void goleft() @@ -956,7 +956,7 @@ STATIC void goleft() return; First -= Nrows; drawlist(); -} +} /* goleft */ STATIC ENTRY *filesat(int n) @@ -967,7 +967,7 @@ STATIC ENTRY *filesat(int n) e = e->right; } return e; -} +} /* filesat */ STATIC zword Zselect(int x, int y) @@ -998,7 +998,7 @@ STATIC zword Zselect(int x, int y) showfilename(-1); drawlist(); return 0; -} +} /* Zselect */ extern void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh); @@ -1057,7 +1057,7 @@ zword sf_yesnooverlay(int xc, int yc, char *t, int saverest) nbareas = nsav; return c; -} +} /* sf_yesnooverlay */ STATIC zword yesnoover(int xc, int yc) @@ -1068,7 +1068,7 @@ STATIC zword yesnoover(int xc, int yc) drawlist(); return c; -} +} /* yesnoover */ /* this is needed for overlapping source and dest in Zentry @@ -1077,7 +1077,7 @@ STATIC zword yesnoover(int xc, int yc) static void mystrcpy(char *d, const char *s) { while ((*d++ = *s++)) ; -} +} /* mystrcpy */ STATIC zword Zentry(int x, int y) @@ -1214,4 +1214,4 @@ STATIC zword Zentry(int x, int y) } showfilename(-1); return c; -} +} /* Zentry */ diff --git a/src/sdl/sf_resource.c b/src/sdl/sf_resource.c index e3309dd..211ae7f 100644 --- a/src/sdl/sf_resource.c +++ b/src/sdl/sf_resource.c @@ -95,7 +95,7 @@ static void checkwidths() if ((reso->py) && (reso->py >= AcHeight)) AcHeight = reso->py; } -} +} /* checkwidths */ static void sf_cleanup_resources(void) @@ -106,7 +106,7 @@ static void sf_cleanup_resources(void) if (blorb_fp) fclose(blorb_fp); blorb_fp = NULL; -} +} /* sf_cleanup_resources */ static void load_local_resources(void); @@ -141,7 +141,7 @@ int sf_load_resources(void) load_local_resources(); return 0; -} +} /* sf_load_resources */ /* @@ -249,7 +249,7 @@ int os_picture_data(int picture, int *height, int *width) *height = 0; *width = 0; return 0; -} +} /* os_picture_data */ /* @@ -275,7 +275,7 @@ void os_menu(int action, int menu, const zword * text) theWnd->RemoveMenu(menu); break; }*/ -} +} /* os_menu */ /* @@ -293,7 +293,7 @@ int os_random_seed(void) return ((int)(time(NULL))) & 32767; } return m_random_seed; -} +} /* os_random_seed */ /* The following assumes Unicode */ @@ -321,7 +321,7 @@ void os_scrollback_char(zword c) putchar(0x80 + (c & 0x3f)); } } -} +} /* os_scrollback_char */ /* @@ -335,7 +335,7 @@ void os_scrollback_erase(int erase) if (option_scrollback_buffer) while (erase--) putchar(8); -} +} /* os_scrollback_erase */ /* @@ -360,7 +360,7 @@ void os_restart_game(int stage) sf_read_key(0, false, false, false); } } -} +} /* os_restart_game */ #define DEFAULT_GAMMA 2.2 @@ -389,7 +389,7 @@ void sf_initcolours() m_nonStdColours[i] = 0xFFFFFFFF; m_nonStdIndex = 0; -} +} /* sf_initcolours */ /* Read in settings */ @@ -473,7 +473,7 @@ void sf_readsettings(void) } sf_FinishProfile(); -} +} /* sf_readsettings */ /* Get a colour */ @@ -495,7 +495,7 @@ zlong sf_GetColour(int colour) return m_nonStdColours[colour - 18]; } return m_colours[0]; -} +} /* sf_GetColour */ /* Get a default colour */ @@ -504,7 +504,7 @@ zlong sf_GetDefaultColour(bool fore) if (m_IsInfocomV6) return sf_GetColour(fore ? WHITE_COLOUR : BLACK_COLOUR); return fore ? m_defaultFore : m_defaultBack; -} +} /* sf_GetColour */ /* Get an index for a non-standard colour */ @@ -541,7 +541,7 @@ int sf_GetColourIndex(zlong colour) m_nonStdIndex = 0; } return index; -} +} /* sf_GetColourIndex */ /* @@ -586,7 +586,7 @@ void os_set_colour(int new_foreground, int new_background) ts->back = sf_GetColour(new_background); ts->backDefault = (new_background == 1); ts->backTransparent = (new_background == 15); -} +} /* os_set_colour */ /* @@ -598,7 +598,7 @@ void os_set_colour(int new_foreground, int new_background) int os_from_true_colour(zword colour) { return sf_GetColourIndex(RGB5ToTrue(colour)); -} +} /* os_from_true_colour */ /* @@ -610,7 +610,7 @@ int os_from_true_colour(zword colour) zword os_to_true_colour(int index) { return TrueToRGB5(sf_GetColour(index)); -} +} /* os_to_true_colour */ /* @@ -744,7 +744,7 @@ void os_init_screen(void) hx_fore_colour = TrueToRGB5(sf_GetDefaultColour(true)); hx_back_colour = TrueToRGB5(sf_GetDefaultColour(false)); } -} +} /* os_init_screen */ static void print_c_string (const char *s) @@ -798,7 +798,7 @@ void os_fatal(const char *s, ...) } sf_cleanup_all(); os_quit(EXIT_FAILURE); -} +} /* os_fatal */ /* If true, running one of Infocom's V6 games */ @@ -814,7 +814,7 @@ bool sf_IsInfocomV6() break; } return false; -} +} /* sf_IsInfocomV6 */ /* If true, this picture has an adaptive palette */ @@ -841,7 +841,7 @@ bool sf_IsAdaptive(int picture) } bb_unload_chunk(blorb_map, result.chunknum); return adaptive; -} +} /* sf_IsAdaptive */ #define LOCAL_MEM -1 @@ -869,7 +869,7 @@ void sf_freeresource(myresource * res) if ((blorb_map) && (cnu >= 0)) bb_unload_chunk(blorb_map, cnu); -} +} /* sf_freeresource */ static FILE *findlocal(int ispic, int num, int *size) @@ -887,7 +887,7 @@ static FILE *findlocal(int ispic, int num, int *size) *size = ftell(f); fseek(f, 0, SEEK_SET); return f; -} +} /* findlocal */ static FILE *findfromlist(int ispic, int num, int *size); @@ -943,7 +943,7 @@ static int loadlocal(int num, int ispic, int method, myresource * res) } return bb_err_None; -} +} /* loadlocal */ int sf_getresource(int num, int ispic, int method, myresource * res) @@ -973,7 +973,8 @@ int sf_getresource(int num, int ispic, int method, myresource * res) res->file = blorb_fp; } return st; -} +} /* sf_getresource */ + /***************/ @@ -1001,7 +1002,7 @@ static void cleanLLENTRY(LLENTRY * e) free(e); e = n; } -} +} /* cleanLLENTRY */ static void cleanlocallist() @@ -1010,7 +1011,7 @@ static void cleanlocallist() Lpics = NULL; cleanLLENTRY(Lsnds); Lsnds = NULL; -} +} /* cleanlocal */ static int parseline(char *s) @@ -1046,7 +1047,7 @@ static int parseline(char *s) return -1; p_name = p; return 1; -} +} /* parseline */ static void load_local_resources(void) @@ -1089,7 +1090,7 @@ static void load_local_resources(void) if (numlocal) m_localfiles = 1; fclose(f); -} +} /* load_local_resources */ static FILE *findfromlist(int ispic, int num, int *size) @@ -1120,7 +1121,7 @@ static FILE *findfromlist(int ispic, int num, int *size) *size = ftell(f); fseek(f, 0, SEEK_SET); return f; -} +} /* findfromlist */ void os_init_setup(void) @@ -1129,4 +1130,4 @@ void os_init_setup(void) sf_setdialog(); sf_initloader(); sdl_active = FALSE; -} +} /* os_init_setup */ diff --git a/src/sdl/sf_sig.c b/src/sdl/sf_sig.c index 16ad9ff..a41cde2 100644 --- a/src/sdl/sf_sig.c +++ b/src/sdl/sf_sig.c @@ -35,7 +35,8 @@ static void resethandlers() signal(SIGINT, SIG_DFL); signal(SIGFPE, SIG_DFL); signal(SIGSEGV, SIG_DFL); -} +} /* resethandlers */ + static const char *signame(int sig) { @@ -49,20 +50,22 @@ static const char *signame(int sig) default: return ""; } -} +} /* signame */ + static void myhandler(int s) { resethandlers(); os_fatal("Signal %d received %s", s, signame(s)); -} +} /* myhandler */ + void sf_installhandlers() { signal(SIGINT, myhandler); signal(SIGFPE, myhandler); signal(SIGSEGV, myhandler); -} +} /* sf_installhandlers */ #else @@ -104,7 +107,7 @@ static char *getsigname(int s) i++; } return NULL; -} +} /* getsigname */ static void bt_sighandler(int sig, siginfo_t * info, void *secret) { @@ -144,7 +147,8 @@ static void bt_sighandler(int sig, siginfo_t * info, void *secret) } os_quit(EXIT_SUCCESS); -} +} /* bt_sighandler */ + void sf_installhandlers() { @@ -162,6 +166,6 @@ void sf_installhandlers() sigaction(SIGINT, &sa, NULL); sigaction(SIGILL, &sa, NULL); -} +} /* sf_installhandlers */ #endif diff --git a/src/sdl/sf_sound.c b/src/sdl/sf_sound.c index b045724..dc3e9cc 100644 --- a/src/sdl/sf_sound.c +++ b/src/sdl/sf_sound.c @@ -89,7 +89,8 @@ static void finishaudio() e_sfx = e_mod = NULL; Mix_CloseAudio(); -} +} /* finishaudio */ + static void music_finished(void); static void channel_finished(int channel); @@ -101,7 +102,8 @@ static void channel_finished(int channel); */ void os_init_sound() { -} +} /* os_init_sound */ + int sf_initsound() { @@ -129,7 +131,7 @@ int sf_initsound() Mix_AllocateChannels(1); CLEANREG(finishaudio); return 1; -} +} /* sf_initsound */ static void baredestroy(EFFECT * r) @@ -141,7 +143,7 @@ static void baredestroy(EFFECT * r) Mix_FreeChunk(r->sam); free(r); } -} +} /* baredestroy */ static EFFECT *new_effect(int type, int num) @@ -153,7 +155,7 @@ static EFFECT *new_effect(int type, int num) reader->destroy = baredestroy; } return (EFFECT *) reader; -} +} /* new_effect */ /* According to specs, this is only called when music ends "naturally", @@ -167,7 +169,7 @@ static void music_finished(void) return; e_mod->active = 0; e_mod->ended = 1; -} +} /* music_finished */ /* This may be called also via a Mix_Haltetc. */ @@ -181,7 +183,7 @@ static void channel_finished(int channel) return; e_sfx->active = 0; e_sfx->ended = 1; /* stopsample will take care of this... */ -} +} /* channel_finished */ static void stopsample() @@ -193,7 +195,7 @@ static void stopsample() e_sfx->active = 0; Mix_HaltChannel(0); e_sfx->ended = 0; -} +} /* stopsample */ static void stopmodule() @@ -203,7 +205,7 @@ static void stopmodule() e_mod->active = 0; Mix_HaltMusic(); e_mod->ended = 0; -} +} /* stopmodule */ static void startsample() @@ -213,7 +215,7 @@ static void startsample() Mix_PlayChannel(0, e_sfx->sam, e_sfx->repeats); Mix_Volume(0, e_sfx->volume); e_sfx->active = 1; -} +} /* startsample */ static void startmodule() @@ -223,7 +225,7 @@ static void startmodule() Mix_PlayMusic(e_mod->mod, e_mod->repeats); Mix_VolumeMusic(e_mod->volume); e_mod->active = 1; -} +} /* startmodule */ static EFFECT *getaiff(FILE * f, size_t pos, int len, int num) @@ -240,7 +242,7 @@ static EFFECT *getaiff(FILE * f, size_t pos, int len, int num) return NULL; } return res; -} +} /* getaiff */ static EFFECT *getmodule(FILE * f, size_t pos, int len, int num) @@ -274,7 +276,7 @@ static EFFECT *getmodule(FILE * f, size_t pos, int len, int num) return NULL; } return res; -} +} /* getmodule */ static EFFECT *geteffect(int num) @@ -306,7 +308,8 @@ static EFFECT *geteffect(int num) sf_freeresource(&res); return result; -} +} /* geteffect */ + /* sound handling */ @@ -327,7 +330,7 @@ void os_beep(int number) return; /* theWnd->FlushDisplay(); ::MessageBeep(MB_ICONEXCLAMATION);*/ -} +} /* os_beep */ /* @@ -341,7 +344,7 @@ void os_finish_with_sample(int number) if (!SFaudiorunning) return; os_stop_sample(number); -} +} /* os_finish_with_sample */ /* @@ -354,7 +357,7 @@ void os_prepare_sample(int number) { if (!SFaudiorunning) return; -} +} /* os_prepare_sample */ /* @@ -408,7 +411,7 @@ void os_start_sample(int number, int volume, int repeats, zword eos) e_mod = e; startmodule(); } -} +} /* os_start_sample */ /* @@ -430,7 +433,7 @@ void os_stop_sample(int number) stopsample(); if ((e_mod) && (e_mod->number == number)) stopmodule(); -} +} /* os_stop_sample */ void sf_checksound() @@ -449,6 +452,6 @@ void sf_checksound() end_of_sound(); } } -} +} /* sf_checksound */ /*************************************/ diff --git a/src/sdl/sf_util.c b/src/sdl/sf_util.c index 431fc9c..33849fd 100644 --- a/src/sdl/sf_util.c +++ b/src/sdl/sf_util.c @@ -72,7 +72,7 @@ void sf_regcleanfunc(void *f, const char *p) n->next = cflist; cflist = n; } -} +} /* sf_regcleanfunc */ void sf_cleanup_all() @@ -84,7 +84,7 @@ void sf_cleanup_all() free(cflist); cflist = n; } -} +} /* sf_cleanup_all */ /* @@ -109,7 +109,9 @@ void os_reset_screen(void) } sf_cleanup_all(); -} +} /* os_reset_screen */ + + /* * os_quit * @@ -121,6 +123,7 @@ void os_quit(int status) exit(status); } /* os_quit */ + int user_background = -1; int user_foreground = -1; int user_emphasis = -1; @@ -236,7 +239,7 @@ static void usage(int type) puts(info_footer); puts(footer); -} +} /* usage */ /* @@ -273,7 +276,7 @@ static int limit(int v, int m, int M) if (v > M) return M; return v; -} +} /* limit */ static void parse_options(int argc, char **argv) @@ -398,7 +401,7 @@ static void print_version(void) printf(" The core and SDL port are maintained by David Griffith.\n"); printf(" Frotz's homepage is https://661.org/proj/if/frotz/\n\n"); os_quit(EXIT_SUCCESS); -} +} /* print_version */ /** @@ -410,7 +413,7 @@ static char *new_dirname(const char *path) char *p = strdup(path), *p2 = strdup(dirname(p)); free(p); return p2; -} +} /* new_dirname */ /** @@ -422,7 +425,7 @@ static char *new_basename(const char *path) char *p = strdup(path), *p2 = strdup(basename(p)); free(p); return p2; -} +} /* new_basename */ /* @@ -534,7 +537,8 @@ void os_process_arguments(int argc, char *argv[]) void sf_sleep(int msecs) { SDL_Delay(msecs); -} +} /* sf_sleep */ + #ifdef WIN32 zlong sf_ticks(void) @@ -558,7 +562,7 @@ zlong sf_ticks(void) (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000; return ticks; -} +} /* sf_ticks */ #endif @@ -574,7 +578,7 @@ static char *getextension(int flag) ext = EXT_COMMAND; return ext; -} +} /* getextension */ static bool newfile(int flag) @@ -582,7 +586,7 @@ static bool newfile(int flag) if (flag == FILE_SAVE || flag == FILE_SAVE_AUX || flag == FILE_RECORD) return true; return false; -} +} /* newfile */ static char buf[FILENAME_MAX]; @@ -598,7 +602,7 @@ static const char *getnumbername(const char *def, char *ext) break; } return buf; -} +} /* getnumbername */ static const char *getdatename(const char *def, char *ext) @@ -616,7 +620,7 @@ static const char *getdatename(const char *def, char *ext) tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, ext); return buf; -} +} /* getdatename */ static int ingame_read_file_name(char *file_name, const char *default_name, @@ -682,7 +686,7 @@ char *os_read_file_name(const char *default_name, int flag) } return strdup(file_name); -} +} /* os_read_file_name */ static int ingame_read_file_name(char *file_name, const char *default_name, @@ -777,7 +781,7 @@ static int ingame_read_file_name(char *file_name, const char *default_name, ostream_record = saved_record; return result; -} /* os_read_file_name */ +} /* ingame_read_file_name */ static int dialog_read_file_name(char *file_name, const char *default_name, @@ -832,7 +836,7 @@ static int dialog_read_file_name(char *file_name, const char *default_name, return 1; } return 0; -} +} /* dialog_read_file_name */ static char *rc = NULL; @@ -842,7 +846,7 @@ void sf_FinishProfile() return; free(rc); rc = NULL; -} +} /* sf_FinishProfile */ void sf_InitProfile(const char *fn) @@ -898,7 +902,7 @@ void sf_InitProfile(const char *fn) *d = 0; CLEANREG(sf_FinishProfile); -} +} /* sf_InitProfile */ static char *findsect(const char *sect) @@ -915,7 +919,7 @@ static char *findsect(const char *sect) return (r + ns); } return NULL; -} +} /* findsect */ static char *findid(const char *sect, const char *id) @@ -948,7 +952,7 @@ static char *findid(const char *sect, const char *id) if (sav) *sav = '['; return fnd; -} +} /* findid */ int sf_GetProfileInt(const char *sect, const char *id, int def) @@ -959,7 +963,7 @@ int sf_GetProfileInt(const char *sect, const char *id, int def) def = atoi(p); } return def; -} +} /* sf_GetProfileInt */ double sf_GetProfileDouble(const char *sect, const char *id, double def) @@ -970,7 +974,7 @@ double sf_GetProfileDouble(const char *sect, const char *id, double def) def = atof(p); } return def; -} +} /* sf_GetProfileDouble */ char *sf_GetProfileString(const char *sect, const char *id, char *def) @@ -1010,7 +1014,7 @@ char *sf_GetProfileString(const char *sect, const char *id, char *def) if (sav) *q = sav; return def; -} +} /* sf_GetProfileString */ /* A. Local file header: @@ -1040,7 +1044,7 @@ char *sf_GetProfileString(const char *sect, const char *id, char *def) static unsigned myin(void *d, zbyte ** b) { return 0; -} +} /* myin */ static int myout(void *udata, zbyte * b, unsigned n) @@ -1048,7 +1052,7 @@ static int myout(void *udata, zbyte * b, unsigned n) memmove(udata, b, n); udata += n; return 0; -} +} /* myout */ static int myunzip(int csize, zbyte * cdata, zbyte * udata) @@ -1076,7 +1080,7 @@ static int myunzip(int csize, zbyte * cdata, zbyte * udata) st = inflateBackEnd(&z); return st; -} +} /* myunzip */ int sf_pkread(FILE * f, int foffs, void **out, int *size) @@ -1118,7 +1122,7 @@ int sf_pkread(FILE * f, int foffs, void **out, int *size) *out = (void *)data; *size = usize; return st; -} +} /* sf_pkread */ /* diff --git a/src/sdl/sf_video.c b/src/sdl/sf_video.c index ccf5c52..ea60698 100644 --- a/src/sdl/sf_video.c +++ b/src/sdl/sf_video.c @@ -70,7 +70,7 @@ void sf_setclip(int x, int y, int w, int h) xmax = x + w; ymin = y; ymax = y + h; -} +} /* sf_setclip */ void sf_getclip(int *x, int *y, int *w, int *h) @@ -79,7 +79,7 @@ void sf_getclip(int *x, int *y, int *w, int *h) *y = ymin; *w = xmax - xmin; *h = ymax - ymin; -} +} /* sf_getclip */ static int mywcslen(zchar * b) @@ -88,7 +88,7 @@ static int mywcslen(zchar * b) while (*b++) n++; return n; -} +} /* mywcslen */ static void myGrefresh() @@ -96,7 +96,7 @@ static void myGrefresh() SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); -} +} /* myGrefresh */ void sf_wpixel(int x, int y, zlong c) @@ -105,7 +105,7 @@ void sf_wpixel(int x, int y, zlong c) return; sbuffer[x + sbpitch * y] = c; dirty = 1; -} +} /* sf_wpixel */ zlong sf_rpixel(int x, int y) @@ -113,7 +113,7 @@ zlong sf_rpixel(int x, int y) if (x < 0 || x >= ewidth || y < 0 || y >= eheight) return 0; return sbuffer[x + sbpitch * y]; -} +} /* sf_rpixel */ #define MAXCUR 64 static zlong savedcur[MAXCUR]; @@ -134,7 +134,7 @@ static void drawthecursor(int x, int y, int onoff) sf_wpixel(x, y + i, savedcur[i]); } } -} +} /* drawthecursor */ bool sf_IsValidChar(zword c) @@ -146,14 +146,14 @@ bool sf_IsValidChar(zword c) if (c >= 0x100) return true; return false; -} +} /* sf_IsValidChar */ void sf_drawcursor(bool c) { SF_textsetting *ts = sf_curtextsetting(); drawthecursor(ts->cx, ts->cy, c); -} +} /* sf_drawcursor */ void sf_chline(int x, int y, zlong c, int n) @@ -173,7 +173,7 @@ void sf_chline(int x, int y, zlong c, int n) while (n--) *s++ = c; dirty = 1; -} +} /* sf_chline */ void sf_cvline(int x, int y, zlong c, int n) @@ -195,7 +195,7 @@ void sf_cvline(int x, int y, zlong c, int n) s += sbpitch; } dirty = 1; -} +} /* sf_cvline */ zlong sf_blendlinear(int a, zlong s, zlong d) @@ -209,7 +209,7 @@ zlong sf_blendlinear(int a, zlong s, zlong d) d >>= 8; r |= (((s & 0xff) * a + (d & 0xff) * (256 - a)) >> 8) << 16; return r; -} +} /* sf_blendlinear */ void sf_writeglyph(SF_glyph * g) @@ -287,7 +287,7 @@ void sf_writeglyph(SF_glyph * g) ts->cx += (w); ts->oh = (weff > w) ? weff - w : 0; -} +} /* sf_writeglyph */ void sf_fillrect(zlong color, int x, int y, int w, int h) @@ -317,7 +317,7 @@ void sf_fillrect(zlong color, int x, int y, int w, int h) dst += sbpitch; } dirty = 1; -} +} /* sf_fillrect */ void sf_rect(zlong color, int x, int y, int w, int h) @@ -326,7 +326,7 @@ void sf_rect(zlong color, int x, int y, int w, int h) sf_chline(x, y + h - 1, color, w); sf_cvline(x, y, color, h); sf_cvline(x + w - 1, y, color, h); -} +} /* sf_rect */ void sf_flushtext() @@ -334,7 +334,7 @@ void sf_flushtext() SF_textsetting *ts = sf_curtextsetting(); ts->cx += ts->oh; ts->oh = 0; -} +} /* sf_flushtext */ /* @@ -353,7 +353,7 @@ void os_erase_area(int top, int left, int bottom, int right, int win) sf_flushtext(); sf_fillrect((sf_curtextsetting())->back, left - 1, top - 1, right - left + 1, bottom - top + 1); -} +} /* os_erase_area */ /* @@ -375,7 +375,7 @@ int os_peek_colour(void) SF_textsetting *ts = sf_curtextsetting(); sf_flushtext(); return sf_GetColourIndex(sf_rpixel(ts->cx, ts->cy)); -} +} /* os_peek_colour */ static void scroll(int x, int y, int w, int h, int n) @@ -403,7 +403,7 @@ static void scroll(int x, int y, int w, int h, int n) } dirty = 1; } -} +} /* scroll */ /** @@ -420,7 +420,7 @@ bool sf_flushdisplay() return true; } else return false; -} +} /* sf_flushdisplay */ /* @@ -442,7 +442,7 @@ void os_scroll_area(int top, int left, int bottom, int right, int units) else if (units < 0) sf_fillrect((sf_curtextsetting())->back, left - 1, top - 1, right - left + 1, units); -} +} /* os_scroll_area */ bool os_repaint_window(int win, int ypos_old, int ypos_new, int xpos, @@ -450,7 +450,7 @@ bool os_repaint_window(int win, int ypos_old, int ypos_new, int xpos, { /* TODO */ return FALSE; -} +} /* os_repaint_window */ int SFdticks = 200; @@ -466,7 +466,7 @@ static Uint32 SDLCALL mytimer(Uint32 inter, void *parm) event.user.type = refreshEventType; SDL_PushEvent(&event); return inter; -} +} /* mytimer */ static void cleanvideo() @@ -474,7 +474,7 @@ static void cleanvideo() if (timerid) SDL_RemoveTimer(timerid); SDL_Quit(); -} +} /* cleanvideo */ #define RM 0x0000ff #define GM 0x00ff00 @@ -492,7 +492,7 @@ static void sf_toggle_fullscreen() SDL_SetWindowSize(window, AcWidth, AcHeight); myGrefresh(); } -} +} /* sf_toggle_fullscreen */ void sf_initvideo(int W, int H, int full) @@ -549,7 +549,7 @@ void sf_initvideo(int W, int H, int full) ymax = eheight = H; sbpitch = W; dirty = 1; -} +} /* sf_initvideo */ /* @@ -670,7 +670,7 @@ void os_draw_picture(int picture, int y, int x) } dirty = 1; -} +} /* os_draw_picture */ static zlong mytimeout; @@ -683,7 +683,7 @@ static void set_mouse_xy(int x, int y) * SDL maps mouse events to logical coordinates. */ mouse_x = x + 1; mouse_y = y + 1; -} +} /* set_mouse_xy */ /** @@ -713,7 +713,7 @@ static zword decode_utf8(char *str) res |= (str[i] & 077); } return res; -} +} /* decode_utf8 */ static void handle_window_event(SDL_Event * e) @@ -722,7 +722,7 @@ static void handle_window_event(SDL_Event * e) case SDL_WINDOWEVENT_EXPOSED: myGrefresh(); } -} +} /* handle_window_event */ static zword goodzkey(SDL_Event * e, int allowed) @@ -872,7 +872,7 @@ static zword goodzkey(SDL_Event * e, int allowed) handle_window_event(e); } return 0; -} +} /* goodzkey */ zword sf_read_key(int timeout, bool cursor, bool allowed, bool text) @@ -911,7 +911,7 @@ zword sf_read_key(int timeout, bool cursor, bool allowed, bool text) sf_drawcursor(false); return inch; -} +} /* sf_read_key */ /* @@ -924,7 +924,7 @@ zword sf_read_key(int timeout, bool cursor, bool allowed, bool text) zchar os_read_key(int timeout, int cursor) { return sf_read_key(timeout, cursor, false, true); -} +} /* os_read_key */ /* @@ -1138,7 +1138,7 @@ zchar os_read_line(int max, zchar * buf, int timeout, int width, int continued) sf_checksound(); sf_sleep(10); } -} +} /* os_read_line */ /* Draw the current input line */ void sf_DrawInput(zchar * buffer, int pos, int ptx, int pty, int width, @@ -1167,7 +1167,7 @@ void sf_DrawInput(zchar * buffer, int pos, int ptx, int pty, int width, /* Update the window */ sf_flushdisplay(); -} +} /* sf_DrawInput */ /* @@ -1199,7 +1199,7 @@ zword os_read_mouse(void) btn |= 4; return btn; -} +} /* os_read_mouse */ /* @@ -1235,7 +1235,7 @@ void os_more_prompt(void) /* Restore the current text position */ sf_poptextsettings(); } -} +} /* os_more_prompt */ zlong *sf_savearea(int x, int y, int w, int h) @@ -1277,7 +1277,7 @@ zlong *sf_savearea(int x, int y, int w, int h) s += sbpitch; } return r; -} +} /* sf_savearea */ void sf_restoreareaandfree(zlong * s) @@ -1303,7 +1303,7 @@ void sf_restoreareaandfree(zlong * s) free(s); dirty = 1; sf_flushdisplay(); -} +} /* sf_restoreareaandfree */ int (*sf_osdialog)(bool ex, const char *def, const char *filt, const char *tit, @@ -1319,7 +1319,7 @@ int sf_user_fdialog(bool existing, const char *defaultname, const char *filter, sbuffer, sbpitch, ewidth, eheight, isfullscreen); return SF_NOTIMP; -} +} /* sf_user_fdialog */ void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh) @@ -1328,7 +1328,7 @@ void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh) *sp = sbpitch; *ew = ewidth; *eh = eheight; -} +} /* sf_videodata */ extern zword sf_yesnooverlay(int xc, int yc, char *t, int sr); @@ -1341,7 +1341,7 @@ static void sf_quitconf() SDL_Quit(); os_quit(EXIT_SUCCESS); } -} +} /* sf_quitconf */ void os_tick() @@ -1357,7 +1357,7 @@ void os_tick() handle_window_event(&ev); } } -} +} /* os_tick */ /* Apply the picture's palette to the screen palette. */ @@ -1381,4 +1381,4 @@ static bool ApplyPalette(sf_picture * graphic) } } return changed; -} +} /* ApplyPalette */