Compare commits

...

3 Commits

  1. 1922
      modules/gmt/modgmt_colornames.cpp
  2. 58
      modules/gmt/modgmt_colornames.h
  3. 5
      modules/gmt/modgmt_gsfuncs.cpp
  4. 5
      modules/gmt/modgmt_internals.cpp
  5. 26
      modules/gmt/modgmt_map.cpp

1922
modules/gmt/modgmt_colornames.cpp

File diff suppressed because it is too large Load Diff

58
modules/gmt/modgmt_colornames.h

@ -13,38 +13,38 @@ public:
}; };
inline unsigned int inline unsigned int
ColorHash::colornamehash ( const char *str, unsigned int len) ColorHash::colornamehash (const char *str, unsigned int len)
{ {
static const unsigned short asso_values[] = static const unsigned short asso_values[] =
{ {
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 800, 25, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 666, 27,
20, 5, 0, 845, 785, 780, 640, 620, 4084, 4084, 26, 23, 22, 789, 588, 587, 501, 436, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 80, 0, 686, 5, 0, 2728, 2728, 2728, 2728, 2728, 61, 96, 222, 98, 22,
260, 0, 85, 770, 20, 950, 210, 95, 160, 195, 117, 22, 561, 559, 22, 708, 179, 301, 42, 101,
995, 335, 0, 0, 135, 425, 55, 863, 4084, 60, 242, 46, 23, 22, 116, 171, 821, 809, 2728, 169,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 80, 0, 686, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 61, 96, 222,
5, 0, 260, 0, 85, 770, 20, 950, 210, 95, 98, 22, 117, 22, 561, 559, 22, 708, 179, 301,
160, 195, 995, 335, 0, 0, 135, 425, 55, 863, 42, 101, 242, 46, 23, 22, 116, 171, 821, 809,
4084, 60, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 169, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
4084, 4084, 4084, 4084, 4084, 4084 2728, 2728, 2728, 2728, 2728, 2728
}; };
int hval = len; int hval = len;
switch (hval) switch (hval)
{ {
@ -81,4 +81,4 @@ ColorHash::colornamehash ( const char *str, unsigned int len)
return hval + asso_values[(unsigned char)str[len - 1]]; return hval + asso_values[(unsigned char)str[len - 1]];
} }
#endif #endif

5
modules/gmt/modgmt_gsfuncs.cpp

@ -82,6 +82,7 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string*
{ {
struct gsworkthreadpars wp; struct gsworkthreadpars wp;
int* pret; int* pret;
int ret=0;
wp.r=r; wp.r=r;
wp.input_callback=input; wp.input_callback=input;
@ -96,7 +97,7 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string*
ssize_t br; ssize_t br;
char buffer[4096]; char buffer[4096];
pipe(pipefd); if(0!=pipe(pipefd)) {ret=-1; goto end;}
wp.fd=pipefd[1]; wp.fd=pipefd[1];
out->erase(); out->erase();
@ -112,6 +113,8 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string*
} }
else pret=reinterpret_cast<int*>(gsworkthread(&wp)); else pret=reinterpret_cast<int*>(gsworkthread(&wp));
end:
if(0!=ret) return ret;
return *pret; return *pret;
} }

5
modules/gmt/modgmt_internals.cpp

@ -44,8 +44,9 @@ int callgmtmodule(void *api, const char *module, struct GMT_OPTION *opts, std::s
pthread_t wthr; pthread_t wthr;
struct gmtworkthreadpars p; struct gmtworkthreadpars p;
int *pret; int *pret;
int ret=0;
pipe(pipefd); if(0!=pipe(pipefd)) {ret=-1; goto end;}
p.api=api; p.api=api;
p.module=module; p.module=module;
p.opts=opts; p.opts=opts;
@ -59,6 +60,8 @@ int callgmtmodule(void *api, const char *module, struct GMT_OPTION *opts, std::s
res->shrink_to_fit(); res->shrink_to_fit();
pthread_join(wthr,reinterpret_cast<void**>(&pret)); pthread_join(wthr,reinterpret_cast<void**>(&pret));
end:
if(0!=ret) return ret;
return *pret; return *pret;
} }
// Overloaded variant with opts as std::string // Overloaded variant with opts as std::string

26
modules/gmt/modgmt_map.cpp

@ -298,9 +298,16 @@ const ObjectBase* GMT_Convert2PNG(const ObjectList* input)
if(taa.Exist()) aats=taa; if(taa.Exist()) aats=taa;
if(gaa.Exist()) aags=gaa; if(gaa.Exist()) aags=gaa;
tolower(aags); tolower(aats); tolower(aags); tolower(aats);
if("none" ==aags || "no"==aags || "n"==aags) aag=1; if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2; if("small"==aats || "s" ==aats ) aat=2; if("none" ==aags || "no"==aags || "n"==aags) aag=1;
if("full" ==aags || "f" ==aags ) aag=4; if("full" ==aats || "f" ==aats ) aat=4; if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2;
if("small"==aats || "s" ==aats ) aat=2;
if("full" ==aags || "f" ==aags ) aag=4;
if("full" ==aats || "f" ==aats ) aat=4;
if(0==aat) {err="Incorrect value for text antialiasing: "+aats; goto fail;} if(0==aat) {err="Incorrect value for text antialiasing: "+aats; goto fail;}
if(0==aag) {err="Incorrect value for graphics antialiasing: "+aags; goto fail;} if(0==aag) {err="Incorrect value for graphics antialiasing: "+aags; goto fail;}
} }
@ -408,9 +415,16 @@ const ObjectBase* GMT_Convert2JPG(const ObjectList* input)
if(taa.Exist()) aats=taa; if(taa.Exist()) aats=taa;
if(gaa.Exist()) aags=gaa; if(gaa.Exist()) aags=gaa;
tolower(aags); tolower(aats); tolower(aags); tolower(aats);
if("none" ==aags || "no"==aags || "n"==aags) aag=1; if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2; if("small"==aats || "s" ==aats ) aat=2; if("none" ==aags || "no"==aags || "n"==aags) aag=1;
if("full" ==aags || "f" ==aags ) aag=4; if("full" ==aats || "f" ==aats ) aat=4; if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2;
if("small"==aats || "s" ==aats ) aat=2;
if("full" ==aags || "f" ==aags ) aag=4;
if("full" ==aats || "f" ==aats ) aat=4;
if(0==aat) {err="Incorrect value for text antialiasing: "+aats; goto fail;} if(0==aat) {err="Incorrect value for text antialiasing: "+aats; goto fail;}
if(0==aag) {err="Incorrect value for graphics antialiasing: "+aags; goto fail;} if(0==aag) {err="Incorrect value for graphics antialiasing: "+aags; goto fail;}
} }

Loading…
Cancel
Save