Mercurial > hg > batmud > maputils
changeset 2540:4ad4b890ed21
Rename some function arguments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 26 Dec 2023 02:44:28 +0200 |
parents | 0fda0c7e7f1c |
children | f46fe76c98de |
files | src/colormap.c |
diffstat | 1 files changed, 88 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/src/colormap.c Tue Dec 26 02:43:28 2023 +0200 +++ b/src/colormap.c Tue Dec 26 02:44:28 2023 +0200 @@ -7,6 +7,7 @@ #include "th_args.h" #include "th_string.h" + #define SET_MAX_COLORS (256) #define SET_MAX_STRLEN (1024) @@ -16,15 +17,16 @@ char *fmtName; char *fmtDescription; bool supBackColor; - void (*putTagMarker) (FILE *, const char *, const int color, const int marker); - void (*putTagLocation) (FILE *, const char *, const int color); - void (*putTagLocationEnd) (FILE *, const char *); - void (*putTagStart) (FILE *, const int color); - void (*putTagEnd) (FILE *); - bool (*putTagEOL) (FILE *); - void (*putFileStart) (FILE *); - void (*putFileEnd) (FILE *); - int (*putString) (const char *str, FILE *); + + void (*putTagMarker) (FILE *fh, const char *str, const int color, const int marker); + void (*putTagLocation) (FILE *fh, const char *str, const int color); + void (*putTagLocationEnd) (FILE *fh, const char *str); + void (*putTagStart) (FILE *fh, const int color); + void (*putTagEnd) (FILE *fh); + bool (*putTagEOL) (FILE *fh); + void (*putFileStart) (FILE *fh); + void (*putFileEnd) (FILE *fh); + int (*putString) (const char *str, FILE *fh); } CMapOutFormat; @@ -74,83 +76,83 @@ /* * ANSI output format functions */ -void putTagStartANSI(FILE *outFile, const int c) +void putTagStartANSI(FILE *fh, const int c) { - fputc(0x1b, outFile); + fputc(0x1b, fh); if (c < 0) { - fprintf(outFile, "[0;%d;30m", + fprintf(fh, "[0;%d;30m", 10 + mapColors[-c-1].ansi); } else { - fprintf(outFile, "[0;%d;%dm", + fprintf(fh, "[0;%d;%dm", mapColors[c].ansiAttr, mapColors[c].ansi); } } -void putTagEndANSI(FILE *outFile) +void putTagEndANSI(FILE *fh) { - (void) outFile; + (void) fh; /* - fputc(0x1b, outFile); - fprintf(outFile, "[0m"); + fputc(0x1b, fh); + fprintf(fh, "[0m"); */ } -bool putEOLANSI(FILE *outFile) +bool putEOLANSI(FILE *fh) { - fprintf(outFile, "\n"); + fprintf(fh, "\n"); return true; } -void putFileStartANSI(FILE *outFile) +void putFileStartANSI(FILE *fh) { - fputc(0x1b, outFile); - fprintf(outFile, "[0m"); + fputc(0x1b, fh); + fprintf(fh, "[0m"); if (optMapTitle) { - fprintf(outFile, "%s\n", optMapTitle); + fprintf(fh, "%s\n", optMapTitle); } } -void putFileEndANSI(FILE *outFile) +void putFileEndANSI(FILE *fh) { - fputc(0x1b, outFile); - fprintf(outFile, "[0m"); + fputc(0x1b, fh); + fprintf(fh, "[0m"); } /* * ASCII output format functions */ -void putTagStartText(FILE *outFile, const int c) +void putTagStartText(FILE *fh, const int c) { - (void) outFile; (void) c; -// fputc(0xa7, outFile); + (void) fh; (void) c; +// fputc(0xa7, fh); } -void putTagEndText(FILE *outFile) +void putTagEndText(FILE *fh) { - (void) outFile; -// fprintf(outFile, "$"); + (void) fh; +// fprintf(fh, "$"); } -bool putEOLText(FILE *outFile) +bool putEOLText(FILE *fh) { - fprintf(outFile, "\n"); + fprintf(fh, "\n"); return false; } -void putFileStartText(FILE *outFile) +void putFileStartText(FILE *fh) { if (optMapTitle) { - fprintf(outFile, "%s\n", optMapTitle); + fprintf(fh, "%s\n", optMapTitle); } } @@ -161,65 +163,65 @@ #define XHTML_LOCLABEL "label" #define XHTML_LOCMARKER "marker" -void putColorClassXHTML(FILE *outFile, const int color) +void putColorClassXHTML(FILE *fh, const int color) { int q = 'a' + color; if (optCheatMode) - fprintf(outFile, "class=%c>", q); + fprintf(fh, "class=%c>", q); else - fprintf(outFile, "class=\"%c\">", q); + fprintf(fh, "class=\"%c\">", q); } -void putTagMarkerXHTML(FILE *outFile, const char *locID, const int color, const int marker) +void putTagMarkerXHTML(FILE *fh, const char *locID, const int color, const int marker) { - fprintf(outFile, + fprintf(fh, "<i class=\"" XHTML_LOCMARKER " %c\" id=\"%s\">%c", 'a' + color, locID, marker); } -void putTagLocationXHTML(FILE *outFile, const char *locID, const int color) +void putTagLocationXHTML(FILE *fh, const char *locID, const int color) { - fprintf(outFile, + fprintf(fh, "<i class=\"" XHTML_LOCLABEL "\"><a id=\"%s\" ", locID); - putColorClassXHTML(outFile, color); + putColorClassXHTML(fh, color); } -void putTagLocationEndXHTML(FILE *outFile, const char *locID) +void putTagLocationEndXHTML(FILE *fh, const char *locID) { (void) locID; - fprintf(outFile, "</a>"); + fprintf(fh, "</a>"); } -void putTagStartXHTML(FILE *outFile, const int c) +void putTagStartXHTML(FILE *fh, const int c) { - fprintf(outFile, "<i "); - putColorClassXHTML(outFile, c); + fprintf(fh, "<i "); + putColorClassXHTML(fh, c); } -void putTagEndXHTML(FILE *outFile) +void putTagEndXHTML(FILE *fh) { - fprintf(outFile, "</i>"); + fprintf(fh, "</i>"); } -bool putEOLXHTML(FILE *outFile) +bool putEOLXHTML(FILE *fh) { - fprintf(outFile, "\n"); + fprintf(fh, "\n"); return false; } -void putFileGenericHTML(FILE *outFile) +void putFileGenericHTML(FILE *fh) { char buf[32]; if (optUseJS) { - fprintf(outFile, + fprintf(fh, " <script type=\"text/javascript\" src=\"util.js\"></script>\n"); } - fprintf(outFile, + fprintf(fh, " <style type=\"text/css\">\n" " <!--\n" " %s." XHTML_LOCLABEL " { background: white; color: black; %s}\n" @@ -232,12 +234,12 @@ optXHTMLTagName ); - muPrintHTMLcolors(outFile, optXHTMLTagName, NULL, NULL); - muPrintHTMLcolors(outFile, "a", "background", " color: black;"); + muPrintHTMLcolors(fh, optXHTMLTagName, NULL, NULL); + muPrintHTMLcolors(fh, "a", "background", " color: black;"); if (optPosGlue) { - fprintf(outFile, + fprintf(fh, " div.controls {\n" " position: fixed;\n" " top: 0.5em;\n" @@ -293,31 +295,29 @@ ); } - fprintf(outFile, + fprintf(fh, " -->\n" " </style>\n" ); - if (optUrchinFile) + if (optUrchinFile && + muCopyFileToStream(fh, optUrchinFile) < 0) { - if (muCopyFileToStream(outFile, optUrchinFile) < 0) - { - THERR("Error copying urchin file '%s' to output!\n", optUrchinFile); - exit(17); - } + THERR("Error copying urchin file '%s' to output!\n", + optUrchinFile); } - fprintf(outFile, + fprintf(fh, "</head>\n"); if (optUseJS) { - fprintf(outFile, + fprintf(fh, "<body onload=\"mapOnLoad();\">\n"); } else { - fprintf(outFile, + fprintf(fh, "<body>\n"); } @@ -325,18 +325,18 @@ { if (optMapTitle) { - fprintf(outFile, "<h2>"); - fputse(optMapTitle, outFile); - fprintf(outFile, "</h2>\n"); + fprintf(fh, "<h2>"); + fputse(optMapTitle, fh); + fprintf(fh, "</h2>\n"); } } else { - fprintf(outFile, + fprintf(fh, "<div id=\"sbox\" class=\"controls\">\n" " <div class=\"sbtitle\">"); - fputse(optMapTitle, outFile); - fprintf(outFile, + fputse(optMapTitle, fh); + fprintf(fh, "</div>\n" " <select id=\"slocation\" autofocus=\"autofocus\">\n" "@LOCATIONS@\n" @@ -351,21 +351,21 @@ ); } - fprintf(outFile, + fprintf(fh, "<div id=\"smap\"><pre>\n" ); } -void putFileStartXHTML(FILE *outFile) +void putFileStartXHTML(FILE *fh) { - muPrintHTMLhead(outFile, optMapTitle, false); - putFileGenericHTML(outFile); + muPrintHTMLhead(fh, optMapTitle, false); + putFileGenericHTML(fh); } -void putFileEndXHTML(FILE *outFile) +void putFileEndXHTML(FILE *fh) { // XHTML document end tags - fprintf(outFile, + fprintf(fh, "</pre></div>\n" "</body>\n" "</html>\n" @@ -376,29 +376,29 @@ /* * XHTML+CSS output format functions */ -void putFileStartHTML5(FILE *outFile) +void putFileStartHTML5(FILE *fh) { - muPrintHTMLhead(outFile, optMapTitle, true); - putFileGenericHTML(outFile); + muPrintHTMLhead(fh, optMapTitle, true); + putFileGenericHTML(fh); } /* Process a normal format input */ -void checkEndTag(FILE *outFile, const CMapOutFormat *fmt, const int prevColor) +void checkEndTag(FILE *fh, const CMapOutFormat *fmt, const int prevColor) { if (prevColor != -1 && (!fmt->supBackColor || prevColor != optBackColor)) - fmt->putTagEnd(outFile); + fmt->putTagEnd(fh); } -bool getTagStr(FILE *inFile, char *tmpStr, const size_t len, const int endch) +bool getTagStr(FILE *fh, char *tmpStr, const size_t len, const int endch) { size_t i; int mch = EOF; - for (i = 0; i + 1 < len && (mch = fgetc(inFile)) != EOF;) + for (i = 0; i + 1 < len && (mch = fgetc(fh)) != EOF;) { if (mch == endch) break;