diff --git a/modules/gmt/modgmt.cpp b/modules/gmt/modgmt.cpp index 7bdc615..92ae8b7 100644 --- a/modules/gmt/modgmt.cpp +++ b/modules/gmt/modgmt.cpp @@ -15,6 +15,7 @@ int gmt_module_init(void* p) if(0==gmtapi) return 1; if(0==ret) ret=callgmtmodule(gmtapi,"psclip","-C -P -K",&header,gmt_filter_headfoot); if(0==ret) ret=callgmtmodule(gmtapi,"psclip","-C -P -O",&footer,gmt_filter_headfoot); + if(0==ret) callgmtmodule(gmtapi,"psclip","--show-datadir",&datadir); GMT_Destroy_Session(gmtapi); if(0!=ret) return ret; @@ -23,6 +24,7 @@ int gmt_module_init(void* p) RegisterFunction("GMT_Header",GMT_Header); RegisterFunction("GMT_Footer",GMT_Footer); + RegisterFunction("GMT_Datadir",GMT_Datadir); RegisterFunction("GET",Get); RegisterFunction("GET",Get); RegisterFunction("GET",Get); diff --git a/modules/gmt/modgmt_func.cpp b/modules/gmt/modgmt_func.cpp index 6762576..ceb69ff 100644 --- a/modules/gmt/modgmt_func.cpp +++ b/modules/gmt/modgmt_func.cpp @@ -21,6 +21,11 @@ const ObjectBase* GMT_Footer(const ObjectList* input) return new ObjectString(footer); } +const ObjectBase* GMT_Datadir(const ObjectList* input) +{ + return new ObjectString(datadir); +} + const ObjectBase* GMT_ColorGray(const ObjectList* input) { struct gmt_color c; diff --git a/modules/gmt/modgmt_func.h b/modules/gmt/modgmt_func.h index c101117..9aa286a 100644 --- a/modules/gmt/modgmt_func.h +++ b/modules/gmt/modgmt_func.h @@ -6,6 +6,7 @@ const ObjectBase* GMT_Header(const ObjectList* input); const ObjectBase* GMT_Footer(const ObjectList* input); +const ObjectBase* GMT_Datadir(const ObjectList* input); const ObjectBase* GMT_ColorGray(const ObjectList* input); const ObjectBase* GMT_ColorRGB(const ObjectList* input); const ObjectBase* GMT_ColorHSV(const ObjectList* input); diff --git a/modules/gmt/modgmt_internals.cpp b/modules/gmt/modgmt_internals.cpp index 732e887..37cf65f 100644 --- a/modules/gmt/modgmt_internals.cpp +++ b/modules/gmt/modgmt_internals.cpp @@ -3,6 +3,7 @@ #include "modgmt_internals.h" std::string header,footer; +std::string datadir; // Workaround exit() in GMT_Call_Module. May need because return mode of gmt api is not very reliable #if defined MODGMT_WORKAROUND_EXIT diff --git a/modules/gmt/modgmt_internals.h b/modules/gmt/modgmt_internals.h index 4b33dd9..88fda2d 100644 --- a/modules/gmt/modgmt_internals.h +++ b/modules/gmt/modgmt_internals.h @@ -7,6 +7,7 @@ // here we save header and footer of gmt-produced eps files extern std::string header,footer; +extern std::string datadir; extern const int GMTMODE; // Parameters for working thread