changeset 1470:e5502fc43a7d

Rename some functions, make few static.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 14 May 2014 01:38:56 +0300
parents 3142cbc3c072
children da2dc8d19038
files colormap.c diffmap.c libmaputils.c libmaputils.h map2ppm.c mapstats.c mkcitymap.c
diffstat 7 files changed, 37 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/colormap.c	Tue May 13 17:03:42 2014 +0300
+++ b/colormap.c	Wed May 14 01:38:56 2014 +0300
@@ -196,7 +196,7 @@
 
 void putFileStartXHTML(FILE *outFile)
 {
-    mcXHTMLhead(outFile, optMapTitle, !optCheatMode);
+    muXHTMLhead(outFile, optMapTitle, !optCheatMode);
     
     fprintf(outFile,
     " <script type=\"text/javascript\" src=\"util.js\"></script>\n"
@@ -207,12 +207,12 @@
     "  pre { font-size: 10pt; }\n"
     "  %s { text-decoration: none; font-style: normal; }\n",
     optXHTMLTagName, (optPosGlue) ? "position: relative; " : "",
-    mcGetCSS(optBackColor),
+    muColorToCSSColor(optBackColor),
     optXHTMLTagName
     );
     
-    mcXHTMLcolors(outFile, optXHTMLTagName, NULL, NULL);
-    mcXHTMLcolors(outFile, "a", "background", " color: black;");
+    muXHTMLcolors(outFile, optXHTMLTagName, NULL, NULL);
+    muXHTMLcolors(outFile, "a", "background", " color: black;");
 
     if (optPosGlue)
     {
@@ -246,7 +246,7 @@
 
     if (optUrchinFile)
     {
-        if (copyFileToStream(outFile, optUrchinFile) < 0)
+        if (muCopyFileToStream(outFile, optUrchinFile) < 0)
         {
             THERR("Error copying urchin file '%s' to output!\n", optUrchinFile);
             exit(17);
@@ -309,12 +309,12 @@
     {
         fprintf(outFile,
         "<font bgcolor='%s' color='black'>",
-        mcGetCSS(-c-1));
+        muColorToCSSColor(-c-1));
     }
     else
     {
         fprintf(outFile, "<font color='%s'>",
-        mcGetCSS(c));
+        muColorToCSSColor(c));
     }
 }
 
@@ -346,7 +346,7 @@
     fprintf(outFile,
     "</head>\n"
     "<body bgcolor=\"black\" text=\"%s\">\n",
-    mcGetCSS(optBackColor)
+    muColorToCSSColor(optBackColor)
     );
 
     if (optMapTitle)
@@ -454,7 +454,7 @@
         }
         else
         {
-            c = mcGetColor(k, optUseOldFormat, optCityFormat);
+            c = muGetMapPieceColor(k, optUseOldFormat, optCityFormat);
             if (c != p)
             {
                 if (p != -1 && (!fmt->supBackColor || p != optBackColor))
@@ -706,7 +706,7 @@
         {
             if (k != '\n' && k != ' ' && k < 0xfe)
             {
-                c = mcGetColor(k, optUseOldFormat, optCityFormat);
+                c = muGetMapPieceColor(k, optUseOldFormat, optCityFormat);
                 if (c != p && c >= 0 && c < MAXCOL)
                 {
                     colChangesTo[c]++;
--- a/diffmap.c	Tue May 13 17:03:42 2014 +0300
+++ b/diffmap.c	Wed May 14 01:38:56 2014 +0300
@@ -145,7 +145,7 @@
             
             if (*p1 != *p2 && !strchr(filter1, *p1) && !strchr(filter2, *p2))
             {
-                c = mcGet(*p2, useOld, FALSE);
+                c = muGetMapPieceIndex(*p2, useOld, FALSE);
                 if (c < 0)
                     *pd = 0xfd;
                 else
@@ -155,7 +155,7 @@
             }
             else
             {
-                c = mcGet(*p1, useOld, FALSE);
+                c = muGetMapPieceIndex(*p1, useOld, FALSE);
                 if (c < 0)
                     *pd = 0xfd;
                 else
--- a/libmaputils.c	Tue May 13 17:03:42 2014 +0300
+++ b/libmaputils.c	Wed May 14 01:38:56 2014 +0300
@@ -312,7 +312,7 @@
 
 
 
-char *mcGetCSS(int c)
+char *muColorToCSSColor(int c)
 {
     static char tmpStr[32];
     assert(c >= 0);
@@ -325,7 +325,7 @@
 }
 
 
-int mcGetPieceFromList(const MapPiece pieces[], const int npieces, int symbol, BOOL getOld)
+static int muGetPieceFromList(const MapPiece pieces[], const int npieces, int symbol, BOOL getOld)
 {
     int i;
 
@@ -340,18 +340,18 @@
 }
 
 
-int mcGet(int symbol, BOOL getOld, BOOL getCity)
+int muGetMapPieceIndex(int symbol, BOOL getOld, BOOL getCity)
 {
     int n;
     
-    if (getCity && (n = mcGetPieceFromList(mapCityPieces, nmapCityPieces, symbol, getOld)) >= 0)
+    if (getCity && (n = muGetPieceFromList(mapCityPieces, nmapCityPieces, symbol, getOld)) >= 0)
         return n;
 
-    return mcGetPieceFromList(mapPieces, nmapPieces, symbol, getOld);
+    return muGetPieceFromList(mapPieces, nmapPieces, symbol, getOld);
 }
 
 
-int mcGetColorFromList(const MapPiece pieces[], const int npieces, int symbol, BOOL getOld)
+static int muGetColorFromList(const MapPiece pieces[], const int npieces, int symbol, BOOL getOld)
 {
     int i;
 
@@ -380,18 +380,18 @@
 }
 
 
-int mcGetColor(int symbol, BOOL getOld, BOOL getCity)
+int muGetMapPieceColor(int symbol, BOOL getOld, BOOL getCity)
 {
     int n;
     
-    if (getCity && (n = mcGetColorFromList(mapCityPieces, nmapCityPieces, symbol, getOld)) >= 0)
+    if (getCity && (n = muGetColorFromList(mapCityPieces, nmapCityPieces, symbol, getOld)) >= 0)
         return n;
 
-    return ((n = mcGetColorFromList(mapPieces, nmapPieces, symbol, getOld)) >= 0) ? n : 0;
+    return ((n = muGetColorFromList(mapPieces, nmapPieces, symbol, getOld)) >= 0) ? n : 0;
 }
 
 
-void mcXHTMLhead(FILE *outFile, char *title, BOOL strict)
+void muXHTMLhead(FILE *outFile, char *title, BOOL strict)
 {
     static const char *strCharSet = "utf-8";
     assert(outFile != NULL);
@@ -427,7 +427,7 @@
 }
 
 
-void mcXHTMLcolors(FILE *outFile, char *tagName, char *propName, char *extra)
+void muXHTMLcolors(FILE *outFile, char *tagName, char *propName, char *extra)
 {
     int n;
     assert(outFile != NULL);
@@ -444,7 +444,7 @@
 }
 
 
-int copyFileToStream(FILE *outFile, const char *filename)
+int muCopyFileToStream(FILE *outFile, const char *filename)
 {
     FILE *inFile;
 
--- a/libmaputils.h	Tue May 13 17:03:42 2014 +0300
+++ b/libmaputils.h	Wed May 14 01:38:56 2014 +0300
@@ -96,12 +96,12 @@
 int         fputsesc2(const char *str, FILE *f);
 int         fputsesc3(const char *str, FILE *f);
 
-int         mcGet(int, BOOL, BOOL);
-int         mcGetColor(int, BOOL, BOOL);
-void        mcXHTMLhead(FILE *, char *, BOOL);
-void        mcXHTMLcolors(FILE *, char *, char *, char *);
-char *      mcGetCSS(int);
-int         copyFileToStream(FILE *outFile, const char *filename);
+int         muGetMapPieceIndex(int, BOOL, BOOL);
+int         muGetMapPieceColor(int, BOOL, BOOL);
+void        muXHTMLhead(FILE *, char *, BOOL);
+void        muXHTMLcolors(FILE *, char *, char *, char *);
+char *      muColorToCSSColor(int);
+int         muCopyFileToStream(FILE *outFile, const char *filename);
 
 
 /* Mapblock handling
--- a/map2ppm.c	Tue May 13 17:03:42 2014 +0300
+++ b/map2ppm.c	Wed May 14 01:38:56 2014 +0300
@@ -183,7 +183,7 @@
             }
             else if (optUseANSI)
             {
-                if ((c = mcGetColor(c, optUseOldFormat, optCityFormat)) >= 0)
+                if ((c = muGetMapPieceColor(c, optUseOldFormat, optCityFormat)) >= 0)
                 {
                     qr = mapColors[c].r;
                     qg = mapColors[c].g;
@@ -192,7 +192,7 @@
             }
             else
             {
-                if ((c = mcGet(c, optUseOldFormat, optCityFormat)) >= 0)
+                if ((c = muGetMapPieceIndex(c, optUseOldFormat, optCityFormat)) >= 0)
                 {
                     qr = mapPieces[c].r;
                     qg = mapPieces[c].g;
--- a/mapstats.c	Tue May 13 17:03:42 2014 +0300
+++ b/mapstats.c	Wed May 14 01:38:56 2014 +0300
@@ -243,7 +243,7 @@
         for (x = 0; x < map->width; x++)
         {
             int c;
-            if ((c = mcGet(*d, optUseOldFormat, optCityFormat)) >= 0)
+            if ((c = muGetMapPieceIndex(*d, optUseOldFormat, optCityFormat)) >= 0)
                 statPieces[c].n++;
             else
                 statUnknown++;
--- a/mkcitymap.c	Tue May 13 17:03:42 2014 +0300
+++ b/mkcitymap.c	Wed May 14 01:38:56 2014 +0300
@@ -146,7 +146,7 @@
     (void) l;
     
     /* Output XHTML header */
-    mcXHTMLhead(outFile, optMapTitle, TRUE);
+    muXHTMLhead(outFile, optMapTitle, TRUE);
     
     /* Output CSS style information */
     fprintf(outFile,
@@ -212,13 +212,13 @@
     );
     }
 
-    mcXHTMLcolors(outFile, "span", NULL, NULL);
+    muXHTMLcolors(outFile, "span", NULL, NULL);
     
     fprintf(outFile,
     " </style>\n"
     );
 
-    if (optUrchinFile && copyFileToStream(outFile, optUrchinFile) < 0)
+    if (optUrchinFile && muCopyFileToStream(outFile, optUrchinFile) < 0)
     {
         THERR("Error copying urchin file '%s' to output.\n", optUrchinFile);
     }
@@ -377,7 +377,7 @@
                 if (p != *d)
                 {
                     if (span) fprintf(outFile, "</span>");
-                    c = mcGetColor(*d, FALSE, TRUE);
+                    c = muGetMapPieceColor(*d, FALSE, TRUE);
                     fprintf(outFile, "<span class=\"%c\">", 'a' + c);
                     span = TRUE;
                 }